PDA

View Full Version : Load Linetypes in LISP


dbanker
2008-03-17, 09:25 PM
I am trying to load certain linetypes through an existing LISP routine. I would like it to function similar to the 3 (adimst, alayst, and ats) routines already existing in this routine attached.

Thanks!

irneb
2008-03-18, 07:16 AM
Use the linetype command, just remember to include the minus prefix to not have the dialog box pop-up. E.g.(command "-linetype" "_Load" "Dashed" "acad.lin" "")Although this varies if the linetype is already loaded in the drawing, so you'll have to check for each linetype and vary the command sequence accordingly:
(setq linelist '(("Dashed" . "acad.lin")
("Hidden" . "acad.lin")
("Special" . "Special.lin")))
(foreach lin linelist
(if (tblsearch "LTYPE" (car lin))
(command ".-linetype" "_Load" (car lin) (cdr lin) "_Yes" "")
(command ".-linetype" "_Load" (car lin) (cdr lin) "")
)
)

dbanker
2008-03-18, 05:52 PM
I did try the first example. And then I ran into your second example. The second example will work if the linetypes are already loaded?

irneb
2008-03-19, 05:19 AM
Sorry for not answering yesterday, our wonderful gov has decided to turn the power off.I did try the first example. And then I ran into your second example. The second example will work if the linetypes are already loaded?Yes, that's the idea. It 1st checks if the linetype is already existing in the drawing, if so it adds the Yes answer to the prompt about overriding, otherwise it just closes the linetype command.

BTW, you'd simply add your required linetypes to the linelist at the start of this code. I've included a 2d portion to each list item stating the file from which the linetype should be loaded. This is most probably acad.lin (or acadiso.lin for Metric) unless you've got some custom linetypes in another file.

Zuke
2008-10-28, 06:18 AM
Any chance of looking at the final outcome of this LISP.

Im interested in how to add it to a routine...