乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: TheNewGuy

[编程交流] 我有一个很大的要求!!

[复制链接]

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:08:26 | 显示全部楼层
 
这是意料之中的,因为我不确定这些职位,但我只是想知道是否还有其他需要改变的地方。
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:09:36 | 显示全部楼层
不,除了我们讨论的所有距离的表之外,发布的lisp正是我想要的!我很惊讶你能这么快制作出这些程序!
回复

使用道具 举报

8

主题

42

帖子

34

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 15:15:29 | 显示全部楼层
好的,我在这个版本中做了一些更改:
 
[列表]
  • 所有点都是相对的-无论您在图形中绘制圆的位置,写入文件的点都将相对于各自圆的中心。
    [/列表]
    [列表]
  • 左下角和右下角点的间距为0.05,与圆的半径无关。
    [/列表]
    [列表]
  • 相对于较小圆的点作为一条直线写在主要结果下方。
    [/列表]
    1. (defun c:cCut  (/ doc spc cEnt root ofile tNum tmp1 tmp2
    2.                  tmp3 tmp4 bsRad cCen cNum cAng i cPt str)
    3. (vl-load-com)
    4. (setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object))
    5.        spc (if (zerop (vla-get-activespace doc))
    6.              (if (= (vla-get-mspace doc) :vlax-true)
    7.                (vla-get-modelspace doc)
    8.                (vla-get-paperspace doc))
    9.              (vla-get-modelspace doc)))
    10. (setvar "PDMODE" 3)      ; Point Style
    11. (setvar "PDSIZE" 0.01)  ; Point Size
    12. (or cut:out (setq cut:out 0.05))
    13. (or cut:spc (setq cut:spc 0.007))
    14. (or cut:row (setq cut:row 0.02))
    15. (or cut:cir (setq cut:cir 0.125))
    16. (if (and (setq cEnt (car (entsel "\nSelect Base Circle: ")))
    17.           (eq "CIRCLE" (cdr (assoc 0 (entget cEnt)))))
    18.    (progn
    19.      (setq root (strcat (getvar "DWGPREFIX")
    20.                         (substr (getvar "DWGNAME") 1
    21.                                 (- (strlen (getvar "DWGNAME")) 4)))
    22.            tNum 0. col 1
    23.            ofile (open (strcat root "_BASE.csv") "w"))
    24.      (write-line "Centre,Top,Right,Left,Bottom Right,Bottom Left" ofile)
    25.      (initget 4)
    26.      (setq tmp1 (getreal (strcat "\nSpecify Spacing from Edge <" (rtos cut:out) "> : ")))
    27.      (or (not tmp1) (setq cut:out tmp1))
    28.      (initget 4)
    29.      (setq tmp2 (getreal (strcat "\nSpecify Circle Spacing <" (rtos cut:spc) "> : ")))
    30.      (or (not tmp2) (setq cut:spc tmp2))
    31.      (initget 4)
    32.      (setq tmp3 (getreal (strcat "\nSpecify Row Spacing <" (rtos cut:row) "> : ")))
    33.      (or (not tmp3) (setq cut:row tmp3))
    34.      (initget 6)
    35.      (setq tmp4 (getreal (strcat "\nSpecify Inner Circle Radius <" (rtos cut:cir) "> : ")))
    36.      (or (not tmp4) (setq cut:cir tmp4))
    37.      (setq bsRad (- (cdr (assoc 40 (entget cEnt))) cut:out cut:cir)
    38.            cCen  (cdr (assoc 10 (entget cEnt))))
    39.      (while (and (not (minusp bsRad))
    40.                  (< cut:cir bsRad))
    41.        (setq cNum (fix (/ (* 2 pi bsRad) (+ (* 2 cut:cir) cut:spc)))
    42.              cAng (/ (* 2 pi) cNum)
    43.              i    0 str "")
    44.        (while (< i cNum)
    45.          (vla-put-color
    46.            (vla-addCircle spc
    47.              (vlax-3D-point
    48.                (setq cPt (polar cCen (* i cAng) bsRad))) cut:cir) col)
    49.          (foreach x (list cPt (polar cPt (/ pi 2) cut:cir)
    50.                               (polar cPt 0  cut:cir)
    51.                               (polar cPt pi cut:cir)
    52.                               (polar (polar cPt 0  0.0396) (/ (* 3 pi) 2) 0.1186)
    53.                               (polar (polar cPt pi 0.0396) (/ (* 3 pi) 2) 0.1186))
    54.            (vla-addPoint spc (vlax-3D-point x))
    55.            (setq str (strcat str (vl-princ-to-string x) (chr 44))))
    56.          (write-line str ofile)
    57.          (setq i (1+ i) tNum (1+ tNum) str ""))
    58.        (setq bsRad (- bsRad (* 2 cut:cir) cut:row) col (abs (- col 3))))
    59.      (princ (strcat "\n<< Number of Circles: " (rtos tNum 2 0) " >>"))
    60.      (close ofile))
    61.    (princ "\n<!> Incorrect Selection <!>"))
    62. (princ))
  • 回复

    使用道具 举报

    114

    主题

    1万

    帖子

    1万

    银币

    中流砥柱

    Rank: 25

    铜币
    543
    发表于 2022-7-6 15:18:10 | 显示全部楼层
    回复

    使用道具 举报

    8

    主题

    42

    帖子

    34

    银币

    初来乍到

    Rank: 1

    铜币
    40
    发表于 2022-7-6 15:21:31 | 显示全部楼层
     
    Sorry I meant from the center of each arrayed circle to the points on that circle.... does that help?
    回复

    使用道具 举报

    114

    主题

    1万

    帖子

    1万

    银币

    中流砥柱

    Rank: 25

    铜币
    543
    发表于 2022-7-6 15:22:10 | 显示全部楼层
     
    Yes, obviously this will be the same for each circle - so I shall include it as a separate line on the bottom of the file.
     
    Anything else that needs raising about the posted LISP above?  (#12)
    回复

    使用道具 举报

    8

    主题

    42

    帖子

    34

    银币

    初来乍到

    Rank: 1

    铜币
    40
    发表于 2022-7-6 15:26:18 | 显示全部楼层
    I did notice that in the posted lisp the bottom 2 points do not follow the circle when a radius other than .125 is used. They appear to stay in the location that they would be in for a circle with a .125 radius. I am not complaining but I would hate to ask you to redo any of your hard work. Thanks again!
    回复

    使用道具 举报

    114

    主题

    1万

    帖子

    1万

    银币

    中流砥柱

    Rank: 25

    铜币
    543
    发表于 2022-7-6 15:29:26 | 显示全部楼层
     
    That is expected, as I wasn't sure of the positions, but I just wondered if there was anything else that needed changing.
    回复

    使用道具 举报

    8

    主题

    42

    帖子

    34

    银币

    初来乍到

    Rank: 1

    铜币
    40
    发表于 2022-7-6 15:31:34 | 显示全部楼层
    No, other than the table for all the distances we talked about the posted lisp is exactly what I was wanting! I am amazed how quickly you can produce these programs!
    回复

    使用道具 举报

    114

    主题

    1万

    帖子

    1万

    银币

    中流砥柱

    Rank: 25

    铜币
    543
    发表于 2022-7-6 15:35:24 | 显示全部楼层
    OK, I have made a few changes in this version:
     


    • All points are relative - no matter where you draw your circle in your drawing, the points written to file will be relative to the Center of respective circles.


    • The Bottom Left, and bottom right points will be spaced at 0.05, irrelevant of the radius of the circle.


    • The Points relative the smaller circles are written beneath the main results as a one-liner.

    1. (defun c:cCut  (/ doc spc cEnt root ofile tNum tmp1 tmp2 theta                 tmp3 tmp4 bsRad cCen cNum cAng i cPt str) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object))       spc (if (zerop (vla-get-activespace doc))             (if (= (vla-get-mspace doc) :vlax-true)               (vla-get-modelspace doc)               (vla-get-paperspace doc))             (vla-get-modelspace doc))) (setvar "PDMODE" 3)      ; Point Style (setvar "PDSIZE" 0.01)  ; Point Size (or cut:out (setq cut:out 0.05)) (or cut:spc (setq cut:spc 0.007)) (or cut:row (setq cut:row 0.02)) (or cut:cir (setq cut:cir 0.125)) (if (and (setq cEnt (car (entsel "\nSelect Base Circle: ")))          (eq "CIRCLE" (cdr (assoc 0 (entget cEnt)))))   (progn     (setq root (strcat (getvar "DWGPREFIX")                        (substr (getvar "DWGNAME") 1                                (- (strlen (getvar "DWGNAME")) 4)))           tNum 0. col 1           ofile (open (strcat root "_BASE.csv") "w"))     (write-line "Centre,Top,Right,Left,Bottom Right,Bottom Left" ofile)     (initget 4)     (setq tmp1 (getreal (strcat "\nSpecify Spacing from Edge  : ")))     (or (not tmp1) (setq cut:out tmp1))     (initget 4)     (setq tmp2 (getreal (strcat "\nSpecify Circle Spacing  : ")))     (or (not tmp2) (setq cut:spc tmp2))     (initget 4)     (setq tmp3 (getreal (strcat "\nSpecify Row Spacing  : ")))     (or (not tmp3) (setq cut:row tmp3))     (initget 6)     (setq tmp4 (getreal (strcat "\nSpecify Inner Circle Radius  : ")))     (or (not tmp4) (setq cut:cir tmp4))     (setq bsRad (- (cdr (assoc 40 (entget cEnt))) cut:out cut:cir)           cCen  (cdr (assoc 10 (entget cEnt))))     (while (and (not (minusp bsRad))                 (< cut:cir bsRad))       (setq cNum (fix (/ (* 2 pi bsRad) (+ (* 2 cut:cir) cut:spc)))             cAng (/ (* 2 pi) cNum)             i    0 str "")       (while (< i cNum)         (vla-put-color           (vla-addCircle spc             (vlax-3D-point               (setq cPt (polar cCen (* i cAng) bsRad))) cut:cir) col)         (setq theta (atan                       (/ (/ 0.025 cut:cir)                          (sqrt                            (- 1. (expt (/ 0.025 cut:cir) 2))))))         (foreach x (mapcar '(lambda (x) (mapcar '- x cCen))                  (list cPt (polar cPt (/ pi 2) cut:cir)                              (polar cPt 0  cut:cir)                              (polar cPt pi cut:cir)                              (polar cPt (+ (/ (* 3 pi) 2) theta) cut:cir)                              (polar cPt (- (/ (* 3 pi) 2) theta) cut:cir)))           (vla-addPoint spc (vlax-3D-point (mapcar '+ cCen x)))           (setq str (strcat str (vl-princ-to-string x) (chr 44))))         (write-line str ofile)         (setq i (1+ i) tNum (1+ tNum) str ""))       (setq bsRad (- bsRad (* 2 cut:cir) cut:row) col (abs (- col 3))))     (princ (strcat "\n>"))     (write-line "Points Rel. Inner Circle:" ofile)     (write-line (strcat "(0 0 0),(0 " (rtos cut:cir) " 0),("                         (rtos cut:cir) " 0 0),(" (rtos (* -1. cut:cir))                         " 0 0),(" (rtos (* cut:cir (sin theta))) (chr 32)                         (rtos (* -1. cut:cir (cos theta))) " 0),("                         (rtos (* -1. cut:cir (sin theta))) (chr 32)                         (rtos (* -1. cut:cir (cos theta))) " 0)") ofile)                               (close ofile))   (princ "\n Incorrect Selection ")) (princ))
    回复

    使用道具 举报

    发表回复

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    • 微信公众平台

    • 扫描访问手机版

    • 点击图片下载手机App

    QQ|关于我们|小黑屋|乐筑天下 繁体中文

    GMT+8, 2025-3-5 00:34 , Processed in 0.324372 second(s), 70 queries .

    © 2020-2025 乐筑天下

    联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表