luongthevinh 发表于 2022-7-5 17:18:59

帮助:插入多线长度和

作为主题,我想在多线图上插入多线长度和多线比例,供展览承包商使用。
请帮我解决一个Lisp问题
非常感谢。

broncos15 发表于 2022-7-5 17:44:21

我不知道你要什么。你是想把长度和比例放在多线之上(即给它贴标签),还是想要求其他东西?如果您想知道如何找到这些值,请查看函数vla get mlinescale。要得到物体的长度会有点麻烦,因为不幸的是,没有直接的函数。但是,您可以找到多线的点(dxf组码11)。从那里你可以计算长度。如果你有任何问题,请告诉我。

BIGAL 发表于 2022-7-5 18:01:35

broncos15由于多线具有内部和外部偏移,并且这些偏移可能不同,用于创建线的co ORD可能是错误的,但可能更容易重新创建新的多线,偏移它,获得长度,标记它,然后擦除它。您需要所有偏移的“样式名称”信息。现在它在哪里。

luongthevinh 发表于 2022-7-5 18:05:00

是的,我的意思是把长度和比例放在多线之上。
和Lee Mac中的lisp一样http://www.lee-mac.com/midlen.html.用于pline。
我想要长度和比例高于多线的多线。
你能帮助我吗!。
非常感谢。

BIGAL 发表于 2022-7-5 18:27:27

Lee的lisp需要大量重写,因为对象非常不同,代码支持两个方面:对象的长度和找到中点的能力,这两个方面都没有内置到多线中,因此重新开始更容易。
 
; this is the guts not a complete code to see how to get the answers.
; For me just create a new pline then use parts of Lee's code as the field "length" is not supported.
(setq obj (vlax-ename->vla-object (car (entsel "\nPick mline"))))
(setq co-ords (vlax-get obj 'coordinates))
; eg (8696.29 1287.81 0.0 12479.4 1242.65 0.0 12765.7 3184.44 0.0) xyz 2 lines

(setq numb (/ (length co-ords) 3))
(setq I 0)
(command "_pline")
(while (= (getvar "cmdactive") 1 )
(repeat numb
(setq xy (list (nth I co-ords)(nth (+ I 1) co-ords) ))
(setq I (+ I 3))
) ; end repeat
) ; while
(setq ent (vlax-ename->vla-object (entlast)))
(setq len (vla-get-length ent))
(setq par (vlax-curve-getparamatdist ent (/ (vlax-curve-getdistatparam ent (vlax-curve-getendparam ent)) 2.0)))
(setq ins (vlax-curve-getpointatparam obj2 par))
(alert (strcat "length is " (rtos len 2 2) )
; add text part now as per Lee's code
(vla-delete ent) ; no longer need new pline
页: [1]
查看完整版本: 帮助:插入多线长度和