Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Extract Rectangle Dimension To Table (Count & Numbering)

51 REPLIES 51
Reply
Message 1 of 52
AlexR7UZ2
5334 Views, 51 Replies

Extract Rectangle Dimension To Table (Count & Numbering)

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

 

-Me

 

Tags (3)
Labels (1)
51 REPLIES 51
Message 2 of 52
Sea-Haven
in reply to: AlexR7UZ2

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.

Message 3 of 52
AlexR7UZ2
in reply to: Sea-Haven

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

Message 4 of 52
Sea-Haven
in reply to: AlexR7UZ2

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

 

 

 

Message 5 of 52
AlexR7UZ2
in reply to: Sea-Haven

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

Message 6 of 52
devitg
in reply to: AlexR7UZ2

my error

Message 7 of 52
AlexR7UZ2
in reply to: devitg

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

Message 8 of 52
Sea-Haven
in reply to: AlexR7UZ2

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.

Message 9 of 52
zaid.k3112
in reply to: Sea-Haven

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

Message 10 of 52
Sea-Haven
in reply to: AlexR7UZ2

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

Message 11 of 52
zaid.k3112
in reply to: Sea-Haven

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. 

Message 12 of 52
Sea-Haven
in reply to: AlexR7UZ2

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. 

Message 13 of 52
zaid.k3112
in reply to: Sea-Haven

Hello, any update regarding the lisp?

Message 14 of 52
Sea-Haven
in reply to: AlexR7UZ2

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

 

 

 

 

 

 

Message 15 of 52
Sea-Haven
in reply to: AlexR7UZ2

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.  

Message 16 of 52
Sea-Haven
in reply to: Sea-Haven

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.

 

 

Message 17 of 52
zaid.k3112
in reply to: Sea-Haven

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? 

Message 18 of 52
Sea-Haven
in reply to: zaid.k3112

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.

Message 19 of 52
zaid.k3112
in reply to: Sea-Haven

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?

Message 20 of 52
Sea-Haven
in reply to: AlexR7UZ2

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.

 

 

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report