Extract Rectangle Dimension To Table (Count & Numbering)

Extract Rectangle Dimension To Table (Count & Numbering)

AlexR7UZ2
Participant Participant
16,705 Views
79 Replies
Message 1 of 80

Extract Rectangle Dimension To Table (Count & Numbering)

AlexR7UZ2
Participant
Participant

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
Accepted solutions (1)
16,706 Views
79 Replies
Replies (79)
Message 61 of 80

angelteh86
Enthusiast
Enthusiast

i have also attached the rectangles and table

0 Likes
Message 62 of 80

angelteh86
Enthusiast
Enthusiast

The output table is empty and I do not know how to resolve it.

0 Likes
Message 63 of 80

Sea-Haven
Mentor
Mentor

Post a sample dwg. Looks like my code note use this line.

 

0 Likes
Message 64 of 80

angelteh86
Enthusiast
Enthusiast

Hi... I have attached the sample dwg...

0 Likes
Message 65 of 80

ec-cad
Collaborator
Collaborator

Hi angelteh86,

I have (maybe) a solution for you on that particular drawing.

The lisp was producing the Table, but with (very tiny) text for Data Cells. Header Text Size was as specified.

I tried setting the Text Height in the Data Cells. Seems to revert to the size specified in the TABLESTYLE (Standard), comes in at 0.180

pretty small. In the attached drawing, I revised the TABLESTYLE, by setting a constant of 150.0 as TextSize and under tab

General, set the Alignment to 'Middle Center'. I also set the Lisp Column width to 1800 (setq colwidth 1800)

so it will display your 'long' Layer Names.

Attached is the modified Lisp and a sample drawing.

Enjoy.

 

ECCAD

0 Likes
Message 66 of 80

Sea-Haven
Mentor
Mentor

There is 2 ways to get around cell text height, you can set the text height as part of the Table style, this can be done as a lisp checking does a style name exist, say "Table2-5" have code for make a table style. The other way is to again use lisp and set text height of cells. 

 

(vla-setcelltextheight table row i 1.8) ; by row repeat for known rows

Within make a style
   ;; Set the text height for the Title, Header and Data rows
    (vla-SetTextHeight custObj acDataRow txtht)
    (vla-SetTextHeight custObj acHeaderRow (* 1.2 txtht))
    (vla-SetTextHeight custObj acTitleRow (* 1.5 txtht))

 

0 Likes
Message 67 of 80

angelteh86
Enthusiast
Enthusiast

yeah 😄 it works wonder... i just have to revised the text sizes only... i will look into the code (fyi, im code illiterate) set the column width a little longer to accommodate long text name... thank you so so much...

0 Likes
Message 68 of 80

angelteh86
Enthusiast
Enthusiast

😅i won't know where to put them in the code... im "illiterate" on coding language...

0 Likes
Message 69 of 80

ec-cad
Collaborator
Collaborator

angelteh86,

Latest change. You don't need to change the TABLESTYLE, just leave that as Standard.

I changed the code to set the TextHeight and Alignment near the bottom of the Lisp.

Seems to work OK now. (vla-setAlignment doesn't want more than (1) thing to set, go figure..

 

ECCAD

 

0 Likes
Message 70 of 80

Sea-Haven
Mentor
Mentor

This should be used in the code rather than existing defun line. That was done for testing purposes so could look at variable values during testing. 

 

;; rectsize.lsp
: original code by AlanH
; (defun c:rectsize ( )

(defun c:rectsize ( / H:table_make cnt ent i lay lst lst3 maxpoint minpoint my-count numrows) obj objtable pointmax pointmin pontmax ss txtsz val val1 val2 xd yd)

 

0 Likes
Message 71 of 80

ec-cad
Collaborator
Collaborator

Sea-Haven,

You are correct, I forgot to add that defun line back in before final.

And, I added a (vlax-release-object Objtable) also.

My bad.

 

ECCAD

0 Likes
Message 72 of 80

angelteh86
Enthusiast
Enthusiast

hi there... i uploaded the lisp and it works as it should be... however, after i closed autocad and re-opened autocad, my autocad was on indefinite loading mode... i have waited for as long as an hour. i ended up uninstalling and installing a clean autocad... 😅 help...

0 Likes
Message 73 of 80

ec-cad
Collaborator
Collaborator

Your issue was most likely caused by Amazon Web Services (AWS). Google it for news on a massive Web Services outage.

By now, the issue seems to be resolved.

 

Have a great day. !

ECCAD

0 Likes
Message 74 of 80

angelteh86
Enthusiast
Enthusiast

alright, i will give it a try again then... hopefully it is resolved... and thanks...

0 Likes
Message 75 of 80

ec-cad
Collaborator
Collaborator

I see that you added the recsize.lsp to the startup suite. Since it has a line (C:rectsize) at the end of the program,

it may be trying to run before all startup is completed. Comment out the line:

(c:rectsize); remove if you don't want to run when loaded

like this:

;;;(c:rectsize); remove if you don't want to run when loaded

Then, when you want to call up that function, you will have to type RECTSIZE at the Command Line.

 

ECCAD

 

0 Likes
Message 76 of 80

Sea-Haven
Mentor
Mentor

Like @ec-cad if you want to preload a program you are better of loading a custom lisp that has say lots of little defuns in it rather than one single program. There is a function Called "Autoload" which loads a lisp on demand when you type its command name eg "Rectsize" You can run again just by typing RECTSIZE.

 

An example of the custom lisp. The ZZZ is the command name. The 1st part is lisp name.

(autoload "COPY0" '("COPY0"))
(autoload "COPYCOMMAND" '("ZZZ"))
(autoload "COVER" '("COVER"))
(autoload "RECTSIZE" '("RECTSIZE"))

 

0 Likes
Message 77 of 80

angelteh86
Enthusiast
Enthusiast

hi hi... i do have quite a few of lisp files that i use regularly but so far none have to load indefinitely... this is the first i have encountered... and i have been hesitant to try again because ppl did get upset with me having to uninstall and reinstall a clean autocad...

0 Likes
Message 78 of 80

Sea-Haven
Mentor
Mentor

Do remove the last line (c:rectsize) I have used a custom load on start up lisp via the Appload "Start up suite" and it has worked without a hitch for years. I add like the run the code as I normally add programs like this to a menu so it runs when selected straight away. A good alternative is use a prompt message so a message is displayed like 

 

(prompt "\nType Rectsize to run Rectangle sizes ")

 

0 Likes
Message 79 of 80

AlexR7UZ2
Participant
Participant
Accepted solution

I have found my solution using AI to edit this person's lisp. This extracts rectangle (and parallelogram) dimensions to a table, labels them, & counts duplicates.

 

Thanks all

0 Likes
Message 80 of 80

darshjalal2
Contributor
Contributor

CHECK THIS ONE OUT, IT EXTRACT THE DATA TO EXCEL FILES 

0 Likes