BIGAL Posted January 6, 2009 Share Posted January 6, 2009 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 Quote Link to comment Share on other sites More sharing options...
ASMI Posted January 7, 2009 Share Posted January 7, 2009 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. Quote Link to comment Share on other sites More sharing options...
TommyG Posted January 7, 2009 Share Posted January 7, 2009 ThisDrawing.Linetypes.Load "Linestyle", filename Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 8, 2009 Author Share Posted January 8, 2009 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. Quote Link to comment Share on other sites More sharing options...
TommyG Posted January 8, 2009 Share Posted January 8, 2009 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 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 11, 2009 Author Share Posted January 11, 2009 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. Quote Link to comment Share on other sites More sharing options...
TommyG Posted January 11, 2009 Share Posted January 11, 2009 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.