Type 属性 (ActiveX)
指定 Leader、MenuGroup、PopupMenuItem、ToolbarItem、Polyline 或 PolygonMesh 对象的类型。 支持的平台:仅限 Windows 签名VBA: object.Type
属性值 - 3DPolyline只读:不 类型:枚举ac3DPolylineType
属性值 - 领导者只读:不 类型:枚举acLeaderType
属性值 - MenuGroup只读:是的 类型:枚举acMenuGroupType
属性值 - PolygonMesh只读:不 类型:枚举acPolymeshType
属性值 - 折线只读:不 类型:枚举acPolylineType
属性值 - PopupMenuItem只读:是的 类型:枚举acMenuItemType
属性值 - ToolbarItem只读:是的 类型:枚举acToolbarItemType
言论PolygonMesh:如果类型设置为,则 M 和 N 个顶点计数值将用于顶点行列大小。对于任何其他类型,M 和 N 密度值将用作行和列大小。PolygonMeshacSimpleMeshPolygonMesh 例子VBA: Sub Example_Type()
' This example creates a leader in model space.
' It then changes the type of the leader.
Dim leaderObj As AcadLeader
Dim points(0 To 8) As Double
Dim leaderType As Integer
Dim annotationObject As AcadEntity
points(0) = 0: points(1) = 2: points(2) = 0
points(3) = 4: points(4) = 4: points(5) = 0
points(6) = 4: points(7) = 2: points(8) = 0
leaderType = acLineNoArrow
Set annotationObject = Nothing
' Create the leader object in model space
Set leaderObj = ThisDrawing.ModelSpace.AddLeader(points, annotationObject, leaderType)
ZoomAll
' Find the current leader type
leaderType = leaderObj.Type
MsgBox "The leader type is " & Choose(leaderObj.Type + 1, "acLineNoArrow.", "acSplineNoArrow.", "acLineWithArrow.", "acSplineWithArrow."), , "Type Example"
' Change the leader type
leaderObj.Type = acLineWithArrow
leaderObj.Update
MsgBox "The leader type is " & Choose(leaderObj.Type + 1, "acLineNoArrow.", "acSplineNoArrow.", "acLineWithArrow.", "acSplineWithArrow."), , "Type Example"
' Change the leader type
leaderObj.Type = acSplineNoArrow
leaderObj.Update
MsgBox "The leader type is " & Choose(leaderObj.Type + 1, "acLineNoArrow.", "acSplineNoArrow.", "acLineWithArrow.", "acSplineWithArrow."), , "Type Example"
' Change the leader type
leaderObj.Type = acSplineWithArrow
leaderObj.Update
MsgBox "The leader type is " & Choose(leaderObj.Type + 1, "acLineNoArrow.", "acSplineNoArrow.", "acLineWithArrow.", "acSplineWithArrow."), , "Type Example"
End Sub
可视化 LISP: (vl-load-com)
(defun c:Example_Type()
;; This example creates a leader in model space.
;; It then changes the type of the leader.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(setq modelSpace (vla-get-ModelSpace doc))
(setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
(vlax-safearray-fill points '(0 2 0
4 4 0
4 2 0
)
)
(setq leaderType acLineNoArrow)
(setq point (vlax-3d-point 4 2 0))
(setq annotationObject (vla-AddMText modelSpace point 1 ""))
;; Create the leader object in model space
(setq leaderObj (vla-AddLeader modelSpace points annotationObject leaderType))
;; Remove the temporary annotaion object and adjust the last coordinate of the leader
(vla-Erase annotationObject)
(vla-put-Coordinate leaderObj 2 (vlax-3D-point 4 2 0))
(vla-ZoomAll acadObj)
;; Find the current leader type
(setq leaderType (vla-get-Type leaderObj))
(alert (strcat "The leader type is " (cond
((= leaderType acLineNoArrow) "acLineNoArrow.")
((= leaderType acSplineNoArrow) "acSplineNoArrow.")
((= leaderType acLineWithArrow) "acLineWithArrow.")
((= leaderType acSplineWithArrow) "acSplineWithArrow.")
)))
;; Change the leader type
(vla-put-Type leaderObj acLineWithArrow)
(vla-Update leaderObj)
(setq leaderType (vla-get-Type leaderObj))
(alert (strcat "The leader type is " (cond
((= leaderType acLineNoArrow) "acLineNoArrow.")
((= leaderType acSplineNoArrow) "acSplineNoArrow.")
((= leaderType acLineWithArrow) "acLineWithArrow.")
((= leaderType acSplineWithArrow) "acSplineWithArrow.")
)))
;; Change the leader type
(vla-put-Type leaderObj acSplineNoArrow)
(vla-Update leaderObj)
(setq leaderType (vla-get-Type leaderObj))
(alert (strcat "The leader type is " (cond
((= leaderType acLineNoArrow) "acLineNoArrow.")
((= leaderType acSplineNoArrow) "acSplineNoArrow.")
((= leaderType acLineWithArrow) "acLineWithArrow.")
((= leaderType acSplineWithArrow) "acSplineWithArrow.")
)))
;; Change the leader type
(vla-put-Type leaderObj acSplineWithArrow)
(vla-Update leaderObj)
(setq leaderType (vla-get-Type leaderObj))
(alert (strcat "The leader type is " (cond
((= leaderType acLineNoArrow) "acLineNoArrow.")
((= leaderType acSplineNoArrow) "acSplineNoArrow.")
((= leaderType acLineWithArrow) "acLineWithArrow.")
((= leaderType acSplineWithArrow) "acSplineWithArrow.")
)))
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-11-3 02:25
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.