Polylines to Circles Program

Polylines to Circles Program

bemmer7MZ3G
Contributor Contributor
579 Views
4 Replies
Message 1 of 5

Polylines to Circles Program

bemmer7MZ3G
Contributor
Contributor

I work with these logos which have holes for electrical to run through, these need to match to the real part which is already manufactured. They send me the letters with the hole patterns like the attached file, but it is coming from Revit so I never get the holes as circles, which I need to program my CNC. I need a script that looks at those polygons and converts them to circles, and it would be preferable if I could select all the holes at once. Thank you

0 Likes
Accepted solutions (1)
580 Views
4 Replies
Replies (4)
Message 2 of 5

dbroad
Mentor
Mentor

To code it yourself,

1)Get a selection set of polylines.

2)For each polyline in the set,

  a)find it's GCE using OSNAP.

  b)find it's extents using acet-ent-geomextents

  c)determine the diameter from either the minimum, maximum, or average width/height from the extents.

  d)draw the circle using the GCE as its center and diameter.

  e)delete the polyline

 

If you already know the radii and just want to replace them process the selection set by drawing the circles from the GCE and the radii you already know.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 3 of 5

bemmer7MZ3G
Contributor
Contributor

AutoCAD says unknown command "acet-ent-geomextents"

0 Likes
Message 4 of 5

marko_ribar
Advisor
Advisor

You don't have Express Tools installed... That's why error message... But you have alternative through Visual LISP :

 

(vl-load-com)

(vla-getboundingbox (vlax-ename->vla-object ent) (quote ll) (quote ur))

(mapcar (function set) (list (quote ll) (quote ur)) (list ll ur))

 

Now you have ent extends - those are points : ll and ur...

Marko Ribar, d.i.a. (graduated engineer of architecture)
0 Likes
Message 5 of 5

Kent1Cooper
Consultant
Consultant
Accepted solution

You can use the Pg2C command defined in PolygonToCircle2.lsp, attached.

 

They're not regular enough for my other routine, PolygonToCircle.lsp, but this one was made to do it in a different way that allows them to be irregular.  See the comments at the top of the file.

 

You can select as many as you want at once, but don't include in the selection Polylines other than those you want made into Circles [such as the letters or the diamond shapes in the logo], because it will work on those, too.

Kent Cooper, AIA
0 Likes