yangchao2005090 发表于 2020-6-24 08:05:16

画双线求修改

本帖最后由 yangchao2005090 于 2020-6-24 08:25 编辑

下面是论坛的代码,能否实现自己命令行输入两边的偏移距离(输入一次比如,100,自动两侧偏移100,如果能够记忆功能最好,比如下次直接是100),生成中心线保留
;;http://bbs.mjtd.com/thread-180485-1-1.html
(defun c:tt (/ en lay)
(command "-layer" "m" "aa" "c" 1 """L" "continuous" "" "");创建新层
(setq lay(getvar "clayer"))
(setvar "clayer""aa")
(setvar "OSMODE" 15359)
(command "_.PLINE")
(while (> (getvar "CMDACTIVE") 0) (command PAUSE))
(setq en( vlax-ename->vla-object (entlast)))
(vla-offset en 50)
(vla-offset en -50)
(entdel en)
(setvar "clayer" lay)
)

satan421 发表于 2020-6-24 08:05:17

;;原位生成中心线?
(defun c:tt (/ en lay)
(if (null dist)
    (setq dist (getreal "\n输入偏移距离<100>: "))
    (setq dist (getreal (strcat "\n输入偏移距离<" (rtos dist 2 2) ">: ")))
)
(if (null dist) (setq dist 100.0))
(if (= (tblseARCh "layer" "aa") nil)
    (progn(command "-layer" "m" "aa" "c" 1 """L" "continuous" "" "")(setq lay (getvar "clayer"))(setvar "clayer""aa"))
    (progn(setq lay (getvar "clayer"))(setvar "clayer""aa"))
)
(setvar "OSMODE" 15359)
(command "_.PLINE")
(while (> (getvar "CMDACTIVE") 0) (command PAUSE))
(setq en( vlax-ename->vla-object (entlast)))
(vla-offset en dist)
(vla-offset en (- dist))
(if lay (setvar "clayer" lay))
(princ)
)

satan421 发表于 2020-6-24 09:10:39

;;
(defun c:tt (/ en lay)
(or dist
      (setq dist (getreal "\n输入偏移距离<100>: "))
)
(if (null dist) (setq dist 100.0))
(if (= (tblseARCh "layer" "aa") nil)
    (progn(command "-layer" "m" "aa" "c" 1 """L" "continuous" "" "")(setq lay (getvar "clayer"))(setvar "clayer""aa"))
    (progn(setq lay (getvar "clayer"))(setvar "clayer""aa"))
)
(setvar "OSMODE" 15359)
(command "_.PLINE")
(while (> (getvar "CMDACTIVE") 0) (command PAUSE))
(setq en( vlax-ename->vla-object (entlast)))
(vla-offset en dist)
(vla-offset en (- dist))
(vla-delete en)
(if lay (setvar "clayer" lay))
(princ)
)

yangchao2005090 发表于 2020-6-24 13:47:32

satan421 发表于 2020-6-24 09:10
;;
(defun c:tt (/ en lay)
(or dist


您好,这个好像有点问题,再次输入命令tt时,不提示输入偏移距离

yangchao2005090 发表于 2020-6-24 13:52:19

satan421 发表于 2020-6-24 09:10
;;
(defun c:tt (/ en lay)
(or dist


还有可否沿着参考中心线原位生成中心线,也就是此命令沿着参考线生成一条线,然后依据偏移距离一边生成一条线,共三条线

1028695446 发表于 2020-6-24 19:33:04

本帖最后由 1028695446 于 2020-6-24 19:40 编辑

我来试试,在satan421的基础上修改的
偏移距离正值保留原线,并改改线型为 中心线
偏移距离负值删除原线

yangchao2005090 发表于 2020-6-24 21:59:31

1028695446 发表于 2020-6-24 19:33
我来试试,在satan421的基础上修改的
偏移距离正值保留原线,并改改线型为 中心线
偏移距离负值删除原线
...

这个也很好,也谢谢你

czb203 发表于 2020-8-6 21:34:34

这个也很好,也谢谢你

stonedesign 发表于 2021-10-23 16:16:38

这个很好用,很喜欢

jhzxj 发表于 2021-12-20 10:29:57

太好了,佩服佩服,这可以做画平面公路使用,谢谢!
页: [1] 2
查看完整版本: 画双线求修改