TheSwamp
Code Red => VB(A) => Topic started by: Bryco on August 13, 2007, 06:58:49 PM
-
We have some metric drawings that have been created with the acad.lin linetypes, anyone know how to change this with vba?
I get a "Duplicate record name" error with
ThisDrawing.Linetypes.Load "HIDDEN", "acadiso.lin"
-
We have some metric drawings that have been created with the acad.lin linetypes, anyone know how to change this with vba?
I get a "Duplicate record name" error with
ThisDrawing.Linetypes.Load "HIDDEN", "acadiso.lin"
You need to check if the linetype is not already loaded...
what I have done in some of my c# functions is:
LinetypeTable tbl = tr.GetObject(db.LinetypeTableId, OpenMode.ForRead, false) as LinetypeTable;
if (!tbl.Has(linetypeName))
db.LoadLineTypeFile(linetypeName, "acad.lin");
I know this a vba question.... :ugly:
-
Luis I'm trying to reload every linetype and it will be loaded.
Cad gives this reload option (Linetype Yada is already loaded, would you like to reload it?)
but I don't see a reload option in vba
-
I cant even figure out how to send command it, as after "-linetype l hidden " a box comes up.
-
"-linetype l " & sName & vbCr & vbCr & "y " seems to work with an esc or 2.
i forgot to set filedia first (Haven't used sendcommand for a while)
Luis I thought you posted some C#, if I remember it I'll give it a try.
-
what version of autocad? I turned off filedia, and it loaded w/o asking me to overwrite, it just did it
-
"-linetype l " & sName & vbCr & vbCr & "y " seems to work with an esc or 2.
i forgot to set filedia first (Haven't used sendcommand for a while)
Luis I thought you posted some C#, if I remember it I'll give it a try.
I remove that code, because was not right....
-
Set
Thisdrawing.setvariable "EXPERT", 3
before
Hth
~'J'~
-
what version of autocad? I turned off filedia, and it loaded w/o asking me to overwrite, it just did it
I'm using 2008,2007,2006,2004.
The asking to overwrite happens to me when there is an existing linetype of the same name.
Thisdrawing.setvariable "EXPERT", 3
That would explain it, indeed.
Luis I wouldn't know where to start with both vba and c#, it's like you have to purge it then bring in the new one, lots of trouble.
I don't think that many drafter's in the U.S. know the difference between acadiso.lin and acad.lin so I'm not too upset about it, I wonder if it is mentioned in a typical cad standards contract.
In case this happens to someone else, the following (in conjunction w/ a folder function) seems to work.
Sub ChangeLinetypes()
Dim L As AcadLineType
Dim Ls As AcadLineTypes
Dim sName As String
Dim sPath As String
Dim sCommand As String
ThisDrawing.SetVariable "filedia", 0
ThisDrawing.SetVariable "celtscale", 1
ThisDrawing.SetVariable "PSLTSCALE", 1
ThisDrawing.SendCommand "insunits 4 "
sPath = "C:\Documents and Settings\Your handle\Application Data\Autodesk\AutoCAD Mechanical 2008\R17.1\enu\Support\acadiso.lin"
sCommand = "-linetype l "
Set Ls = ThisDrawing.Linetypes
For Each L In Ls
sName = L.Name
If InStr(1, sName, "|", vbTextCompare) <> 0 Then GoTo skip
Select Case sName
Case "ByBlock", "ByLayer", "Continuous"
GoTo skip
End Select
sCommand = "-linetype l " & sName & vbCr & vbCr & "y "
ThisDrawing.SendCommand sCommand
esc
esc
esc
skip:
Next
esc
esc
ThisDrawing.SetVariable "filedia", 1
End Sub
-
Hi Bryco
Just one question, as far as I know
acadiso.lin they use in metric units only
Maybe I am wrong though
~'J'~
-
Yes, a bloke made a template for a metric drawing set using regular linetypes not the iso metric linetypes so now users are manually setting linetypes for xrefs lines
changing paperspace lts settings, chaos
-
Thank you again, Bryco
That's make a sence
:loco:
~'J'~