Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autolisp for object export?

Status
Not open for further replies.

ohiocad

Structural
Apr 6, 2001
193
Have tried to find a lisp or vis. basic routine that would do the following, but haven't been able to locate one, apologies if I missed something simple:

We have a lot of blocks (150 so far, total likely about 300), that have rectangles in them of varying sizes, typically 3-8 per block.

Is there an easy way to extract the rectangle size, isolated by layer, sorted by block name, to a spreadsheet or table? I can extract some of the data that we need with the built in data extraction tool, but haven't been able to get the x and y dimensions of the rectangles.

We've done it by hand before, but not looking forward to doing it again.
 
Replies continue below

Recommended for you

"Is there an easy way to extract the rectangle size, isolated by layer, sorted by block name"

No.


You need a custom routine to read the block table for each block, find each rectangle size (& layer), then for each block insert read the x-y scales, apply that to block rectangle sizes; sum up; keep track of same sizes, then write to a file. If you had a single block, with multiple inserts at varying scales, not so difficult. But multiple blocks with multiple rectangles increases complexity quite a bit. I see several hours of programming & debugging.
 
That's the answer that I'd expected, just not the one that I was hoping for.

I haven't done anything that in-depth myself, and don't think I want to jump in on something that complicated. Thanks for the input. Will need to talk to the boss and see what he says.
 
To drag up an old subject, but with a new twist.

Instead of trying to extract the info from inside the blocks, would it be a simple lisp to extract the length and width of selected rectangles, and have that exported to a list? We've already got everything drawn, and can create a sheet that has the blocks exploded into lines and rectangles.

We've also got a bunch of changes on the project to add, that would be even offset dimensions of the existing rectangles. (We could just take the numbers exported, drop it on a spreadsheet, and create new columns adding and subtracting to get the additional cut sizes) Literally weeks of work that we could skip, if there's a lisp out there, or if I could write one, that's why it would need to be reasonably simple. I only know enough to get myself into trouble. (I've checked all my usual haunts, and haven't found one yet)

 
Hi ohiocad,

Hmm...

Your problem doesn't sound too terrible, it's probably been too long for me with AutoLISP but, if you're going to have to select each rectangle, something like the entget function is going to return a polyline - (if these rectangles were created with the "rectangle" command) or just line line if they are created the hard way with lines or are exploded polylines - my point here you probably won't have too much trouble finding the chunks of code you need - you'll just need to cobble them together to make them work for you. So search and see if you can find a line length routine, and a polyline length routine, and then look in the help for entget/nentget functions - hopefully those things will get you started.

HTH
Todd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor