AutoCAD Civil 3D General Discussion

AutoCAD Civil 3D General Discussion

Reply
*Expert Elite*
1,793 Posts
194 Kudos
Registered: ‎06-03-2011
Post 11 of 31

Re: Subdivide a rectangle

10-11-2013 05:47 AM in reply to: mw_in_okc

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

*Expert Elite*
2,063 Posts
172 Kudos
Registered: ‎12-22-2012
Post 12 of 31

Re: Subdivide a rectangle

10-11-2013 07:33 AM in reply to: owenmull

The attached lsp file will do what you've requested. 

 

  1. it does NO error checking.  It will prompt you to make a selection.  It will only allow you to select lwpolylines (not 3d polylines).
  2. it will be up to you to make sure that you only choose rectangles.  This will work as long as you ONLY choose rectangles.
  3.  if you want to keep the existing rectangles go to the bottom of the lsp file and remove the line that deletes them.

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



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.


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. Such messages will be deleted unread & without a reply.






Forum links:
AutoCAD 2013/2014/2015
AutoCAD 2010/2011/2012

AutoLISP, VB and other AutoCAD customization


Civil 3D General
Civil 3d Customization


Other Helpful links:
My File is too large to post or I can't post it due to privacy issues!
*Expert Elite*
5,260 Posts
326 Kudos
Registered: ‎12-15-2008
Post 13 of 31

Re: Subdivide a rectangle

10-11-2013 07:59 AM in reply to: doni49
Wont run fo me
Thank you

Joseph D. Bouza, P.E. (one of 'THOSE' People) Civil 3D 2012 & 2013
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 Win7 OS
*Expert Elite*
1,793 Posts
194 Kudos
Registered: ‎06-03-2011
Post 14 of 31

Re: Subdivide a rectangle

10-11-2013 08:06 AM in reply to: doni49

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.

*Expert Elite*
2,063 Posts
172 Kudos
Registered: ‎12-22-2012
Post 15 of 31

Re: Subdivide a rectangle

10-11-2013 08:16 AM in reply to: antoniovinci

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



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.


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. Such messages will be deleted unread & without a reply.






Forum links:
AutoCAD 2013/2014/2015
AutoCAD 2010/2011/2012

AutoLISP, VB and other AutoCAD customization


Civil 3D General
Civil 3d Customization


Other Helpful links:
My File is too large to post or I can't post it due to privacy issues!
*Expert Elite*
5,260 Posts
326 Kudos
Registered: ‎12-15-2008
Post 16 of 31

Re: Subdivide a rectangle

10-11-2013 08:20 AM in reply to: doni49
You're getting closer Doni; the OP request the division to be 64 rectangles not 4
Thank you

Joseph D. Bouza, P.E. (one of 'THOSE' People) Civil 3D 2012 & 2013
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 Win7 OS
*Expert Elite*
2,063 Posts
172 Kudos
Registered: ‎12-22-2012
Post 17 of 31

Re: Subdivide a rectangle

10-11-2013 08:28 AM in reply to: Joe-Bouza

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



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.


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. Such messages will be deleted unread & without a reply.






Forum links:
AutoCAD 2013/2014/2015
AutoCAD 2010/2011/2012

AutoLISP, VB and other AutoCAD customization


Civil 3D General
Civil 3d Customization


Other Helpful links:
My File is too large to post or I can't post it due to privacy issues!
Member
3 Posts
0 Kudos
Registered: ‎10-10-2013
Post 18 of 31

Re: Subdivide a rectangle

10-11-2013 08:43 AM in reply to: antoniovinci

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

*Expert Elite*
2,063 Posts
172 Kudos
Registered: ‎12-22-2012
Post 19 of 31

Re: Subdivide a rectangle

10-11-2013 10:41 AM in reply to: doni49

Ok.  I've updated it to put 64 separate rectangles.  It HAS been tested (using the attached dwg file).

 

 

Don Ireland



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.


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. Such messages will be deleted unread & without a reply.






Forum links:
AutoCAD 2013/2014/2015
AutoCAD 2010/2011/2012

AutoLISP, VB and other AutoCAD customization


Civil 3D General
Civil 3d Customization


Other Helpful links:
My File is too large to post or I can't post it due to privacy issues!
*Expert Elite*
6,268 Posts
485 Kudos
Registered: ‎05-21-2003
Post 20 of 31

Re: Subdivide a rectangle

10-11-2013 10:50 AM in reply to: doni49

In 2012 I get a malformed lisp error.

 

Allen

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post