CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

线型特性 (ActiveX)

2023-1-3 12:00| 发布者: admin| 查看: 702| 评论: 0|来自: AutoCAD

摘要: 指定对象的线型。

指定对象的线型。

支持的平台:仅窗口

签名

工 务 局:

object.Linetype
对象

类型:所有图形对象属性引用图层子DMeshEdge,SubDMeshFace,SubDMeshVertexSubEntity,SubEntSolidEdge,SubEntSolidFaceSubEntSolidNode,SubEntSolidVertex

此属性适用的对象。

属性值

只读:不;只写对象除外Group

类型:字符串

对象的线型。默认线型为图层的线型 (ByLayer)。

  • Continuous:默认线型,在线型符号表中自动创建。
  • ByLayer:对象图层的线型值。
  • ByBlock:对象周围块定义的当前块参照的线型值。

言论

线型值标识用于绘制线条的一系列点和虚线。如果未指定线型,则当前活动线型将用于新图元。如果为图元指定了线型,则忽略当前活动线型。使用该属性可以设置或查询当前活动线型。ActiveLinetype

注意:无法以编程方式创建线型。可以使用 Load 方法将现有线型添加到图形中,方法是使用 Load 方法先加载线型,然后使用 Add 方法将其添加到集合中。Linetypes

例子

工 务 局:

Sub Example_Linetype()
    ' This example searches for the linetype DashDot. If it is
    ' not found, it is added from the acad.lin file. Then a
    ' line is created and changed to the DashDot linetype.
    
    ' Search the linetypes collection for the DashDot linetype.
    Dim entry As AcadLineType
    Dim found As Boolean
    found = False
    For Each entry In ThisDrawing.Linetypes
        If StrComp(entry.name, "DASHDOT", 1) = 0 Then
            found = True
            Exit For
        End If
    Next
    If Not (found) Then ThisDrawing.Linetypes.Load "DASHDOT", "acad.lin"
        
    ' Create the line
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 1#: startPoint(1) = 1#: startPoint(2) = 0#
    endPoint(0) = 4#: endPoint(1) = 4#: endPoint(2) = 0#
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    
    ' Change the linetype of the line
    lineObj.Linetype = "DASHDOT"
    ZoomAll
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Linetype()
    ;; This example searches for the linetype DashDot. If it is
    ;; not found, it is added from the acad.lin file. Then a
    ;; line is created and changed to the DashDot linetype.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Search the linetypes collection for the DashDot linetype.
    (setq found :vlax-false)
    (vlax-for entry (vla-get-Linetypes doc)
        (if (= (vla-get-Name entry) "DASHDOT")
            (setq found :vlax-true)
        )
    )
  
    (if (= found :vlax-false)
        (vla-Load (vla-get-Linetypes doc) "DASHDOT" "acad.lin")
    )
        
    ;; Create the line
    (setq startPoint (vlax-3d-point 1 1 0)
          endPoint (vlax-3d-point 4 4 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    
    ;; Change the linetype of the line
    (vla-put-Linetype lineObj "DASHDOT")
    (vla-ZoomAll acadObj)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-11 19:24

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部