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.
|
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.
Document->Linetypes [ collection ].Load( LinetypeName, LinetypeFile )
I believe it is this way. If not, just switch the arguments to the Load method.
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
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))
)
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.
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.
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.
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
Thanks.Code:(defun c:NonStdLT () (setvar "Expert" 3) (command "._linetype" "_load" "*" "Customized.lin" "") (setvar "Expert" 0) ) ;end of NonStdLT