Message 1 of 11
Export linetype definition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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))
;
; 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.