使用excel vba加载线型autocad

使用excel vba加载线型autocad,excel,autocad,vba,Excel,Autocad,Vba,我尝试使用excel VBA作为加载线类型: Call acadDoc.ModelSpace.Linetypes.Load("HIDDEN", "acad.lin") Or Set acadLineTypes = acadDoc.ModelSpace.Linetypes.Load("HIDDEN", "acad.lin") 但这是不可能的。以下内容是根据上的一个示例重新编写的 非常感谢你!我担任你的职务。太完美了!我将:acadDoc.ModelSpace.Linetypes.Load“HID

我尝试使用excel VBA作为加载线类型:

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

但这是不可能的。

以下内容是根据上的一个示例重新编写的


非常感谢你!我担任你的职务。太完美了!我将:acadDoc.ModelSpace.Linetypes.Load“HIDDEN”、“acad.lin”更改为:acadDoc.Linetypes.Load“HIDDEN”、“acad.lin”这样,一切都正常。@jeeped您有autoCAD吗?还是这只是您的一般(扩展)VBA知识?@jeeped在定义坐标的直线起点线和终点线中,#和:做什么?我猜:是一个相同的结束线或马车return@ForwardEd,我个人拥有的AutoCAD的最后一个版本是10,AutoLisp实际上引导我进入了数据库开发。AutoCAD是基于矢量的;你不会画一条线,而是在3维中给出一个起点和终点(并指定属性,如厚度、层等),因此鉴于op缺乏研究,很容易找到解决方案。
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