Extract Rectangle Dimension To Table (Count & Numbering)

Extract Rectangle Dimension To Table (Count & Numbering)

AlexR7UZ2
Explorer Explorer
8,242 Views
56 Replies
Message 1 of 57

Extract Rectangle Dimension To Table (Count & Numbering)

AlexR7UZ2
Explorer
Explorer

Hi,

 

First off I have little to no experience reading/editing a LISP. I'm trying to see if its possible to combine these two LISPS attached to get what I'm looking for. The AreaLabelV1-9.1 is a great lisp. Unfortunately, it doesn't account for duplicates to create a count # for picked areas or objects like the rectangle_dims LISP does. I need it to have the ability to consolidate duplicate areas so I don't have multiples in the table. 

I'd appreciate any help/advice.🤓

 

-Me

 

0 Likes
8,243 Views
56 Replies
Replies (56)
Message 2 of 57

Sea-Haven
Mentor
Mentor

Would it not be the 3 variables area, X and Y that are needed ?

 

If you just want areas no problems you make a list of all the areas and count up the same size ones, should be something out there now.

0 Likes
Message 3 of 57

AlexR7UZ2
Explorer
Explorer

image.png

Area, X, Y, Label, and Count of each rectangle are needed. The AreaLabelV1-9.1 LISP captures all of these, but the count is linear and doesn't group together duplicates on the table. I'm wondering if there is a way to edit the LISP so it recognizes rectangles with the same X & Y and instead of labeling it a new #, it uses the # for that specific size then keeps the count going. So instead of 10 different rectangles, it would show 7 with duplicates. Thanks!

 

-Me

0 Likes
Message 4 of 57

Sea-Haven
Mentor
Mentor

This was done for someone else I think its what you want. Please post a dwg problem is the code was coded for stuff like layer names. It does more like numbers the rectangs so a size 2 would appear in the results table as say 2,4 see image.

 

screenshot390.png

 

 

 

0 Likes
Message 5 of 57

AlexR7UZ2
Explorer
Explorer

Hi!

That image you posted is close to what I am looking for except for the layer names. I attached a DWG showing an example of what I'd use it for. A LISP able to label each rectangle and still keep an accurate count for the duplicates in the table. The rectangle dims.lsp attached doesn't label the rectangles chosen. 

 

Thanks!!

0 Likes
Message 6 of 57

devitg
Advisor
Advisor

my error

0 Likes
Message 7 of 57

AlexR7UZ2
Explorer
Explorer

That is a bad polyline....but it is irrelevant to the problem. 🙃

0 Likes
Message 8 of 57

Sea-Haven
Mentor
Mentor

It has been a while since I looked at this, your welcome to play with the code. Your dwg needs a different way of approaching counting the labels and getting their size, maybe a list manipulation. Just get the label text use bpoly to get area and make a list of (label area)

 

((2 area 2)(3 area3)(2 area2) ......   becomes (2 area2 2)(3 area3 1) I am not very  good at mapcar lists.

0 Likes
Message 9 of 57

zaid.k3112
Contributor
Contributor

Hey
The lisp you sent does not work. I get nil in the command line. 

0 Likes
Message 10 of 57

Sea-Haven
Mentor
Mentor

It has some custom stuff in code, like look for a layer, post a sample dwg and will see what I can do.

0 Likes
Message 11 of 57

zaid.k3112
Contributor
Contributor

So basically, what my end goal is you can see in the dwg attached below. I have a main poly line (shown in global weight black), and I need to get its area by manual calculation. For that, I make smaller rectangles inside a main rectangle. So, by deducting smaller rectangle from the main one, you will get the net area of the main poly line. 
What I want is, by selecting all the smaller rectangle, the lisp would auto place dimensions and name them accordingly with rectangles of similar LxB as one entry in table and not as duplicates. The same would be placed in a table as shown in drawing. 

0 Likes
Message 12 of 57

Sea-Haven
Mentor
Mentor

Added to my to do list. Have like 5 at moment. 

 

Can see a way to do but need a couple of changes to dwg will explain later. 

0 Likes
Message 13 of 57

zaid.k3112
Contributor
Contributor

Hello, any update regarding the lisp?

0 Likes
Message 14 of 57

Sea-Haven
Mentor
Mentor

Sorry dropped off my list may have some time this week to see if can do something.

 

Update 13/11/2022 all rectangs are now numbered and sizes grouped, but I have been busy doing other stuff. Will get back to it.

Update 15/11 rects labelled and dims version 1. Need to look at consistency in dims, later version, next is table.

Update 17/11 dims now left side and top only, full table created all items, next step is to get count working properly.

SeaHaven_0-1668654208942.png

 

 

 

 

 

 

0 Likes
Message 15 of 57

Sea-Haven
Mentor
Mentor

I have realised need to probably rewrite a fair bit of it so it takes into account len & wid & area being totaled properly, so have posted where I am up to. It needs to use a different algorithm that I have to do the counting part, and the table needs some customisation to the cells text and sizes etc. Sometimes just have to take a big step back and do again.

 

 

 

see new version below

 

 

 I have posted to show the complexity of such a request.  

0 Likes
Message 16 of 57

Sea-Haven
Mentor
Mentor

After a bit more work try this, note there are some thick plines which I turned off not sure if they are to be included kept the obvious rectang ones.

 See latest post for updated code.

 

 

0 Likes
Message 17 of 57

zaid.k3112
Contributor
Contributor

Hey, for some reason the lisp isnt working in my CAD. Whenever I select the rectangles, the table gets generated but its black. Could you generate an excel for the same? 

0 Likes
Message 18 of 57

Sea-Haven
Mentor
Mentor

No, what messages appear, just saying does not work means nothing. Is there anything in the table as current table style can affect the result. Post dwg with result.

0 Likes
Message 19 of 57

zaid.k3112
Contributor
Contributor

Hey, the table is being generated, however the main rectangle through which we have to subtract the smaller ones is not being input in the table. Also, if you see in the drawing, 2 and 3 are numbered differently but they are of same size. Also in the table, the main subtraction is not input (see last few rows of my older table). I think its better if we export it to excel, I will have more flexibility to change stuff as needed. Also, Is there any way to number these rectangles clockwise or so?

0 Likes
Message 20 of 57

Sea-Haven
Mentor
Mentor

Also, Is there any way to number these rectangles clockwise or so? Not for free, a bit of work as rectangs are sorted based on area to find equals so no check for actual location. Thats like a renumber blocks but also table still match.

 

It has missed a couple will go back and have another look it should do 20 and 21.

 

 

0 Likes