如何用vlisp新建多重引线样式
(vla-item (vla-get-dictionaries (vla-get-activedocument (vlax-get-acad-object))) "ACAD_MLEADERSTYLE")请问大佬们,用以上函数提取多重引线样式合集后用哪个函数可以在合集里添加一个样式名为“xp”的多重引线样式
;;;从AutoCAD 2013 Active Reference帮助中code Examples中提取
;;;本源代码由 xshrimp 2013.2.20 搜集整理,版权归原作者所有!
(vl-load-com)
(defun c:Example_MLeaderStyle()
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(setq oDict (vla-Item (vla-get-Dictionaries doc) "ACAD_MLEADERSTYLE")
i 0)
(while (>= (1- (vla-get-Count oDict))i)
(setq oObj (vla-Item oDict i))
(if (= (vla-get-ObjectName oObj) "AcDbMLeaderStyle")
(setq oMLS oObj)
(alert (strcat "Name = " (vla-get-Name oMLS)
"\nAnnotative = " (if (= (vla-get-Annotative oMLS) :vlax-true) "True" "False")
"\nContentType = " (itoa (vla-get-ContentType oMLS))
"\nLeaderLineType = " (vla-get-Name (vla-get-LeaderLineType oMLS))))
)
(setq i (1+ i))
)
(setq oNewMLS (vla-AddObject oDict "TEST" "AcDbMLeaderStyle"))
(vla-put-LeaderLineType oNewMLS acSplineLeader)
(setq oCol (vlax-create-object "AutoCAD.AcCmColor.19"))
(vla-put-ColorIndex oCol acBlue)
(vla-put-LeaderLineColor oNewMLS oCol)
(vla-SetVariable doc "CMLEADERSTYLE" "TEST")
(setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
(vlax-safearray-fill points '(1 1 0
2 2 0
)
)
(setq i 0)
(setq modelSpace (vla-get-ModelSpace doc))
(setq oML (vla-AddMLeader modelSpace points i))
(vla-put-TextString oML "mleader created with \nstyle \"TEST\"")
(vlax-release-object oCol)
)
liuhe 发表于 2024-1-18 17:03
(setq oCol (vlax-create-object "AutoCAD.AcCmColor.19"))
这个19是对应cad版本,cad2024就是24...
单位的电脑运行(setq NewmleaderstylesObj (vla-AddObject mleaderstylesObj "xp" "AcDbMLeaderStyle"))这行代码时提示错误
; 错误: Automation 错误。 系统注册表中不存在 AcRxClassName 项 xpzzj 发表于 2024-1-18 14:19
(setq oNewMLS (vla-AddObject oDict "TEST" "AcDbMLeaderStyle"))
大佬,这个函数好像不对吧
(setq oCol (vlax-create-object "AutoCAD.AcCmColor.19"))
这个19是对应cad版本,cad2024就是24我这边测试没问题 (setq mleaderstylesobj (vla-item (vla-get-dictionaries (vla-get-activedocument (vlax-get-acad-object))) "ACAD_MLEADERSTYLE"))
(vla-addobject mleaderstylesobj "xp" "AcDbMLeaderStyle")
用这个函数返回nil liuhe 发表于 2024-1-16 16:14
谢谢,我研究一下 http://bbs.mjtd.com/thread-188328-1-1.html
http://bbs.mjtd.com/thread-185240-1-1.html
多重引线,看我这个够用不够用:lol
天天问 发表于 2024-1-17 13:39
http://bbs.mjtd.com/thread-188328-1-1.html
http://bbs.mjtd.com/thread-185240-1-1.html
多重引线,看 ...
你那个用的是DXF群码,改不了“箭头符号”样式,我想用VLA函数改“箭头符号”样式 liuhe 发表于 2024-1-16 16:14
(setq oNewMLS (vla-AddObject oDict "TEST" "AcDbMLeaderStyle"))
大佬,这个函数好像不对吧 liuhe 发表于 2024-1-18 17:03
(setq oCol (vlax-create-object "AutoCAD.AcCmColor.19"))
这个19是对应cad版本,cad2024就是24...
奇怪,家里的电脑可以,明天我去单位再看看,谢谢! liuhe 发表于 2024-1-18 17:03
(setq oCol (vlax-create-object "AutoCAD.AcCmColor.19"))
这个19是对应cad版本,cad2024就是24...
(setq oCol (vlax-create-object (strcat "AutoCAD.AcCmColor." (substr (getvar "ACADVER") 1 2))))
页:
[1]
2