- ;;;从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)
- )
|