Specifies the linetype of an object.
Supported platforms: Windows only
Signature
VBA:
object.Linetype
- object
-
Type: All drawing objects, AttributeReference, Group, Layer, SubDMeshEdge, SubDMeshFace, SubDMeshVertex, SubEntity, SubEntSolidEdge, SubEntSolidFace, SubEntSolidNode, SubEntSolidVertex
The objects this property applies to.
Property Value
Read-only: No (except for Group objects)
Type: String
The linetype of an object. The default linetype is the linetype of the layer (ByLayer).
- Continuous: The default linetype, which is automatically created in the linetype symbol table.
- ByLayer: The linetype value of the object's layer.
- ByBlock: The linetype value of the object's surrounding block definition's current block reference.
Remarks
The linetype values identify the series of dots and dashes used for drawing lines. If you do not specify a linetype, the current active linetype is used for a new entity. If a linetype is specified for an entity, the current active linetype is ignored. Use the ActiveLinetype property to set or query the current active linetype.
Examples
VBA:
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) 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) (if (/= (strcase (getvar "PROGRAM") T) "acadlt") (vla-Load (vla-get-Linetypes doc) "DASHDOT" "acad.lin") (vla-Load (vla-get-Linetypes doc) "DASHDOT" "acadlt.lin") ) ) ;; Create the line (setq startPoint (vlax-3d-point 1 1 0) endPoint (vlax-3d-point 4 4 0) modelSpace (vla-get-ModelSpace doc) lineObj (vla-AddLine modelSpace startPoint endPoint)) ;; Change the linetype of the line (vla-put-Linetype lineObj "DASHDOT") (vla-ZoomAll acadObj) )