Author Topic: How to change hidden acad.lin to hidden acadiso.lin  (Read 6524 times)

0 Members and 1 Guest are viewing this topic.

Bryco

  • Water Moccasin
  • Posts: 1882
How to change hidden acad.lin to hidden acadiso.lin
« 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"
 
« Last Edit: August 13, 2007, 06:59:56 PM by Bryco »

LE

  • Guest
Re: How to change hidden acad.lin to hidden acadiso.lin
« Reply #1 on: August 13, 2007, 07:07:26 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"
 

You need to check if the linetype is not already loaded...

what I have done in some of my c# functions is:

Code: [Select]
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:

Bryco

  • Water Moccasin
  • Posts: 1882
Re: How to change hidden acad.lin to hidden acadiso.lin
« Reply #2 on: August 13, 2007, 07:44:08 PM »
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

Bryco

  • Water Moccasin
  • Posts: 1882
Re: How to change hidden acad.lin to hidden acadiso.lin
« Reply #3 on: August 13, 2007, 07:46:23 PM »
I cant even figure out how to send command it, as after "-linetype l hidden  "  a box comes up.

Bryco

  • Water Moccasin
  • Posts: 1882
Re: How to change hidden acad.lin to hidden acadiso.lin
« Reply #4 on: August 14, 2007, 10:07:26 AM »
"-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.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: How to change hidden acad.lin to hidden acadiso.lin
« Reply #5 on: August 14, 2007, 10:13:08 AM »
what version of autocad?  I turned off filedia, and it loaded w/o asking me to overwrite, it just did it
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

LE

  • Guest
Re: How to change hidden acad.lin to hidden acadiso.lin
« Reply #6 on: August 14, 2007, 10:14:01 AM »
"-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....

Fatty

  • Guest
Re: How to change hidden acad.lin to hidden acadiso.lin
« Reply #7 on: August 14, 2007, 02:25:52 PM »
Set
Code: [Select]
Thisdrawing.setvariable "EXPERT", 3before
Hth

~'J'~

Bryco

  • Water Moccasin
  • Posts: 1882
Re: How to change hidden acad.lin to hidden acadiso.lin
« Reply #8 on: August 14, 2007, 04:21:22 PM »
Quote
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.
Code: [Select]
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.
Code: [Select]
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

Fatty

  • Guest
Re: How to change hidden acad.lin to hidden acadiso.lin
« Reply #9 on: August 15, 2007, 10:36:54 AM »
Hi Bryco
Just one question, as far as I know
acadiso.lin they use in metric units only
Maybe I am wrong though

~'J'~

Bryco

  • Water Moccasin
  • Posts: 1882
Re: How to change hidden acad.lin to hidden acadiso.lin
« Reply #10 on: August 15, 2007, 11:24:23 AM »
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

Fatty

  • Guest
Re: How to change hidden acad.lin to hidden acadiso.lin
« Reply #11 on: August 15, 2007, 12:25:31 PM »
Thank you again, Bryco
That's make a sence
 :loco:
~'J'~