Results 1 to 8 of 8

Thread: Export linetype definitions

  1. #1
    All AUGI, all the time bbapties's Avatar
    Join Date
    2003-12
    Location
    Palm Harbor, FL
    Posts
    537
    Login to Give a bone
    0

    Question Export linetype definitions

    I went into an old cad file that we recieved from one of our clients and there is a linetype in it that i would like to export to my lin file for future use...

    Is this possible??

  2. #2
    Active Member treb's Avatar
    Join Date
    2002-07
    Location
    Toronto
    Posts
    75
    Login to Give a bone
    0

    Default Re: Export linetype definitions

    Use the design Center, just drag and drop the linetype you want

  3. #3
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,656
    Login to Give a bone
    0

    Default Re: Export linetype definitions

    Hi

    Give the following a try, comes from an old ACAD Guild post by Tom Beauford -

    <snip>
    There was a few bugs with my origional submission which had been written for r14. I haven't found a way to update the submission on the Exchange Page, but here is an updated one debuged for 2k2:

    Code:
     
    (defun c:lt_thf (/ OldErr ca I:Error lt el n sn n1 csc csf FILE TEXT)
      (setq OldErr *error*)
      (defun ca (num)   ;Group Code Description
    	(cdr (assoc num el))
      )
      (defun I:Error (msg)
    	(if
    	  (and
     (/= msg nil)
     (member
       (strcase msg t)
       '("console break" "function cancelled" "quit / exit abort")
     )
    	  )	 ;and
    	   (princ (strcat "\nCurrent Linetype = " lt))
    	)	 ;if
      )	 ;defun I:Error( msg )
      (setq *error* I:Error)  ; replace active errorhandler
      (setq lt (getvar "celtype"))
      (if (or (eq lt "ByLayer")
       (eq lt "ByBlock")
       (eq lt "Continuous")
    	  )
    	(exit)
      )
      (setq *error* OldErr
     I:Error nil
      )	 ; reset errorhandler to previous
      (setq el (member (cons 2 (getvar "celtype"))
    	 (entget (tblobjname
    		"ltype"
    		(getvar "celtype")
    	  )
    	 )
    	)
      )
      (princ "\n*")
      (princ (ca 2))   ;Name
      (if (< 0 (strlen (ca 3)))
    	(progn
    	  (princ ",")   ;Name,
    	  (princ (ca 3))   ;Name,Description
    	)
      )
      (princ "\n")
      (setq str "\n")
      (princ (chr (ca 72)))   ;A
      (setq n  (ca 73)   ;n=The number of linetype elements.
     el (member (assoc 49 el) el)
      )
      (repeat n	;Do once for each element.
    	(princ ",")	;A,
    	(princ (ca 49))   ;Dash, dot or space length.
    	(if (< 0 (ca 74))
    	  (progn
     (setq old_dimzin (getvar "dimzin")
    	   n1  2  ;linetype element counter 2 = 3rd element
    	   str  ""  ;blank str
    	   sn  (- (length (cdr el))
    	   (length (member (assoc 49 (cdr el)) (cdr el)))
    	   -1
    	)
     )
     (setvar "dimzin" 8)  ;Suppresses trailing zeros.
     (princ ",[")
     (repeat sn
       (cond
    	 ((= 9 (car (nth n1 el))) ;Text string
    	  (setq str (strcat "\"" (cdr (nth n1 el)) "\"," str))
    	 ;"Text"
    	 )	;(cdr (nth n1 el)) = The nth element of el
    	 ((= 75 (car (nth n1 el))) ;Complex Shape Code
    	  (setq csc (cdr (nth n1 el)))
    	 )	;(cdr (nth n1 el)) = The nth element of el
    	 ((= 340 (car (nth n1 el))) ;Compiled Shape Entity
    	  (if (= 4 (ca 74))  ;4 = embedded shape
    		(progn
       (setq
    	 csf (strcase (cdr (assoc 3 (entget (ca 340)))) T)
       )
    	 ;csf = Compiled Shape File Name in lowercase
       (if (wcmatch csf "*.shx")
    	 (setq csf (substr csf 1 (- (strlen csf) 4)))
       )
       (setq csf (strcat csf ".shp"))
    	 ;csf = Shape File Name in lowercase
       (setq FILE
       (open (findfile csf) "r") ;Open Shape File Name
       )   ;setq FILE
       (setq TEXT1 "")
       (while (/= csc TEXT1)
    	 (setq TEXT (read-line FILE))
    	 (while (not (equal "*" (substr TEXT 1 1)))
    	   (setq TEXT (read-line FILE))
    	 )
    	 (setq TEXT (substr TEXT 2))
    	 (setq TEXT1 (substr TEXT 1 1))
    	 (while (and (not (equal "," (substr TEXT 1 1)))
    		  (> (strlen TEXT) 4)
    	 )
    	   (setq TEXT (substr TEXT 2))
    	   (setq TEXT1 (strcat TEXT1 (substr TEXT 1 1)))
    	 )
    	 (setq TEXT1 (atof TEXT1))
    	 (setq TEXT (substr TEXT 2))
    	 (while (and (not (equal "," (substr TEXT 1 1)))
    		  (> (strlen TEXT) 3)
    	 )
    	   (setq TEXT (substr TEXT 2))
    	 )
    	 (setq TEXT (substr TEXT 2))
       )   ;while (/= csc TEXT1)
       (close FILE)
       (setq str (strcat TEXT
    	   ","
    	   (cdr (assoc 3 (entget (ca 340))))
    	  )
       )
    		)   ;progn
    		(setq str (strcat str (cdr (assoc 2 (entget (ca 340))))))
    	  )	;if (= 4 (ca 74))
    	 )
    	 ((= 46 (car (nth n1 el))) ;Scale
    	  (if (/= 0.0 (cdr (nth n1 el)))
    		(setq str (strcat str ",s=" (rtos (cdr (nth n1 el)))))
    	  )
    	 )
    	 ((= 50 (car (nth n1 el))) ;Rotation
    	  (if (/= 0.0 (cdr (nth n1 el)))
    		(setq
       str (strcat str
    		",r="
    		(rtos (/ (* 180 (cdr (nth n1 el))) pi))
    	   )
    		)
    	  )
    	 )
    	 ((= 44 (car (nth n1 el))) ;X offset
    	  (if (/= 0.0 (cdr (nth n1 el)))
    		(setq str (strcat str ",x=" (rtos (cdr (nth n1 el)))))
    	  )
    	 )
    	 ((= 45 (car (nth n1 el))) ;Y offset
    	  (if (/= 0.0 (cdr (nth n1 el)))
    		(setq str (strcat str ",y=" (rtos (cdr (nth n1 el)))))
    	  )
    	 )
       )	;cond
       (setq n1 (+ 1 n1))  ;linetype element counter -> next
     )	;repeat sn
     (princ str)
     (princ "]")
    	  )	 ;progn
    	)	 ;if (< 0 (ca 74))
    	(setq el (cdr el))
    	(setq el (member (assoc 49 el) el))
      )	 ;repeat n
      (if (= old_dimzin nil)
    	(setvar "dimzin" 0)
    	(setvar "dimzin" old_dimzin)
      )
      (princ)
    )
    </snip>

    Have a good one, Mike

  4. #4
    AUGI Addict
    Join Date
    2015-12
    Location
    Arizona
    Posts
    2,478
    Login to Give a bone
    0

    Default Re: Export linetype definitions

    I think you could etrnasmit that file to your self and the LIN file should be included.
    Verify by looking at the Files tab during the etransmit operation.

  5. #5
    All AUGI, all the time bbapties's Avatar
    Join Date
    2003-12
    Location
    Palm Harbor, FL
    Posts
    537
    Login to Give a bone
    0

    Default Re: Export linetype definitions

    thanks mj, I didnt think of that

  6. #6
    Certified AUGI Addict cadtag's Avatar
    Join Date
    2000-12
    Location
    Cairo - no, not Illinois
    Posts
    5,069
    Login to Give a bone
    0

    Default Re: Export linetype definitions

    If the linetype is already loaded in the drawing, I don't believe the .lin file is needed anymore. I've been using Design Center to grab them as I needed, but the lisp to export the definiton to a text format looks useful. (now if there was only a trick to get the shapes for a linetype when the orginator didn't use etransmit or otherwise won't send the shp file along. it would be nice if Acad would store the definition in the dwg)

  7. #7
    Mod / Salary / SM Wanderer's Avatar
    Join Date
    2001-12
    Location
    St. Louis
    Posts
    5,408
    Login to Give a bone
    0

    Red face Re: Export linetype definitions

    I agree that it would be nice...

    but, that would depend on the contents of the shp being used. Like, it is part of a linetype definition? or is it text? or is it a 20mb background... map... thingy...

    Quote Originally Posted by cadtag
    If the linetype is already loaded in the drawing, I don't believe the .lin file is needed anymore. I've been using Design Center to grab them as I needed, but the lisp to export the definiton to a text format looks useful. (now if there was only a trick to get the shapes for a linetype when the orginator didn't use etransmit or otherwise won't send the shp file along. it would be nice if Acad would store the definition in the dwg)
    Melanie Stone
    @MistresDorkness

    Archibus, FMS/FMInteract and AutoCAD Expert (I use BricsCAD, Revit, Tandem, and Planon, too)
    Technical Editor
    not all those who wander are lost

  8. #8
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Export linetype definitions

    Quote Originally Posted by bbapties
    I went into an old cad file that we recieved from one of our clients and there is a linetype in it that i would like to export to my lin file for future use...

    Is this possible??
    See also:

    TO-LIN.LSP and NEW-LIN.LSP at http://www.turvill.com/t2/free_stuff/index.htm
    R.K. McSwain | CAD Panacea |

Similar Threads

  1. Replies: 5
    Last Post: 2013-06-25, 12:40 AM
  2. IES web file definitions
    By angus.110169 in forum Revit Architecture - General
    Replies: 6
    Last Post: 2008-12-03, 05:13 AM
  3. I'm trying to create a linetype that has 8" in the linetype
    By mikeprentiss in forum AutoCAD Customization
    Replies: 11
    Last Post: 2006-08-17, 12:11 PM
  4. Extract Linetype information from a custom Linetype
    By H.Hunter in forum AutoCAD Customization
    Replies: 3
    Last Post: 2006-08-15, 05:27 AM
  5. Arrowhead definitions
    By jwilhelm in forum Revit Architecture - General
    Replies: 5
    Last Post: 2005-12-19, 03:41 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
  •