using script to draw holes based on existing geometry and rules

using script to draw holes based on existing geometry and rules

mschuster
Contributor Contributor
1,293 Views
10 Replies
Message 1 of 11

using script to draw holes based on existing geometry and rules

mschuster
Contributor
Contributor

I'm researching how much AutoCAD can do with scripts for a project designing a custom CNC drilling table for a client. I know scripts are possible but have never done any myself or know what the limitations are.

 

What we would like to do is to take a wall framing drawing and:

1. determine location of studs (layer1)

2. determine location of drywall/gypsum boards (layer2)

3. use those locations to draw holes or points in the center of each stud at a set spacing, and where two boards butt up place the hole 1/4" of the way from the edge of a stud.

 

This then would be sent to a CAM program.

 

See the attached pdf for a simple example, the panels may have windows, doors , and be irregularly shaped.

 

any feedback and suggestions would be great, even if what we are trying to do is not at all possible.

 

If we had time we would create a custom program from the ground up to do this.

 

thanks!

Mike

0 Likes
1,294 Views
10 Replies
Replies (10)
Message 2 of 11

devitg
Advisor
Advisor

Hi Mike. Mschuster.

First at all, please upload your sample .dwg , with all such particularities.

You say SCRIPT, but I guess you mean a way to do it by LISP.

I wonder  about the size of the cnc machine that would do such task, I would like to see it. 

The main concern is to use layers to each kind of material and sizes, so LISP can determine what to do.

Studs , one for each one .

drywall panels .

window frames 

I know a few about this construction kind, I know how it's done. Never I did one.  

 

0 Likes
Message 3 of 11

mschuster
Contributor
Contributor

Hi devitg,

 

unfortunately I do not have a sample file yet, the CAD files will be supplied by the clients CAD department. We don't even know exactly what software our client is using, at the moment we assume it is Revit. And in the end we will have to tell them what is needed. 

 

Same as with the machine, we are in process of designing it. The machine will have overall dimensions of about 35 ft x 25 ft, wall panels will be on average 24 ft x 12 ft. I've attached an image of similar size machine that we have built for the same client.

 

If I understand you correctly, we would need a layer for every part in an wall assembly. 

 

I'm not too concerned about programming details yet, just checking to see if it is feasible. Researching the possible paths we can go down.

 

0 Likes
Message 4 of 11

devitg
Advisor
Advisor

Hi Mike , very nice machine.

Shall I understand the new machine will built panel at the floor , and then upload , turn it up-down , end task on both sides,  and send to workplace?

Or it will work inside room.?

Lisp do not THINK, so you shall give all data possible in a way it can know what to do. 

You have to give all rules .

 All is possible. 

 

 

0 Likes
Message 5 of 11

Sea-Haven
Mentor
Mentor

Having been involved in commercial programming, 35+ years of Autocad, I can see this is question 1 out of "Hmmm where is that list".

 

Drawing circles at an offset from a line is pretty easy with radius and offset given see image. If that's all you want. 

 

I am hinting that you may want to look at contracting someone, there are plenty here and on other sites like CADTUTOR, who can help you. This would mean consistent interface and methods.

 

 

0 Likes
Message 6 of 11

Sea-Haven
Mentor
Mentor

Here is an example for drawing holes at a spacing offset from a line, easy converted to support plines. I expect a 1st step with mods about hole spacing. Look at image

 

; Simple hole at offset from line
; By alanh info@alanh.com.au
; This version is a line only

(defun c:doholes ( / ans p1 p2 p3 d1 d2 temp ang oldsnap dist)

(if (not AH:getvalsm)(load "Multi Getvals.lsp"))
(setq ans (AH:getvalsm (list "Enter values" "Offset      " 5 4 "0.25" "Spacing" 5 4 "8" "Dia" 5 4 "0.25")))

(setq off (/ (atof (nth 0 ans)) 12.0)
	c-c (/ (atof (nth 1 ans)) 12.0)
	rad (/ (atof (nth 2 ans)) 24.0)
)

(setq oldsnap (getvar 'osmode))

(SETQ TP1 (entsel "\nSelect Line near left end: ")) ; implies which way for holes
(setq tpp1 (entget (car tp1))
	p1 (cdr (assoc 10 tpp1))
	p2 (cdr (assoc 11 tpp1))
	p3 (cadr tp1)
)

(setq d1 (distance p1 p3)
	d2 (distance p2 p3)
)

(if (> d1 d2)
    (progn 
    (setq temp p1)
    (setq p1 p2)
    (setq p2 temp)
    )
)
	
(setq ang (angle p1 p2)
	dist (distance p1 p2)
)

(setvar 'osmode 0)

(setq num  (fix (/ dist c-c))
	endd (/ (- dist (*  num c-c)) 2.0)
)

(if (= endd 0.0)
	(progn
	(setq endd c-c
	num (- num 1)
	)
	)
	(setq num (+ num 1))
)

(setq p2 (polar p1 (- ang (/ pi 2.)) off)
	p2 (polar p2 ang endd)
  )

(repeat num
	(command "circle" p2 rad)
	(setq p2 (polar P2 ang c-c))
)


(setvar 'osmode oldsnap)

(princ)
) ; end defun

 

 

0 Likes
Message 7 of 11

mschuster
Contributor
Contributor

Thanks for sample. Now add these rules:

1. is the wall stud on a different spacing than all the others? 

2. "is there a drywall board joint?" Now you would have to create two "holes" on the same stud but 1/4 the stud width away from each edge of the stud instead of a single hole.

3. are there windows or door framing?

4. Are there any overlapping holes?

 

kind of see where I am going with that? 🙂

 

I am not expecting anyone to supply or have ready made code, just trying get enough definitive information to go back to the client and say: "Yes, we can automate it" or " No, you have to add drilling points to your cad model that the CAM software can recognize" in the time we have been given (Jan 15th,2020 for a demo)

 

Also not too worried about the actual programming, we have 6 programmers and have made numerous one-off CNC machines with custom software and control packages. Given much more time we could make a custom solution, which may happen anyways based on my research.

 

thanks,

Mike

0 Likes
Message 8 of 11

Sea-Haven
Mentor
Mentor

See were already into that "Hmmm where is the list" and only scratched the surface. If you have programmers and they can write .NET, C++, VBA, or for me preferred Autocad Lisp. Then why are you asking here.

 

I have a 3d house design package co authored by me, yes it asks lost of questions takes into account a number of factors depending on the situation. Draws walls, windows, doors etc It can be done.

 

Post some dwgs or images of what it is you really want done.

 

Again it sounds like you need some one to get you started. What can I say a task I got involved with took 20 minutes to draft now takes 2 minutes. Every one here will have stories about massive time savings.

Message 9 of 11

doaiena
Collaborator
Collaborator

@mschuster wrote:

I'm researching how much AutoCAD can do with scripts for a project designing a custom CNC drilling table for a client. I know scripts are possible but have never done any myself or know what the limitations are.


You can do pretty much everything with AutoCAD. It should be a fairly easy task to code, if you provide your programmers with all the relevant data they might need, and all the edge cases you can think of. From what you have written so far, i think you can do everything with AutoLisp, but if for some reason you need additional functionality that lisp can't provide, you have the option to use .NET, or a combination of .NET and AutoLisp.

As for the limitations - i can't think of any at the moment.

0 Likes
Message 10 of 11

mschuster
Contributor
Contributor

@Sea-Haven wrote:

See were already into that "Hmmm where is the list" and only scratched the surface. If you have programmers and they can write .NET, C++, VBA, or for me preferred Autocad Lisp. Then why are you asking here.

 


I was given the task to determine what is possible before we dedicate resources. I use Inventor daily (mechanical design) and but have only used AutoCAD for very simple things. So I came to the experts to get some help. 🙂

0 Likes
Message 11 of 11

mschuster
Contributor
Contributor

@doaiena wrote:

 

You can do pretty much everything with AutoCAD. It should be a fairly easy task to code, if you provide your programmers with all the relevant data they might need, and all the edge cases you can think of. From what you have written so far, i think you can do everything with AutoLisp, but if for some reason you need additional functionality that lisp can't provide, you have the option to use .NET, or a combination of .NET and AutoLisp.

As for the limitations - i can't think of any at the moment.


That is good to know. 

 

Thanks to everyone for the help and suggestions.

0 Likes