See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: How to Load a Linetype file?

  1. #1
    AUGI Addict
    Join Date
    2006-04
    Location
    (getpoint "Anywhere on the Enter Key =>")
    Posts
    1,160
    Login to Give a bone
    0

    Default How to Load a Linetype file?

    Hey ALL,

    By modifying client's drawings, I need to load a metric linetype file (acadiso.lin).
    How to do this in Lisp?

    Thanks in advance.

  2. #2
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: How to Load a Linetype file?

    Document->Linetypes [ collection ].Load( LinetypeName, LinetypeFile )

    I believe it is this way. If not, just switch the arguments to the Load method.

  3. #3
    AUGI Addict
    Join Date
    2006-04
    Location
    (getpoint "Anywhere on the Enter Key =>")
    Posts
    1,160
    Login to Give a bone
    0

    Default Re: How to Load a Linetype file?

    Quote Originally Posted by T.Willey View Post
    Document->Linetypes [ collection ].Load( LinetypeName, LinetypeFile )

    I believe it is this way. If not, just switch the arguments to the Load method.
    Sorry, I don't understand.

    I want to load all linetypes in the acadiso.lin to the drawing.
    In the LISP function code, I know "open" but it doesn't mean loading any files to the drawing.

    Thanks

  4. #4
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: How to Load a Linetype file?

    What T.Willey meant was to use the ActiveX methods (vlax-....). He just gave you the "pseudo code". Basically:
    Code:
    (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) ;Get the current drawing's object reference
    (setq ltypes (vla-get-LineTypes doc)) ;Get the LineTypes collection object reference
    (vla-Load ltypes "*" "ACADISO.LIN") ;Load all linetypes from the file into this collection

  5. #5
    100 Club CADmium's Avatar
    Join Date
    2004-08
    Location
    Eberswalde, Germany, Europe
    Posts
    128
    Login to Give a bone
    0

    Default Re: How to Load a Linetype file?

    or Try this with command:

    (defun c:LOADLINETYPES( / LOADLT_INTERN)
    (vl-load-com)
    (defun LOADLT_INTERN()
    (progn
    (command "_-linetype" "_load" "*" "acadiso.lin")
    (while (/=(getvar "CMDACTIVE")0) (command "_y"))
    )
    )
    (vl-catch-all-apply
    'LOADLT_INTERN
    )
    (while (/=(getvar "CMDACTIVE")0) (command))
    )

  6. #6
    AUGI Addict
    Join Date
    2006-04
    Location
    (getpoint "Anywhere on the Enter Key =>")
    Posts
    1,160
    Login to Give a bone
    0

    Default Re: How to Load a Linetype file?

    Quote Originally Posted by irneb View Post
    What T.Willey meant was to use the ActiveX methods (vlax-....). He just gave you the "pseudo code". Basically:
    Code:
    (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) ;Get the current drawing's object reference
    (setq ltypes (vla-get-LineTypes doc)) ;Get the LineTypes collection object reference
    (vla-Load ltypes "*" "ACADISO.LIN") ;Load all linetypes from the file into this collection
    with thanks to all.

  7. #7
    AUGI Addict
    Join Date
    2006-04
    Location
    (getpoint "Anywhere on the Enter Key =>")
    Posts
    1,160
    Login to Give a bone
    0

    Default Re: How to Load a Linetype file?

    Quote Originally Posted by T.Willey View Post
    Document->Linetypes [ collection ].Load( LinetypeName, LinetypeFile )

    I believe it is this way. If not, just switch the arguments to the Load method.
    From a previous thread, I found another way to get the answer:
    That is expert
    1) (setvar "expert" 3)
    2) then load the specified linetype file
    3) reset expert: (setvar "expert" 0)

    The problems are
    (A) In step 3) above it gives a following result in the command line:
    ...
    Enter an option [?/Create/Load/Set]:
    Command: 0
    (B) I also noticed that the code doesn't load the my customized linetype named as "AIR LINE".
    I can load "AIR LINE" by opening linetype manager dialog box without any problem.
    I attached the acadiso.lin below.

    Any helps would be appreciated.
    Attached Files Attached Files

  8. #8
    All AUGI, all the time CAB2k's Avatar
    Join Date
    2016-01
    Location
    Brandon, Florida
    Posts
    687
    Login to Give a bone
    0

    Default Re: How to Load a Linetype file?

    I believe you need a CR/LF as the last character in the file.

    Put your cursor at the end of the file & hit ENTER a time or two.
    Then save.

  9. #9
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: How to Load a Linetype file?

    That's probably it. I know the CR/LF is needed in SHP files, so it might work the same for LIN.

    BTW, I'd be very careful adding custom types to the standard ACAD / ACADISO.LIN files. You never know when an update / service pack might overwrite these - loosing your customizations. From several of the threads here the suggested preference would be to create your own files (not just LIN but any custom stuff) and place them in a folder you create for this purpose. It's the only way of ensuring that any type of update won't destroy your customizations. It's also easier copying one folder to another machine than having to edit & copy-n-paste lines between several files.

  10. #10
    AUGI Addict
    Join Date
    2006-04
    Location
    (getpoint "Anywhere on the Enter Key =>")
    Posts
    1,160
    Login to Give a bone
    0

    Default Re: How to Load a Linetype file?

    Quote Originally Posted by CAB2k View Post
    I believe you need a CR/LF as the last character in the file.

    Put your cursor at the end of the file & hit ENTER a time or two.
    Then save.
    Thanks, CAB2k.
    You've done again.

    Yes, After CR/LF added to the end of the linetype file, the code loads all customized linetypes!

    But more questions...

    (1) Can CR/LF be found in HELP?

    (2) After loading the code, I still get the following in the command line:

    ...
    Enter an option [?/Create/Load/Set]:
    Command: 0


    Code:
    (defun c:NonStdLT ()
    (setvar "Expert" 3)
    (command "._linetype" "_load" "*" "Customized.lin" "")
    (setvar "Expert" 0)
    ) ;end of NonStdLT
    Thanks.

Page 1 of 2 12 LastLast

Similar Threads

  1. Exporting to CAD from Revit (Preset .txt file to load? ctb file?)
    By goodtastingsteak in forum Revit - Plotting/Printing/Exporting
    Replies: 2
    Last Post: 2015-03-13, 05:34 PM
  2. Load Linetype from Property Dialog Box
    By Wish List System in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2012-07-06, 01:33 PM
  3. Load a custom linetype with correct font
    By martydavis in forum AutoCAD General
    Replies: 13
    Last Post: 2006-02-06, 10:10 AM
  4. Load Linetype / Acad.lsp
    By robert.1.hall72202 in forum AutoCAD Customization
    Replies: 11
    Last Post: 2005-02-22, 09:24 PM
  5. Replies: 2
    Last Post: 2004-12-04, 02:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •