Automation For CNC - Help or hire

Anonymous

Automation For CNC - Help or hire

Anonymous
Not applicable

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! 

 

0 Likes
Reply
Accepted solutions (1)
1,003 Views
11 Replies
Replies (11)

Jonathan3891
Advisor
Advisor
I have a few questions.

1- What type of file contains your layers? An AutoCAD drawing or CSV file?
2- Does removing all text include dimensions and leaders?
3- Does the drawing contain a border or titleblock?
4- Is everything in model space or paper space?

Jonathan Norton
Blog | Linkedin
0 Likes

Anonymous
Not applicable

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 

0 Likes

Anonymous
Not applicable

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?

0 Likes

Jonathan3891
Advisor
Advisor

 

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

Jonathan Norton
Blog | Linkedin

Jonathan3891
Advisor
Advisor

Sorry, double post!


Jonathan Norton
Blog | Linkedin

Anonymous
Not applicable

Thanks for that! So far so god. Any ideas of how to run the script on every file inside a folder? 

0 Likes

Jonathan3891
Advisor
Advisor

try this


Jonathan Norton
Blog | Linkedin
0 Likes

Anonymous
Not applicable

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
0 Likes

Jonathan3891
Advisor
Advisor
Accepted solution

Assuming you want to use "0,0" as the base point:

(command "rotate" "all" "" "0,0" "90")

Jonathan Norton
Blog | Linkedin
0 Likes

Anonymous
Not applicable

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! 

0 Likes

Jonathan3891
Advisor
Advisor

If you want to use a lisp:

(command "dxfout" "" "16")

If you want to use a script use the attachement and change the file type to .scr


Jonathan Norton
Blog | Linkedin
0 Likes