CAD Handle Export

CAD Handle Export

Anonymous
Not applicable
6,411 Views
28 Replies
Message 1 of 29

CAD Handle Export

Anonymous
Not applicable

Hi

 

I'm currently looking for a way of exporting CAD Handles from a drawing or more preferably a set of drawings in a directory. Ideally, the X,Y coordinates Rotation and Block Names also. 

 

The Data Extraction tool doesn't include the CAD Handles unfortunately and all of the LISP sites i've visited dont perform this either. 

 

I have no idea how to write LISP but does someone have a tool or a way of extracting this information? 

 

Much appreciated in advance 🙂 

 

Thanks

 

 

0 Likes
Accepted solutions (1)
6,412 Views
28 Replies
Replies (28)
Message 21 of 29

roland.r71
Collaborator
Collaborator

@Anonymous wrote:

hi Danny

 

I took your previous lisp code and used the AutoScript tool i have on my machine to execute on multiple drawings. 

 

It works perfectly thank you. 

 

I do have a question on it. Some blocks on some drawings that were returned occur more than once in the output. Do you know why this would be? It's not a problem, i can filter them out, but i am curious why that would be. 

 

Thanks


That's because it's normal.

You can insert a block multiple times. Each one will get a unique Handle. This handle will remain unchanged.

So you can always find that one block INSERT it belongs to. If you can't find it, it has been deleted.

 

Perfect for reading out hundreds of terminals, across many dwg's. Although each terminal is the same block, they ALL have their own handle.

You could renumber the terminals using excel an then write back the new numbers to each terminal block based on these unique handles.

You can also use it to manage a database with materials.

 

But it's not something they all share. That's just the blockname (unless it's dynamic)

 

You can not use the handle to see if a certain block (definition) is present, as the handle will be different for each of them.

Just to find a specific instance of the block within a specific drawing.

 

Hence, if there's more as one insert of the block, they all show up (with each it's own unique handle)

 

If this is not what you want/expected, i wonder what exactly it is you use the handle for. Hopefully not to identify the block (definition) in general.

0 Likes
Message 22 of 29

Anonymous
Not applicable

Apologies Roland, i wasn't very clear in my previous post. 

 

What i meant, is that there are multiple blocks WITH THE SAME HANDLE in the output from the tool. Handles within a drawing are completely unique and should only occur once.

 

This doesnt occur on every drawing, only a few in fact, but i was curious why there would be multiple handles reported in the output.  

0 Likes
Message 23 of 29

roland.r71
Collaborator
Collaborator

I see.

That's not good, indeed.

 

edit:

I'm guessing it has something to do with the code (somehow the line gets outputted twice?) as it seems very odd for the handle to exist twice, without acad hanging on a nonresponding thread...but...

 

as my VL knowledge is limited and i never used ODBX... I'm unable to detect anything wrong there. Smiley Frustrated

You'll have to wait for DannyNL to determine what's wrong.

0 Likes
Message 24 of 29

DannyNL
Advisor
Advisor

Hi Richard,

 

That shouldn't be possible. As Roland and you already pointed out each handle is unique and shouldn't appear multiple times in the list. And as each block is only processed once per drawing it shouldn't happen.

 

Just a shot in the dark; did you remove the output CSV file before running your script?

If you have first tested my routine to see what output it generates and then run a script over all the drawings in the same folder, the blocks in the drawing(s) you tested with will show up twice. The routine will only create a new CSV file when there is no existing one in the folder of the drawing, but if there is it will only add lines to the existing one. So before running your script, you should make sure there is no existing CSV in the folder.

 

If this is not the case please let me know.

0 Likes
Message 25 of 29

Anonymous
Not applicable
Accepted solution

Hi Danny

 

You're right actually. The only drawing pull that had the duplicates was the first one in the list. T'is all fixed now. 

 

Thanks again for your help 🙂 

0 Likes
Message 26 of 29

DannyNL
Advisor
Advisor

Good to hear it's solved and works for you Smiley Happy

0 Likes
Message 27 of 29

Anonymous
Not applicable

Hello @DannyNL ,


Your lisp is very helpful, thank you!

However, I am facing the following problem, my coordinates are very large (millions) and as a result I get the following: 3.25323e + 07 5.70152e + 06
the real coordinates that properties give me are:
X: 32532310.55, Y: 5701503.153

Is there a way to solve it and export my whole coordinates?

 

Thank you for your time

0 Likes
Message 28 of 29

Anonymous
Not applicable

Good morning everyone

 

@DannyNL  Thank you very much for this lisp. It already helps a lot.

I have a small request though and I would be more than grateful if you could give me some assistance.

Apart from the block "handle id" some blocks that I have in a drawing contain attributes.

Is it possible to include the contents of the attribute tags and values in the csv file? The number of columns that are to be added to a block shall be equal to the number of attribute tags and values. If some values are not completed a "N/A" text shall be added in the relative csv cell.

 

Thank you in advance 

 

0 Likes
Message 29 of 29

foldkep
Community Visitor
Community Visitor
We facing a similar challange and the script is a great help. However in the CSV we get 123456.0 rounded coordinates altough the DWG contains 123456.123 format coordinates. Is there solution to get the real coords preferably in separate records?
Thanks.
0 Likes