ActiveLinetype 属性 (ActiveX)
指定绘图的活动线型。 支持的平台:仅限 Windows 言论图形中必须已存在指定的线型。若要添加新的线型,请使用该方法。Add 例子VBA: Sub Example_ActiveLinetype() ' This example finds the current linetype. It then sets ' the new linetype to be the first entry in the linetype ' collection that is not equal to the current linetype. ' Finally, it resets the active linetype to the original ' setting. Dim currLineType As AcadLineType Dim newLineType As AcadLineType ' Find the current LineType of the active document Set currLineType = ThisDrawing.ActiveLinetype MsgBox "The current linetype is " & currLineType.name, vbInformation, "ActiveLinetype Example" ' Set the current Linetype to anything else in the collection Dim entry Dim found As Boolean For Each entry In ThisDrawing.Linetypes If StrComp(entry.name, currLineType.name, 1) <> 0 Then Set newLineType = entry found = True Exit For End If Next If found Then ThisDrawing.ActiveLinetype = newLineType MsgBox "The new linetype is " & newLineType.name, vbInformation, "ActiveLinetype Example" ' Reset the linetype to the previous setting ThisDrawing.ActiveLinetype = currLineType MsgBox "The active linetype is reset to " & currLineType.name, vbInformation, "ActiveLinetype Example" End If End Sub 可视化 LISP: (vl-load-com) (defun c:Example_ActiveLinetype() ;; This example finds the current linetype. It then sets ;; the new linetype to be the first entry in the linetype ;; collection that is not equal to the current linetype. ;; Finally, it resets the active linetype to the original ;; setting. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Find the current LineType of the active document (setq currLineType (vla-get-ActiveLinetype doc)) (alert (strcat "The current linetype is " (vla-get-Name currLineType))) ;; Set the current Linetype to anything else in the collection (setq newLineType nil) (setq found :vlax-false) (vlax-for each-linetype (vla-get-Linetypes doc) (if (and (/= (vla-get-Name each-linetype) (vla-get-Name currLineType)) (/= found :vlax-true)) (progn (setq newLineType each-linetype) (setq found :vlax-true) ) ) ) (if (= found :vlax-true) (progn (vla-put-ActiveLinetype doc newLineType) (alert (strcat "The new linetype is " (vla-get-Name newLineType))) ;; Restore the previous linetype (vla-put-ActiveLinetype doc currLineType) (alert (strcat "The active linetype is restored to " (vla-get-Name currLineType))) ) ) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2024-12-15 22:02
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.