hosyn 发表于 2022-7-5 20:24:21

如何使lisp命令

如何在一个lisp命令中一个接一个地为选定的PLINE和测量命令它们??

ReMark 发表于 2022-7-5 20:33:25

为了清晰起见,您需要一个lisp例程,该例程允许用户一次选择(比如说)十行,并报告每行的长度,而不是所有十行的总长度。是这样吗?

Tharwat 发表于 2022-7-5 20:41:52


 

(defun c:Test (/ o)
;;    Tharwat 07.01.2014    ;;
(princ "\n Pick a Polyline or Line :")
(while
   (setq o (ssget "_+.:S:E" '((0 . "*POLYLINE,LINE"))))
    (princ (strcat "Total length of object : < " (rtos (vlax-curve-getdistatpoint (ssname o 0) (vlax-curve-getendpoint (ssname o 0))) 2 4) " > " ))
)
(princ)
)

mostafa badran 发表于 2022-7-5 20:42:28

尝试
(defun c:test (/ CNT DIST ENT SS)
;m badran
(setq ss (ssget '((0 . "LWPOLYLINE,POLYLINE,SPLINE,LINE,ARC"))))
(setq dist (getdist "\nEnter Dist:"))
(setq cnt 0)
(while
   (setq ent (ssname ss cnt))
    (command "MEASURE" ent dist (setq cnt (+ 1 cnt)))
)
(princ)
)

hosyn 发表于 2022-7-5 20:49:20

嗨,伙计们
实际上,我的问题是关于在上面放置块的测量命令。我使用lisp代码选择pline并在其上附加块。。
现在我想用lisp代码,通过ssget命令lisp在绘图中选择一些pline,并在其上放置逐块测量命令。
感谢您的帮助

BIGAL 发表于 2022-7-5 20:54:56

与手动输入相比,请查看此行
 

;(command "MEASURE" ent dist (setq cnt (+ 1 cnt)))
;try
(command "-MEASURE" ent "b" blockname rot dist)
(setq cnt (+ 1 cnt)))

您需要为blockname添加行,并旋转yes或no

mostafa badran 发表于 2022-7-5 21:01:06

好的试试这个
HTH。
(defun c:mob(/ BLOCKNAME CNT DIST ENT SS YES-NO )
;m badran
(setq blockname(getstring "\nEnter block name:"))
   (initget 1 "Yes No")
(setq Yes-No(getkword "\nAlign block with object? : "))
(setq ss (ssget '((0 . "LWPOLYLINE,POLYLINE,SPLINE,LINE,ARC"))))
(setq dist (getdist "\nEnter Dist:"))
(setq cnt 0)
(while
   (setq ent (ssname ss cnt))
    (command "_MEASURE" ent "b" blockname Yes-No dist)
(setq cnt (+ 1 cnt))
)
(gc)
(princ)
)

BIGAL 发表于 2022-7-5 21:07:57

不确定是否在变量名中使用/也许是否更好。

mostafa badran 发表于 2022-7-5 21:17:14

 
谢谢比格尔的建议,我以后会考虑的。

hosyn 发表于 2022-7-5 21:21:26

Thanxxxxxxxxxxxx mostafa badran和bigal以及其他人
你的日常活动是Okkkkkkkkkkkkkk
非常感谢
页: [1] 2
查看完整版本: 如何使lisp命令