Загрузка строки типа AutoCAD с помощью Excel VBA - PullRequest
0 голосов
/ 28 июня 2018

Я пытаюсь загрузить тип линии, используя Excel VBA как:

Call acadDoc.ModelSpace.Linetypes.Load("HIDDEN", "acad.lin")
Or
Set acadLineTypes = acadDoc.ModelSpace.Linetypes.Load("HIDDEN", "acad.lin")

но невозможно.

1 Ответ

0 голосов
/ 28 июня 2018

Следующее было переработано из примера на Свойство Linetype (ActiveX) .

Sub Example_Linetype()
    ' This example searches for the linetype Hidden. If it is
    ' not found, it is added from the acad.lin file. Then a
    ' line is created and changed to the Hidden linetype.

    ' Search the linetypes collection for the Hidden linetype.
    Dim entry As AcadLineType
    Dim found As Boolean
    found = False
    For Each entry In acadDoc.Linetypes
        If StrComp(entry.name, "HIDDEN", 1) = 0 Then
            found = True
            Exit For
        End If
    Next
    If Not (found) Then acadDoc.Linetypes.Load "HIDDEN", "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 = acadDoc.ModelSpace.AddLine(startPoint, endPoint)

    ' Change the linetype of the line
    lineObj.Linetype = "HIDDEN"
    ZoomAll

End Sub
...