乐筑天下

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

[编程交流] 沿柱脚对齐块

[复制链接]

1

主题

2

帖子

1

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 17:06:02 | 显示全部楼层 |阅读模式
我正在寻找在距离不均匀的pline上放置块的常规方法,例如:
前200,
距第一点150’的第二个
3rd 300’等
thx有任何帮助
回复

使用道具 举报

2

主题

53

帖子

51

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 17:21:31 | 显示全部楼层
您可以尝试将这两个LISP组合起来,但它不会将块与直线对齐。。。
Measureplinepnts将在指定距离处创建autocad点。然后可以使用replacepoints将所述点替换为块,但正如我所说的,它不会将它们与直线对齐。
测量点。lsp
替换点。lsp
回复

使用道具 举报

1

主题

316

帖子

311

银币

初来乍到

Rank: 1

铜币
29
发表于 2022-7-6 17:30:17 | 显示全部楼层
试试这个……:-)
 
 
 
  1. ;;;WIZMAN 01DEC08
  2. (vl-load-com)
  3. (defun c:balign        (/ bal_blk bal_blk_ent bal_dist bal_ent bal_ent_sp bal_tot_dist)
  4.    (if
  5. (and
  6.     (not
  7.         (while
  8.             (not
  9.                 (and
  10.                     (or
  11.                         (setq
  12.                             bal_ent (entsel "\n>>>...Pick Polyline, Line or Spline...<<<")
  13.                         ) ;_ end_setq
  14.                         (princ "\n>>>...Missed, Try again...<<<")
  15.                     ) ;_ end_or
  16.                     (if        bal_ent
  17.                         (or
  18.                             (member (cdr (assoc 0 (entget (car bal_ent))))
  19.                                     '("LWPOLYLINE" "SPLINE" "LINE")
  20.                             ) ;_ end_member
  21.                             (not
  22.                                 (princ "\n>>>...Object is not a Line, Polyline, Spline...<<<"
  23.                                 ) ;_ end_princ
  24.                             ) ;_ end_not
  25.                         ) ;_ end_or
  26.                     ) ;_ end_if
  27.                 ) ;_ end_and
  28.             ) ;_ end_not
  29.         ) ;_ end_while
  30.     ) ;_ end_not
  31.     (not
  32.         (while
  33.             (not
  34.                 (and
  35.                     (or
  36.                         (setq bal_blk_ent (entsel "\n>>>...Pick Block...<<<"))
  37.                         (princ "\n>>>...Missed, Try again...<<<")
  38.                     ) ;_ end_or
  39.                     (if        bal_blk_ent
  40.                         (or
  41.                             (member (cdr (assoc 0 (entget (car bal_blk_ent))))
  42.                                     '("INSERT")
  43.                             ) ;_ end_member
  44.                             (not
  45.                                 (princ "\n>>>...Object is not a Block...<<<"
  46.                                 ) ;_ end_princ
  47.                             ) ;_ end_not
  48.                         ) ;_ end_or
  49.                     ) ;_ end_if
  50.                 ) ;_ end_and
  51.             ) ;_ end_not
  52.         ) ;_ end_while
  53.     ) ;_ end_not
  54.     (setq bal_blk (cdr (assoc 2 (entget (car bal_blk_ent)))))
  55. ) ;_ end_and
  56.    (progn
  57.        (setq bal_ent_sp (vlax-curve-getstartpoint (car bal_ent)))
  58.        (setq bal_tot_dist '(+))
  59.        (while (setq bal_dist (getreal "\n>>>...Enter Distance...>>>: "))
  60.            (if (<= (eval (setq bal_tot_dist (append bal_tot_dist (list bal_dist))))
  61.                    (vlax-curve-getdistatparam
  62.                        (car bal_ent)
  63.                        (vlax-curve-getendparam (car bal_ent))
  64.                    ) ;_ end_vlax-curve-getdistatparam
  65.                ) ;_ end_<=
  66.                (entmake
  67.                    (list (cons 0 "INSERT")
  68.                          (cons 2 bal_blk)
  69.                          (cons 10
  70.                                (vlax-curve-getpointatdist
  71.                                    (car bal_ent)
  72.                                    (eval bal_tot_dist)
  73.                                ) ;_ end_vlax-curve-getpointatdist
  74.                          ) ;_ end_cons
  75.                          (cons 41 1)
  76.                          (cons 42 1)
  77.                          (cons 43 1)
  78.                          (cons 50
  79.                                (angle '(0 0)
  80.                                       (vlax-curve-getFirstDeriv
  81.                                           (car bal_ent)
  82.                                           (vlax-curve-getParamAtPoint
  83.                                               (car bal_ent)
  84.                                               (vlax-curve-getpointatdist
  85.                                                   (car bal_ent)
  86.                                                   (eval bal_tot_dist)
  87.                                               ) ;_ end_vlax-curve-getpointatdist
  88.                                           ) ;_ end_vlax-curve-getParamAtPoint
  89.                                       ) ;_ end_vlax-curve-getFirstDeriv
  90.                                ) ;_ end_angle
  91.                          ) ;_ end_cons
  92.                    ) ;_ end_list
  93.                ) ;_ end_entmake
  94.                (progn (princ "\n>>>...Distance exceeds Length of Polyline...<<<\n") (exit))
  95.            ) ;_ end_if
  96.        ) ;_ end_while
  97.    ) ;_ end_progn
  98.    ) ;_ end_if
  99.    (princ)
  100. ) ;_ end_defun
  101. (prompt "\n>>>...Balign.lsp is now loaded, Type 'Balign' to run command...<<<")
  102. (princ)
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 17:38:15 | 显示全部楼层
由于wizman不允许用户退出WHILE循环,因此代码可以简化为:
[code];;;WIZMAN 01 2008年12月;;mod by CAB(vl load com)(定义c:balign(/bal\u blk bal\u blk\u ent bal\u dist bal\u ent bal\u sp bal\u tot\u dist)(while;仅在nil时退出(not(and;仅当用户选择并为成员时才会返回T)(或(setq bal\u ent(entsel“\n>>>…拾取多段线、直线或样条曲线……缺失,重试……对象不是直线、多段线、样条曲线……拾取块……缺失,重试……对象不是块……输入距离…>>:”)(如果(
回复

使用道具 举报

CAB

29

主题

781

帖子

430

银币

中流砥柱

Rank: 25

铜币
526
发表于 2022-7-6 17:52:17 | 显示全部楼层
谢谢艾伦,我正在努力,但没有时间完成,因为我去阿联酋看了世界上最大的烟花,这是一项正在进行的工作,您的建议/改进很有价值:
 
 
 
[code];;;WIZMAN 01DEC08(vl load com)(defun c:balign(/bal\u blk bal\u blk\u ent bal\u dist bal\u ent bal\u ent\u sp bal\u tot\u dist*error*)(defun*error*(msg)(和bal\u ent(not(redraw(car bal\u ent)4))(和bal\u blk\u ent(not(redraw(car bal\u blk\u ent)4));\uend\u defun(setvar'errno 0)(if(and(not)(while(not)(and(or)(setq bal\u ent(entsel)“\n>>>…拾取多段线、直线或样条曲线……缺失,重试……对象不是直线、多段线、样条曲线……拾取块……缺失,重试……对象不是块……输入距离……”                                                  ": "                                          ) ;_ end_strcat);_end_getreal);_end\u setq(如果bal\u temp(setq bal\u dist bal\u temp)(setq bal\u temp bal\u dist));\uend_if);_end\U progn(如果(
回复

使用道具 举报

1

主题

316

帖子

311

银币

初来乍到

Rank: 1

铜币
29
发表于 2022-7-6 17:59:52 | 显示全部楼层
这是完美的thx很多
回复

使用道具 举报

1

主题

2

帖子

1

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 18:08:19 | 显示全部楼层
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-4 19:24 , Processed in 0.851063 second(s), 66 queries .

© 2020-2025 乐筑天下

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