使dimlinear关联
我正在尝试编写一个lisp例程,该例程可以标注与设计的水平和垂直偏差:(定义c:ddxy()
(setq p1(getpoint“测量点:”))
(setq p2(getpoint“设计点:”))
(命令“dimlinear”p1 p2“U v”pause)
(命令“dimlinear”p1 p2“U h”暂停)
)
p1通常是点对象
p2通常是直线的终点或圆心
运行此lisp时,创建的第一个尺寸标注与两个对象正确关联,但第二个尺寸标注是非关联的。
当然,我可以手动创建每个单独的水平和垂直维度,但我希望将工作量减半,让lisp为我完成重复的操作!
有人能帮忙解决这个问题吗?我尝试过使用osnap设置,并在创建第二个dim之前将第一个dim发送到后面,但没有效果。
谢谢
抢劫 有人知道如何在不使用命令功能的情况下创建关联标注吗?
(defun c:test ( / p1 p2 ang )
(if
(and (setq p1 (getpoint "\nSpecify first point of dimension: "))
(setq p2 (getpoint p1 "\nSpecify second point of dimension: "))
)
(vla-adddimrotated
(vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))
(vlax-3d-point p1) (vlax-3d-point p2)
(vlax-3d-point (polar p1 (+ (* 0.5 pi) (setq ang (angle p1 p2))) (distance p1 p2)))
ang
)
) (princ)
) 有人能帮我们吗? 将sysvar DIMASSOC设置为2,所有新DIM将默认为关联。不确定这是否相关,但不要启用节点对象捕捉,除非希望DIM彼此关联,而不是对象。绘制的最后一个对象(通常是尺寸标注)位于顶部,因此这是您将遇到的第一个捕捉。 在lisp中创建尺寸时,这不起作用(除非使用命令函数)。 您需要构建适当的扩展字典。 我走的方向对吗?
(vla-AddObject dict "ACDBVARIABLEDICTIONARY" "AcDbDictionary")
编辑:
我想扩大规模。在我找到这个之前进行研究时(见下文)。我想我必须制作Dimassoc并将其添加到维度扩展字典中。
AcDbVariableDictionary CANNOSCALE CMLEADERSTYLE CTABLESTYLE CVIEWDETAILSTYLE CVIEWSECTIONSTYLE DIMASSOC HIDETEXT LAYEREVAL LAYERNOTIFY Soooo,这是我的方法,但没有奏效。
(setq dic (handent (vla-get-handle (vla-getextensiondictionary dim))))
; blck = block that the dimension is pointing to
; inobj = inside object the snap point is pointing to
; inobj2 = inside object the snap point is pointing to
(setq da
(entmakex
(list
(cons 0 "DIMASSOC")
(cons 330 dic)
(cons 100 "AcDbDimAssoc")
(cons 330 dim)
(cons 90 3)
(cons 70 0)
(cons 71 0)
(cons 1 "AcDbOsnapPointRef")
(cons 72 1)
(cons 331 blck)
(cons 331 inobj)
(cons 73 2)
(cons 91 3)
(cons 40 1.0)
(cons 10 '(0.0 0.0 2.0e+050))
(cons 75 0)
(cons 1 "AcDbOsnapPointRef")
(cons 331 blck)
(cons 331 inobj2)
(cons 72 1)
(cons 73 2)
(cons 91 3)
(cons 40 1.0)
(cons 10 '(0.0 0.0 2.0e+050))
(cons 75 0)
)
))
(entmod (append (entget dic)(list (cons 3 "ACAD_DIMASSOC") (cons 360 da))))
它说,当线路被修改时,关联但从不反应。。。
李,你知道这本书可能在其他什么词典下吗?如果有帮助的话,我可以发布一个更新的lsp。。。
页:
[1]
2