Tuesday, April 28, 2009

Export Linetypes

Cadalyst sent me a tips and tricks email with the promise of a link to a lisp file written by Douglas Lerner to export linetypes from a drawing to a LIN file. But, there seems to be a bit of a broken link. I searched their site and came up with a lisp written in 1995 by Greg Oliver. Find it here, or copy paste from below.


; TIP1076.LSP: LLTYPES.LSP Extract Linetypes (c)1995, Greg Oliver

(defun dxf (CODE ELIST)
(cdr (assoc CODE ELIST))
)

(defun C:LLTYPES (/ LT WISH LTL LTS LTSM NDLI N LTN LTDES LTDEF DL STR LTFW LTFR FLAG)
(setq LT (tblnext "LTYPE" T)) ;first ltype
(initget 1 "Yes No") ;Establish keywords, no null
(setq WISH (getkword "\nWrite Linetype definitions to a file (Y/N) ? "))
(if (= WISH "Yes")
(progn
(setq LTFW (open "ltypes.lin" "a")) ;linetype file (for writing)
)
)
(while LT
(setq N 0
LTN (dxf 2 LT) ;ltype name
LTDES (dxf 3 LT) ;ltype description
NDLI (dxf 73 LT) ;number of dashed items
)
(if (> NDLI 0)
(progn
(setq ltl (member (assoc 49 lt) lt) ;list of "49" groups - dashed items
LTS (strcat "*" ltn ",") ;linetype string - eg. "*DASHED,"
LTSM (strcat "`*" ltn "`,*") ;string used in "wcmatch" - special chars. escaped
LTDEF (strcat "A") ;linetype definition + alignment code
DL 0
)
(while (setq DL (cdr (nth N LTL)))
(setq LTDEF (strcat LTDEF "," (rtos DL))
N (1+ N)
)
)
(if (= WISH "Yes")
(progn
(setq FLAG "write")
(setq LTFR (open "ltypes.lin" "r")) ;linetype file (for reading)
(while (/= (setq STR (read-line LTFR)) nil)
(if (wcmatch STR LTSM) ;check if linetype is already defined in file
(progn
(princ (strcat "\nLinetype " ltn " is already defined in ltypes.lin"))
(setq FLAG "nowrite")
)
)
)
(close LTFR)
(if (= FLAG "write") ;write linetype information to a file ?
(progn
(princ (strcat "\nWriting " ltn " definition to ltypes.lin"))
(princ (strcat LTS LTDES "\n") LTFW) ;linetype name & description
(princ (strcat LTDEF "\n") LTFW) ;definition
)
)
)
(progn
(princ (strcat LTS LTDES "\n"))
(princ (strcat LTDEF "\n"))
)
)
)
)
(setq LT (tblnext "LTYPE"))
)
(if LTFW (close LTFW)) ;if linetype file was opened, close it.
(princ)
)
(c:lltypes); end lltypes.lsp
__________________

Tuesday, April 21, 2009

Guillermo Melantoni's Blog - What a Mesh

What took me so long to read Guillermo Melantoni's Blog What a Mesh

I just posted on entering AutoCAD Exchange's Benign Design 3D contest. What better way to tip the scales in your favor than to reap the rich 3D knowledge of Guillermo Melantoni? 

Another interesting fact about Guillermo, He plays spoons for a metal band that only does heavy covers of country songs. Wait, I made that up. He plays bass. Here is a cool picture of him rockin' out from his blog.Not to be out done here is a picture of me today, rocking out almost as hard.
And here is a picture of me inventing rocking out before the Internet, and color photos.

Friday, April 10, 2009

Benign Design Contest


Check out this video with contest details. This is just plain funny. Bravo Autodesk.

If you have any 3D skills at all, enter this contest. One prize is a trip to San Francisco. I have been to Autodesk's offices there and it is well worth your time if you win. I bet they throw in a hat or some other swag, and the people there are very, very good-awesome-ie.

Yeah, I said good-awesome-ie.

Friday, April 03, 2009

Embedding Image Files

I have a government client that demands that all X-References are bound. They recently expanded this to include attached image files. I just told them you can't bind an attached image file, when a smart-pants engineer in my office suggested that we just paste images in these files as OLE objects. They go static when they loose their reference but remain in the CAD file with nothing showing in the X-Reference manager to bug picky clients.

To paste as an OLE object, copy your image to the Windows clipboard then select "Paste Special" and select the OLE option.

Sweet.