Hello!
We use Autocad to help process files for our CNC machine. We use some basic automation scripts already that have really helped but I'm hoping for a more complete solution. I'll outline the script below and would appreciate any guidance or if you reckon it's something you fancy taking on then I'd be happy to discuss price or a donation to a charity or something ๐
To be applied to all files within a folder
1- Import layer states from file on desktop
2- Remove all text
3- Change any 15mm dia holes to 20mm dia
4- Move everything to "BORDER" layer
5- Move 20mm dia circles to "20 hole" layer
6- Move 8mm dia circles to "8 hole" layer
7- Move 5mm dia circles to "5 hole" layer
8- Move 32mm dia circles to "32 hole" layer
9- Move 19mm dia circles to "19 hole" layer
10 - Rotate drawing 90 degrees
11-SAVE
Many Thanks!
Solved! Go to Solution.
Solved by Jonathan3891. Go to Solution.
Hi Jonathan, please find answers below.
1- Autocad drawing (from DXF)
2- The text is just an "MText" object. Only four words.
3- Neither
4- Model Space
I've recently used the Autolisp creator from JefferyPSanders which has meant I can do each task individually. It's just stitching it together and applying to all files.
Jake
I've just this second figured out how to stitch all these commands together... So now it's just import layer states first then applying it to all files. Any pointers?
Open your DXF file and create a layerstate and export it as a .las file. If you dont know how then follow the steps below.
1. Enter command "LAYERSTATE"
2. Click "NEW" and then enter a Name (a description is optional), then press "OK"
3. Click "Export" and save it where ever you want. (In my example I'm saving it to desktop and naming the file "Default.las")
4. Close DXF file
Try this code:
(command "-layer" "state" "import" "C:\\Users\\user_name\\Desktop\\default.las" "restore" "default" "" "")
That code works if you want the layer colors to import, other wise you can use this:
(layerstate-import "C:\\Users\\jonathan.norton\\Desktop\\default.las" "restore") T
Thanks for that! So far so god. Any ideas of how to run the script on every file inside a folder?
Thank you! This has progressed way further than I expected today. The final touch is to rotate all objects 90 degrees? I can achieve it in the command line just fine but not sure how to translate that onto an autolisp.
Command: SELECT Select objects: all 21 found Select objects: Command: ROTATE Current positive angle in UCS: ANGDIR=counterclockwise ANGBASE=0.00 21 found Specify base point: 0 Specify rotation angle or [Copy/Reference] <0.00>: 90
Think that's the last bit of the puzzle! Thanks for all your help, I really appreciate it. Don't suppose you've got a script that will save all these files from .DWG to DXF? Not crucial but would be nice!
Can't find what you're looking for? Ask the community or share your knowledge.