Load 方法 (ActiveX)
从自定义 (CUIx) 文件加载菜单组,或从库 (LIN) 文件加载线型定义。 支持的平台:仅限 Windows 签名 - 线型VBA: object.Load LineTypeName, FileName
签名 - MenuGroupsVBA: RetVal = object.Load(MenuFileName [,BaseMenu])
返回值 (RetVal) - 线型无返回值。 言论线型:尽管可以使用该方法创建线型并将其添加到集合对象中,但将仅使用默认属性创建该线型。由于无法使用此版本的 ActiveX 自动化编辑线型属性,因此请使用此方法将现有线型加载到图形中。LinetypesAdd MenuGroups:AutoCAD 搜索具有指定 MenuFileName 和 .cuix 扩展名的自定义文件。 例子VBA: Sub Example_Load()
' This example attempts to load the linetype "CENTER" from
' the acad.lin file. If the linetype already exists, then
' a message is displayed.
Dim linetypeName As String
linetypeName = "CENTER"
' Load "CENTER" line type from acad.lin file
On Error Resume Next ' trap any load errors
ThisDrawing.Linetypes.Load linetypeName, "acad.lin"
' If the name already exists, then notify user
If Err.Description = "Duplicate record name" Then
MsgBox "A line type named '" & linetypeName & "' already exists.", , "Load Example"
End If
End Sub
可视化 LISP: (vl-load-com)
(defun c:Example_Load()
;; This example attempts to load the linetype "CENTER" from
;; the acad.lin file. If the linetype already exists, then
;; a message is displayed.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(setq linetypeName "CENTER")
;; Load "CENTER" line type from acad.lin file
(setq err (vl-catch-all-apply 'vla-Load (list (vla-get-Linetypes doc) linetypeName "acad.lin")))
;; If the name already exists, then notify user
(if (vl-catch-all-error-p err)
(if (= (vl-catch-all-error-message err) "Automation Error. Duplicate record name")
(alert (strcat "A line type named '" linetypeName "' already exists."))
)
)
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 07:04
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.