Link drawing to external data

Link drawing to external data

Anonymous
Not applicable
377 Views
4 Replies
Message 1 of 5

Link drawing to external data

Anonymous
Not applicable

Please excuse my newby language in trying to describe my problem. I searched for a solution and could not find it, maybe because I don't have the necessary "lingo" of the field. But hopefully you can point me in the right direction as I do hope that what I want to do is commonly done.

Say I have an AutoCAD drawing with lots of irregular shape hatch areas assigned to various layers. 
I also have an Excel sheet with information that should be mapped to those hatched areas. Say one of the columns is "type" and based on that type I should place the hatch in a given layer in the drawing.

So what I am after is some guidance on how to go about:
- assigning some unique ID to the hatch (or accessing it if it automatically gets one on creation)
- export a list of hatches with their ID and current layer
- link (programatically?) the drawing to the Excel file so that on update the hatch moves to the layer commanded by the type specified in the layer

While searching for answers on my own I noticed that one can define blocks with attributes. That does not seem to be applicable here as I don't have reusable components (my understanding of blocks) but rather unique objects. 

0 Likes
378 Views
4 Replies
Replies (4)
Message 2 of 5

natasha.l
Alumni
Alumni

Hello @Anonymous, 

 

Sorry. There is no hatch tool or feature for that kind of workflow. Its a great idea. 

 

 

 

 

0 Likes
Message 3 of 5

Anonymous
Not applicable

Looking around in the tool I found that I can attach something called XData to my hatch and then list it.
So I can use the int field to assign an ID and even store the layer in there (optional). 

Command: xdlist
Select object:
Enter application name <*>: Test
* Registered Application Name: TEST
* Code 1002, Starting or ending brace: {
* Code 1070, 16-bit integer: 32000
* Code 1003, Layer name: Test
* Code 1002, Starting or ending brace: }
Object has 16330 bytes of Xdata space available.


Am I wrong to asume that I should now be able to iterate all objects that have XData in the drawing, using LISP, and move them to the desired layer?

0 Likes
Message 4 of 5

Anonymous
Not applicable

Hmm, maybe I don't even need that since I can fetch entity's name as an ID using entnext & co...

0 Likes
Message 5 of 5

JTBWorld
Advisor
Advisor

It can certainly be done with programming and if you would need help feel free to contact me.


Jimmy Bergmark
JTB World - Software development and consulting for CAD and license usage reports
https://jtbworld.com