希望*插入动态Blo
好的,我最近发现了如何对块应用动态旋转,保持文本/属性相对于原始位置的位置,但不实际旋转。它非常完美,我很高兴能在我的公司实施它。然而,我也在处理一些功能区选项卡,这些选项卡将包含一系列这些块(不同的符号和/或属性)。现在,我只是使用宏插入块,并绕过该特定块所需的任何步骤(缩放、旋转等)。然而,对于传统块,我需要使用多年前在我们公司创建的LISP例程来旋转属性(我认为它是在AutoCAD具备该功能之前创建的?我不知道,我只使用CAD大约8.5年)。
我正在尽可能多地实现自动化:
[列表=1]
[*]插入动态块
[*]基于USERR1值的比例
[*]强制旋转到0度
[*]允许用户输入属性
[*]选择(仅)动态旋转夹点
[*]允许用户输入动态旋转
[*]重复上述所有操作,直到取消为止
[/列表]
我很确定这只能通过LISP实现,但我对LISP编程一无所知,希望有人能帮上忙。
我用这个“自动对齐”文本功能附加了许多块中的一块。
提前感谢!
样本。图纸 请尝试以下代码:
(defun C:bpro(/ acsp adoc attvalue blkname blkobj prop_lst prop_names pt scl )
(or adoc (setq adoc (vla-get-activedocument (vlax-get-acad-object))))
(if (and (= (getvar "tilemode") 0) (= (getvar "cvport") 1))
(setq acsp (vla-get-paperspace adoc))
(setq acsp (vla-get-modelspace adoc))
)
(vla-startundomark adoc)
(setq blkname "RECEPTACLE-DUPLEX-PLAY");<-- block name
(if (not (tblsearch "block" blkname))(progn
(alert "No such block in drawing, exit.")
(exit)(princ))
)
(if (= 0 (setq scl (getvar "USERR1")))
(setq scl (getreal "\nEnter User scale value: "))
(setvar "USERR1" scl)
)
(while (setq pt (getpoint "\nPick insertion point (Or press Enter to Exit): "))
(setq blkobj (vlax-invoke acsp 'insertblock pt blknamescl scl scl 0))
(if (eq :vlax-true
(vla-get-isdynamicblock
(vla-item
(vla-get-blocks
(vla-get-activedocument (vlax-get-acad-object))
)
(vla-get-effectivename blkobj)
)
)
)
(progn
(setq prop_names
(mapcar 'vla-get-propertyname
(setq
prop_lst
(vlax-safearray->list
(vlax-variant-value
(vla-getdynamicblockproperties blkobj)
)
)
)
)
)
(foreach prop prop_lst
(if (and (eq "Angle1" (vla-get-propertyname prop))
(member "Angle1" prop_names)
)
(vla-put-value
prop
(vlax-make-variant
0.0
(vlax-variant-type (vla-get-value prop))
)
)
)
)
)
)
(setq attvalue (getstring T"\nEnter attribute value for CCT : "))
(foreach att (vlax-invoke blkobj 'getattributes)
(if (eq "CCT" (vla-get-tagstring att))
(vla-put-textstring att attvalue)
)
)
)
(princ)
)
(prompt "\nType BPRO to run the command")
(prin1)
(or (vl-load-com)
(princ))
~'J'~
页:
[1]