Greetings.
I am wondering, does anyone have or know of a LSP routine or some easy way to take any given rectangle and divide it into "x" number of rectangles?
I can run a Macro to accomplish this, but ONLY if the rectangle is of the same dimensions as set up in the Macro.
What I am looking for is a LSP or something else that can take a rectangle of any dimension, "array" it into 64 rectangles, all having same dimensions, and said 64 rectangles making up the original, larger rectangle. The end product will resemble a grid of sorts, but I need each interior rectangle to be a closed polyline, rather than just splitting the large rectangle with gridlines.
Can anyone help? I can do this manually using the array command for each one, but there are several hundred that need broken up, and no time to do it in.
Thanks!
Solved! Go to Solution.
Solved by doni49. Go to Solution.
@AllenJessup wrote:In 2012 I get a malformed lisp error.
Allen
From the latest version (posted right before your message)? There was a malformed list error in the previous version.
But I created the dwg file from scratch after updating the lsp file, drew three rectangles, loaded the lsp file via APPLOAD and then ran the routine. It generated all the rectangles that you see.
Don Ireland
Engineering Design Technician
doni49 wrote:
That will take some pondering
Well, I think you outta carry on pondering, man.
Tested on Map2006, your Lisp yields a beautiful modern artwork, something psychedelic, where it's hard to find out an array of identical rectangles...
Perhaps my Autocad is too old to support your code, so let's sit and wait for other opinions.
doni49 wrote:
From the latest version (posted right before your message)? There was a malformed list error in the previous version.
No. From the first. Our post crossed. Now it runs but I get a bowtie. 3 equal size triangles and one double the size
I moved the magenta one out a little to make it visible. I'm not complaining. Jut giving feedback. I don't need to divide any rectangles myself.
Allen
BTW I checked that my UCS was World and my Viewtwist was 0°
Allen Jessup
Engineering Specialist / CAD Manager
Curiosity got the better of me so I gave it a go.
Civil 3D 2011, 32 bit
Before:
After:
Worked perfectly on rectangles drawn in ortho directions, but the rotated one suffered a bit in translation as you can see.
Mark Green
Working on Civil 3D in Canada
@antoniovinci wrote:@doni49 wrote:
That will take some ponderingWell, I think you outta carry on pondering, man.
Tested on Map2006, your Lisp yields a beautiful modern artwork, something psychedelic, where it's hard to find out an array of identical rectangles...Perhaps my Autocad is too old to support your code, so let's sit and wait for other opinions.
There's no code in there that shouldn't work even as far back as R14 (I think that's when LWPolyline first showed up). The main components are SSGet, Polar, Angle, Distance and the polyline command.
Very odd. Hopefully it'll work for the OP though.
Don Ireland
Engineering Design Technician
Doni
For your perseverance and trial by fire I gladly offer kudos
@AllenJessup wrote:
@doni49 wrote:
From the latest version (posted right before your message)? There was a malformed list error in the previous version.
No. From the first. Our post crossed. Now it runs but I get a bowtie. 3 equal size triangles and one double the size
I moved the magenta one out a little to make it visible. I'm not complaining. Jut giving feedback. I don't need to divide any rectangles myself.
Allen
BTW I checked that my UCS was World and my Viewtwist was 0°
Hmmm. It looks like the order of the points isn't the same all the time. This is going to bug me until I figure out a way around it.
Don Ireland
Engineering Design Technician
Since everybody is posting pictures, here's mine.
@doni49 wrote:Ok. I've updated it to put 64 separate rectangles. It HAS been tested (using the attached dwg file).
Doni,
Thank you so much. This is exactly what I was searching for.
A million thank you's to you, sir!
Thanks everyone for all your input and thougts. I havent tried the Python code but plan to.
Autodesk --- think about developing something like this in future releases. Tools to split shapes into even, inscribed polygons.
The only thing this doesnt do which would be ideal, is it draws the rectangles orthometrically. If my rectangle I wish to subdivide has any rotation to it, I must then rotate them once drawn, or constantly change my UCS.
I dont yet know enough about this coding to write my own, but this lsp from Doni pretty much accomplishes what I'm looking for.
Thanks!