Community
Civil 3D Forum
Welcome to Autodesk’s Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Subdivide a rectangle

30 REPLIES 30
SOLVED
Reply
Message 1 of 31
owenmull
4226 Views, 30 Replies

Subdivide a rectangle

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!

-Owen
Windows 7 x 64 bit

Civil 3D 2017
______________________________________________________________
Usually, I find that the problem is between the keyboard and the chair.
30 REPLIES 30
Message 21 of 31
doni49
in reply to: AllenJessup


@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




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

Message 22 of 31
mathewkol
in reply to: doni49

It worked for me in 2014.  Nice work.

Matt Kolberg
SolidCAD Professional Services
http://www.solidcad.ca /
Message 23 of 31
antoniovinci
in reply to: doni49

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.

Message 24 of 31
AllenJessup
in reply to: doni49


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

4rec.PNG

 

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

Message 25 of 31
troma
in reply to: doni49

Curiosity got the better of me so I gave it a go.

Civil 3D 2011, 32 bit

 

Before:

rect_quads before.PNG

 

 

After:

rect_quads after.PNG

 

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

Message 26 of 31
doni49
in reply to: antoniovinci


@antoniovinci wrote:
@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.


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




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

Message 27 of 31
Joe-Bouza
in reply to: doni49

Doni

For your perseverance and trial by fire I gladly offer kudos

Thank you

Joseph D. Bouza, P.E. (one of 'THOSE' People)

HP Z210 Workstation
Intel Xeon CPU E31240 @ 3.30 Hz
12 GB Ram


Note: Its all Resistentialism, so keep calm and carry on

64 Bit Win10 OS
Message 28 of 31
doni49
in reply to: AllenJessup


@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

4rec.PNG

 

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




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

Message 29 of 31
TerryDotson
in reply to: owenmull

Since everybody is posting pictures, here's mine.

 

results.png

Message 30 of 31
owenmull
in reply to: doni49


@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.

-Owen
Windows 7 x 64 bit

Civil 3D 2017
______________________________________________________________
Usually, I find that the problem is between the keyboard and the chair.
Message 31 of 31
owenmull
in reply to: doni49

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!

-Owen
Windows 7 x 64 bit

Civil 3D 2017
______________________________________________________________
Usually, I find that the problem is between the keyboard and the chair.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report