Extract object data from another drawing in the project

Extract object data from another drawing in the project

eduardoalvarezc
Contributor Contributor
426 Views
5 Replies
Message 1 of 6

Extract object data from another drawing in the project

eduardoalvarezc
Contributor
Contributor

Hi Alls!!

 

I need some help here.

 

I am working with an autocad project of around 20 drawing. I'm writing a lisp routine that extract both end interconections (tag name and pins names "TERM0x atrribute" of the component) of specifics wires around the project. These wire are connected to the  childrens of a parent block that always is in another drawing. There are a lot of childrens (around 10 in some cases) in the whole project.

 

The idea is, knowing the TAG of the parent make a search of the children in the project, get the wires connected to the children and the pins names of both end of the wire.

 

I have the lisp routine that extract the desired data of the specific wire. But autolisp work in the active drawing and I dont know how to run autolisp code to get object data from another drawing. 

I dont know how to use vl, vla, vlax function because I am a beginner user of autolisp.

 

Autolisp have some function that extrac children data from a parent block TAG. For example the c:wd_comp_ref_list extract the XREF of all block in the project given the TAG. By using this command I can get the children XREF, Handle, Drawing Number, File of every children in the project. Ho autolisp can do this? This mean that I can access database project to get the data obkect I need??

 

Maybe I need to run a script to get the data I need?? Or, can I do this by mean of vla functions??

 

I know that I need to study vlisp, activex . But I need some help to get the best way to do this.

 

Thanks in advance.

 

0 Likes
427 Views
5 Replies
Replies (5)
Message 2 of 6

Ed__Jobe
Mentor
Mentor

Hello @eduardoalvarezc  I moved your post to the lisp forum since your request is more related to programming. For doing a search in other drawings, you could search this forum for ObjectArx and AxDbDocument. This api opens a file in memory and you can iterate modelspace to search for wires.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 6

eduardoalvarezc
Contributor
Contributor

Hello Ed!

 

Nice, I need to learn something about ObjectArx. In the mean time, can some post some example about getting some attribute value of block witha soecific TAG in another drawing??

 

This can be very helpful to me!

Thanks

0 Likes
Message 4 of 6

Ed__Jobe
Mentor
Mentor

You would use the GetAttributes method and iterate the attributes collection. That link has a lisp sample. Search this forum for GetAttributes for more samples. This post is an example.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 5 of 6

Sea-Haven
Mentor
Mentor

Look at www.Lee-mac.com OBDX examples. It is referred to here very often as well put together code.

 

"getting some attribute value of block with a specific TAG in another drawing??" the only problem is does the block exist more than once in the second dwg, if so will get multiples of that block, so may need a second tag to check is correct set of attributes, else look in next block for match.

 

Hmm, Google, getting some attribute value of block with a specific TAG in another drawing Autocad lisp

0 Likes
Message 6 of 6

eduardoalvarezc
Contributor
Contributor

Hi Sea-Heaven, thank for take time for answer me.

 


@Sea-Haven wrote:

Look at www.Lee-mac.com OBDX examples. It is referred to here very often as well put together code.

 

"getting some attribute value of block with a specific TAG in another drawing??" the only problem is does the block exist more than once in the second dwg, if so will get multiples of that block, so may need a second tag to check is correct set of attributes, else look in next block for match.

Yeah, The block may exist several times in another drawing. I was thinking to check this using the pin connection that are unique in every block and match with parent block.

 

 

 

0 Likes