Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Creating & Cleaning Up DXF's

2 REPLIES 2
Reply
Message 1 of 3
KeithFiebig
252 Views, 2 Replies

Creating & Cleaning Up DXF's

Does anybody have a Lisp or Script that they would be willing to share for the following.

 

 

Move all objects from the farest most lower left corner to 0,0

 

Move all objects to Layer 0 color by layer linetype by layer

 

 

Create LAYER  ETCH

 

Insert Text  Line of the FILENAME  at 0,0 on a Layer ETCH

 

zoom to extents

 

Save as DXF

 

2 REPLIES 2
Message 2 of 3
m.deleurere
in reply to: KeithFiebig

Move all objects from the farest most lower left corner to 0,0:

 

(SETQ A (SSGET "X"))

(SETQ B (GETVAR "EXTMIN"))

 

(COMMAND "MOVE" A "" B "0,0")

 

Move all objects to Layer 0 color by layer linetype by layer:

 

(COMMAND "CHPROP" A "" "LAYER" "0" "C" "BYLAYER" "LT" "BYLAYER" "")

 

Create LAYER  ETCH:

 

(COMMAND "-LAYER" "MAKE" "ETCH" "")  you may want to add color, linetype, lineweight, description, etc...

 

Insert Text  Line of the FILENAME  at 0,0 on a Layer ETCH:

 

(SETVAR "CLAYER" "ETCH")

(SETQ C (GETVAR "DWGNAME"))

(COMMAND "-TEXT" "0,0" ".125" "0" C)  you can specifiy any text height, but in this example it is set to 1/8".

 

if you want to preserve the current layer,

 

(SETQ D (GETVAR "CLAYER"))

(SETVAR "CLAYER" "ETCH")

(SETQ C (GETVAR "DWGNAME"))

(COMMAND "-TEXT" "0,0" ".125" "0" C)  

(SETVAR "CLAYER" D)

 

zoom to extents:

 

(COMMAND "ZOOM" "EXTENTS")

 

i am not completely sure about the saveas dxf part.  you can set a variable to the full path drawing name:

 

(SETQ E (GETVAR "DWGPREFIX"))

(SETQ F (STRACT E C)) 

 

 maybe there is a way to substitute the .dxf for .dwg in the DWGNAME?

Message 3 of 3
bgingerich
in reply to: m.deleurere


@Anonymous.deleurere wrote:
(SETQ C (GETVAR "DWGNAME"))


To substitute "dxf" for file extension in file name:

(strcat (substr c 1 (- (strlen c) 3)) "dxf")

and (setq f (stract ... would be (setq f (strcat ...

 

 

 (if ("mysolution"=answer) then (click "Accept As Solution"))
------------------------------------------------------------------------------------

─────────────────────────────────────────────────────────────────────────────────────────────
Brandon Gingerich

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost