Hello, everyone!
I am searching for a lisp that can find all closed polylines in a drawing and export to excel their following information:
-Area of each closed polyline
-Layer in which the polyline resides
-Text inside each polyline
I have a building plan with polylines enclosing each room and the corresponding room text number also inside the polyline. I am looking for a lisp that can export to excel a table like this:
Text inside polyline | Polyline Area (m2) | Layer |
"Room_1.1" | 10 m2 | Room_Layer |
"Room_1.2" | 5 m2 | Room_Layer |
"Room_1.3" | 5 m2 | Room_Layer |
- | 20 m2 | Floor_Layer |
The polylines and room text numbers are located in different layers.
One of the polylines (last row in the table) encloses the whole building which means that there is more that one text inside it. For this single polyline, I only need its area and layer (text not needed).
I am fairly new to lisp creation so any help you can provide me would be highly appreciated!
Thanks in advance!
Solved! Go to Solution.
Solved by pbejse. Go to Solution.
I've re-written the error check to take account of the two cases. This has been tested against a list of known errors combinations and should now handle both (or more) cases. Ignore the coded "##G#" patterns as this is an always fails for hexadecimal strings eliminating cases where the "E" is first, last or not present.
I am not one of the robots you're looking for
dlanorh,
Hope all is well... Discovered another hiccup over the weekend. Sometimes the Handle IDs come in as 4 digit numeric. Example 1064 is shown below and within attached files. This should be flagged as an error. Help would be appreciated.
Space Class/Name | Area (sqft) | Perimeter (ft) | Layer | Polyline Closed? | Object Handle ID | ID Error? | Polyline Around Text? | Notes: |
- | 124.22 | 49 | A-AREA-OTLN | Yes | D0CA | No | Yes | Correct |
Polyline is not closed! | Fix Me! | 124.22 | 48.39 | A-AREA-OTLN | No | D0C9 | No | Yes | Correct |
Void | 205A CHASE | 89.56 | 39.44 | A-AREA-OTLN | Yes | D0C5 | No | Yes | Correct |
Void | 200B CHASE | 124.22 | 49 | A-AREA-OTLN | Yes | D0C4 | No | Yes | Correct |
This Space should flag as ID error. | Object ID shows up as 4 numeric characters | 539.69 | 125.73 | A-AREA-OTLN | Yes | 1064 | No | Yes | Wrong: Handle ID is an error 1064 |
Admin Circulation | 200 LOBBY | No | Correct |
Technically, it's not an error, just an integer instead of a string which can be solved by formatting the column as text.
I have attached an updated lisp that as before preceeds the integer string with a ' forcing it to text and marking it as an "error"
I am not one of the robots you're looking for
dlanorh,
Just wanted to report in and mention that the routine has been working out great. Thanks for all of your help.
Regards,
OM
Dlanorh,
After further use the only thing that would be a bit more practical is the splitting of Space Class & Space Name into two columns instead of one. Also, the addition of a "Space Name Duplicate?" column. What do you think? Example shown below.
Current:
Space Class/Name | Area (sqft) | Perimeter (ft) | Layer | Polyline Closed? | Object Handle ID | ID Error? | Polyline Around Text? |
Void | B139A CHASE | 27.25 | 27.24 | A-AREA-OTLN | Yes | 1C223D | No | Yes |
Void | B136A CHASE | 17.5 | 17 | A-AREA-OTLN | Yes | 1C2234 | No | Yes |
New:
Space Class | Space Name | Area (sqft) | Perimeter (ft) | Layer | Polyline Closed? | Object Handle ID | ID Error? | Polyline Around Text? | Space Name Duplicate? |
Void | B139A CHASE | 27.25 | 27.24 | A-AREA-OTLN | Yes | 1C223D | No | Yes | No |
Void | B136A CHASE | 17.5 | 17 | A-AREA-OTLN | Yes | 1C2234 | No | Yes | No |
Regards,
OM
Attached is updated lisp file and an example of the generated csv file. The lisp works exactly as before, I have just added the extra column and substituted a "," for the " | ". This seems to works OK
I am not one of the robots you're looking for
Dlanorh,
This is what I get using our existing error dwg test file. Something is certainly off. Attached is the dwg test file with a "duplicate space name?" error added in for testing.
Space Class | Space Name | Area (sqft) | Perimeter (ft) | Layer | Polyline Closed? | Object Handle ID | ID Error? | Polyline Around Text? |
Void | 205A CHASE | 89.56 | 39.44 | A-AREA-OTLN | Yes | D13B | No | Yes |
- | 124.22 | 49 | A-AREA-OTLN | Yes | D0CA | No | Yes | |
Polyline is not closed! | Fix Me! | 124.22 | 48.39 | A-AREA-OTLN | No | D0C9 | No | Yes |
Void | 205A CHASE | 89.56 | 39.44 | A-AREA-OTLN | Yes | D0C5 | No | Yes |
Void | 200B CHASE | 124.22 | 49 | A-AREA-OTLN | Yes | D0C4 | No | Yes |
This Space should flag as ID error. | Object ID shows up as 4 numeric characters | 539.69 | 125.73 | A-AREA-OTLN | Yes | 1064 | No | Yes |
Admin Circulation | 200 LOBBY | No |
Thank you,
OM
You will need to repost as a 2012 or earlier drawing, otherwise I cannot open it. I'm assuming the error is caused because there is no text found within the polyline. If so, how do you want this displayed?
I cannot remedy this until the weekend as I will have no access to a full version of AutoCAD until I return.
I am not one of the robots you're looking for
2012 file is attached.
To clarify the requests:
1. Split Space Class and Space Name output into two columns.
2. If possible, add another column "Space Name Duplicate?" that looks for duplicate Space Name(s); labeling them as Yes or No.
Note... Request 1 is most important and 2 is nice to have. Thanks in advance. Questions or concerns, please let me know.
Regards,
OM
Attached is the update lisp. I've re-written the Handle error check sub routine. Tested against your supplied drawing. This solves the immediate issues (I hope). The duplicate space name will need another more extensive re-write, which I will attempt over the next couple of days.
I am not one of the robots you're looking for
Ran it through a few more robust tests and it does check out. Works good... I could not be more appreciative.
Thank you,
OM
Hmm? Maybe, I spoke to soon. I does not seem the Handle ID Errors are being picked up. Attached is the data export and example dwg.
Space Class | Space Name | Area (sqft) | Perimeter (ft) | Layer | Polyline Closed? | Object Handle ID | ID Error? | Polyline Around Text? |
External | 100B COURTYARD | 7839.67 | 433.88 | A-AREA-OTLN | Yes | 2.50E+11 | No | Yes |
STORAGE | 103 STORAGE | 181.98 | 57.55 | A-AREA-OTLN | Yes | 2.30E+97 | No | Yes
|
Regards,
OM
I can't open the drawing, it needs to be 2012 or earlier. It's not obvious what is causing this so i need to run the lisp against the drawing.
I am not one of the robots you're looking for
OK, though I had allowed for this, but I discovered my test data had an error, a capital "O" instead of a zero (0) 😱 .
Try the attached. It assumes that an "e" or "E" at the start or end won't trigger the problem, and I've tested this with a revised test data into excel. This should work for any handles string lengths, although I've only test up to string length of 6.
I'll keep plugging away with the duplicate space name.
I am not one of the robots you're looking for
Can't find what you're looking for? Ask the community or share your knowledge.