Export linetype definition

Export linetype definition

doni49
Mentor Mentor
645 Views
10 Replies
Message 1 of 11

Export linetype definition

doni49
Mentor
Mentor

I wrote a lisp routine that exports a linetype definition.  But all it's able to handle is SIMPLE LINETYPES.  I want to add the ability to export complex linetypes.  But I don't see the symbol definition anywhere in the ltype table.

 

((0 . "LTYPE") (2 . "SAN LINE") (70 . 0) (3 . "SANITARY line ----SAN----SAN----SAN----SAN----S") (72 . 65) (73 . 3) (40 . 0.9) (49 . 0.5) (49 . -0.2) (49 . -0.2))

doni49_0-1747757497307.png

 

;
;  Purpose:  Export Linetype Definition
;
;  Author:  Don Ireland
;
;  Version:  1.0 - Currently only exports simple linetypes.
;
(defun c:LTExport(/ dimzin file lt ltname n def)
  (setq dimzin(getvar "dimzin"))
  (defun *error* ()
    (setvar "dimzin" dimzin)
    (if f(close f))
    (setq *error* nil)
  )
  (setvar "dimzin" 12)
  (setq ltname (getstring "Enter Linetype Name:  "))
  (setq lt(tblsearch "ltype" ltname) n 6 def "A" )
  (repeat (cdr(assoc 73 lt))
    (setq def(strcat def "," (rtos (cdr(nth (setq n (1+ n)) lt)) 2 )))
  )
  (if (not file)(setq file 
    (getfiled 
      "Create Linetype File" ; <----------------------------Title of the file selection dialog 
      (strcat (getvar "dwgprefix") (cdr (assoc 2 lt))) ;  <-Default file to create
      "lin" ;  <--------------------------------------------Extension
      1 ; <-------------------------------------------------Tell AutoCAD to generate a new file
    )
  ))
  (setq f (open file "w"))
  (write-line 
    (strcat "*" (cdr (assoc 2 lt)) "," (cdr (assoc 2 lt)));String to write
    f
  )
  (write-line 
    def ;String to write
    f
  )
  (close f)
  (setvar "dimzin" dimzin)
  (setq *error* nil)
)


Don Ireland
Engineering Design Technician




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

0 Likes
646 Views
10 Replies
Replies (10)
Message 2 of 11

paullimapa
Mentor
Mentor
Message 3 of 11

doni49
Mentor
Mentor

I actually tried that before posting.  It just throws error messages.  A screenshot of the errors is attached.

 

 



Don Ireland
Engineering Design Technician




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

0 Likes
Message 4 of 11

paullimapa
Mentor
Mentor

could you share a sample dwg with the complex linetype you're trying to generate the definition?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 11

paullimapa
Mentor
Mentor

have you tried new-lin.lsp:

PC: NEW-LIN lisp


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 6 of 11

vladimir_michl
Advisor
Advisor

This is a quite old version - please use the latest LINout from https://www.cadforum.cz/en/qaID.asp?tip=3958

The .LIN file is created in the same folder as your DWG so make sure it is not opened from a CD-ROM, a web site or anything like that.

 

Vladimir Michl, www.arkance.world  -  www.cadforum.cz

 

0 Likes
Message 7 of 11

doni49
Mentor
Mentor

Thanks guys.

 

  1. I just tried linout again -- this time using a file that started out completely blank with a line drawn using the linetype I was after.  It worked without error this time.  I guess I could always copy a line out to a blank file and THEN extract the linetype.
  2. As far as posting a copy of the file I was using when I got the error message, I'm not sure now what file I was using.
  3. I've never seen the "new-lin" lisp routine linked above.  So I've never tried it.
  4. I'll try the new version that @vladimir_michl linked above.


Don Ireland
Engineering Design Technician




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

0 Likes
Message 8 of 11

paullimapa
Mentor
Mentor

You may want to try the "new-lin" lisp since that’s open source code.  If it works then you can compare the code with yours and see what’s missing 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 9 of 11

komondormrex
Mentor
Mentor

hey,

try this demo to feed back to me is there is problems with linetypes. to see a linetype definition double click on a linetype name or its description. this is archived compiled custom lisp command. the command name is export_linetypes.

 

0 Likes
Message 10 of 11

john.uhden
Mentor
Mentor

@doni49 ,

See if this helps you out...

(Please ignore the testing code.  Even delete it.)

John F. Uhden

0 Likes
Message 11 of 11

Sea-Haven
Mentor
Mentor

@john.uhden just a little help for Bricscad the default lin is just that "Default.lin" you can check product name pretty easy. Then look for correct xxx.lin

 

(vlax-product-key)
"Software\\Bricsys\\BricsCAD\\V25x64\\en_US"

 So code should work in both software, not sure about others like Intellicad & Zwcad. 

0 Likes