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.
turn the rectangle into a parcel and set the parcel settings to the size you want
Joe Bouza
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
@Joe-Bouza wrote:turn the rectangle into a parcel and set the parcel settings to the size you want
I know I can use Parcels, but I do not want to use them because I have about 500 of these to do and dont want the headache of numbering them and such. Just need them to be polys, nothing more.
Mark Green
Working on Civil 3D in Canada
Don't worry about the numbering. just convert them to Parcels, subdivide and then explode. It's just so fast.
@mathewkol wrote:Don't worry about the numbering. just convert them to Parcels, subdivide and then explode. It's just so fast.
Again, I dont want to use parcels as I would have to manually subdivide each one. I may as well just draw them at that point.
Ill keep looking, thanks for the ideas, guys.
Joe Bouza
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
@Joe-Bouza wrote:
If I may as; if you had a lisp would you not have to pick something, no?
I just tested and it didn't seen too painfull. 500 plus though could be anoying, but the tool is in the box if you cant find another
What I'm searching for is a LSP to do this. Yes, you would have to still pick the rectangle, but that is just a matter of clicking on each object once, as opposed to having to divide the rectangle, draw the interior rectangle, then array it, then explode it.
That's what I'm looking for.
I believe the Polyline Divide tool in MapWorks Base will do what you're looking for. It was produced to chop up PLSS sections into smaller parts and produces lines or sub-polygons. Works on a selection set of source polylines so you would only need to select once. The rectangle coordinates do not need to be ortho.
Dialog Example: http://www.dotsoft.com/images/mwPlnSubDiv.png
Try the 30-day full working evaluation to find out for yourself or email me one of your typical rectangles to dotson [at] dotsoft [dot] com.
I did some research and may have come up with a viable solution for you that meets your requirements. It involves running a Python script, then copying its results to Notepad, then finally saving and running the file as a CAD script. Python is a free, open-source language typically used for automation in the GIS world, but it can be quite versatile if you think outside the box.
To use this custom tool, you enter:
- the overall rectangle width
- the overall rectangle height
- number of columns
- number of rows
The python script calculates the dimensions for each grid and creates coordinate lists that look like the following:
PLINE
0.0,0.0
80.0,0.0
80.0,80.0
0.0,80.0
C
PLINE
80.0,0.0
160.0,0.0
160.0,80.0
80.0,80.0
C
PLINE
160.0,0.0
240.0,0.0
240.0,80.0
160.0,80.0
C
PLINE
240.0,0.0
320.0,0.0
320.0,80.0
240.0,80.0
C
...which will result in a set of closed polylines that fill the overall area.
Please let me know if this works. I read that you have hundreds of these to process (which is very tedious), and just wanted to help. 🙂 Change the extension back to .py
-Mike
Civil 3D 2013
ArcGIS 10.1
That sounds exciting, Mike, but... when I paste your code in Qgis Python console, I get a bunch of errors - tried with 1.8 and 1.9 releases.
However, if I try with an italian online Python service, it works brilliant.
Unfortunately the OP is lookin' for something else: he just has hundreds of rectangles already drawn...
The attached lsp file will do what you've requested.
Rename the file with an LSP extension -- the web site wouldn't allow me to upload it until I saved it as txt.
Don Ireland
Engineering Design Technician
Joe Bouza
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
doni49 wrote:
The attached lsp file will do what you've requested.
Are you kiddin' us, Sir..?
I only got "error: malformed list on input" : please check your code before uploading to this lordly forum, thx.
@antoniovinci wrote:
@doni49 wrote:The attached lsp file will do what you've requested.
Are you kiddin' us, Sir..?
I only got "error: malformed list on input" : please check your code before uploading to this lordly forum, thx.
I don't know what to say.
I had copy/pasted it into acad and it worked (I had two rectangles at the start and after running it, I had 8. But when I tried LOADING it in, it failed.
Anyway, I found the bug and fixed it. Just to be sure, I created a new drawing, drew two rectangles and loaded the lsp file via APPLOAD. It happily draws the rectangles.
And here's the dwg file that I used for testing -- it started out as two rectangles the ones you see were created by the lisp routine.
Don Ireland
Engineering Design Technician
Joe Bouza
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
@Joe-Bouza wrote:
You're getting closer Doni; the OP request the division to be 64 rectangles not 4
Ouch. I truly overlooked that part. That will take some pondering. But I'm sure it can be done
Don Ireland
Engineering Design Technician
The python code as provided is version 2.7, and I have tested it several times this morning. I run the script using IDLE independent of any built-in application console. It can create an 8x8 grid or one as dense as required that fills the original rectangle. In fact, I've added it to my working library.
Have a great day.
-Mike
Ok. I've updated it to put 64 separate rectangles. It HAS been tested (using the attached dwg file).
Don Ireland
Engineering Design Technician
In 2012 I get a malformed lisp error.
Allen
Allen Jessup
CAD Manager - Designer
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Can't find what you're looking for? Ask the community or share your knowledge.