Jump to content

Loading all linetype in a file


BIGAL

Recommended Posts

I have the problem that I am trying to load all linetypes in a .LIN file some of the linetypes already exist so the load stops and asks Y or N how can I answer yes to all in VBA without stopping ?

 

ThisDrawing.SendCommand "-linetype" & vbCr & "l" & vbCr & "*" & vbCr & "s:\Autodesk\supportfiles\custom.lin" & vbCr & vbCr

Link to comment
Share on other sites

What for to use SendCommand if there is standard method Load for linetypes loading and you can and you can check up presence of any linetype in Linetypes collection? In any case SendCommand the worst solution which can be used if no other way is present.

Link to comment
Share on other sites

Thanks Tommyg

 

Right track tried

 

FileName = "s:\autodesk\supportfiles\custom.lin"

ThisDrawing.Linetypes.Load "*", FileName

 

Didn't work, I want to load all the linetypes in one go I dont get any errors so not sure what to do next.

Link to comment
Share on other sites

from reading the help, you wont be able to do it.

 

this might be of interest, taken from the help file

 

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

Link to comment
Share on other sites

Thnaks Tommyg I will just add all the specific linetypes that I know I will need which are non standard Autocad that will make it work for me. It wont take long to write the same line multiple times at least then it will work.

Link to comment
Share on other sites

no worries. I just have the linetypes load in a separate module, so each time i create a macro, and need a linetype loaded, i do a "Call" on that module

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...