.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Handle ARRAY event

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
SRSDS
457 Views, 6 Replies

Handle ARRAY event

I have entities with xdata and who's handles are stored in the NOD.

When using ARRAY what events occur to allow me to accommodate the command?

db_ObjectAppended & db_DeepCloneEnded don't seem to be triggered.

 

6 REPLIES 6
Message 2 of 7
SRSDS
in reply to: SRSDS

Apologies.  db_ObjectAppended is being triggered.

 

In db_ObjectAppended how can I determine the objectID of the array being added?

It looks like when an array is created the original entity is deleted, a new entity replaces it.

I need to transfer xdata from the old to the new.

Message 3 of 7
ActivistInvestor
in reply to: SRSDS


@SRSDS wrote:

I have entities with xdata and who's handles are stored in the NOD.

When using ARRAY what events occur to allow me to accommodate the command?

db_ObjectAppended & db_DeepCloneEnded don't seem to be triggered.

 


That depends on what "accommodate the command" means. You'll need to expand on that.

 

It also depends on whether you're making an associative array or a 'dumb' array.

 

Message 4 of 7
SRSDS
in reply to: SRSDS

I'm using the ARRAY command, which looks to produce an associative array (although I'm not entirely sure what a dumb array is).

 

I'll try to simplify this by saying I am arraying a single entity.

 

When AutoCAD creates this array it looks to delete the original entity and produce an associative array replacement. 

I need to transfer the xdata from the original entity being deleted to it's replacement, but I'm not sure what the replacement is. Does the array have an objectID? 

And when the array is exploded I'm thinking I need to transfer the xdata a new set of entities.

 

And when I explode the block

I can see that 

Message 5 of 7
_gile
in reply to: SRSDS

The ARRAY command creates an "associative array", which is a special type of dynamic block.

This command first creates an anonymous block definition containing a deep clone of each selected object.

Then it creates a special type of dynamic block definition containing an array of block references of the newly created anonymous block.

Finally it inserted a block reference of the newly created dynamic block: the "associative array".

 

So, what you call "replacement" should be this block reference.

 

You should use some snoop tool to inspect the drawing database and entities such as MgdDbg or Inspector.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 6 of 7
ActivistInvestor
in reply to: SRSDS

The ARRAY command can produce both associative and non-associative (e.g., 'dumb') arrays.

 

@_gile thoroughly described what an associative array is, although what I will add/emphasize, is that when you make an associative array, regardless of how many instances of the arrayed object(s) you see in the drawing, there is only a single copy of it/them created, and that copy is inserted into an anonymous block, and it is that anonymous block that is inserted and copied (into another container anonymous block).  

 

A 'dumb' array is a non-associative array, which is just copies of the arrayed objects inserted directly into the drawing, and is how the ARRAY command worked before associative arrays were introduced.

 

When an object is copied/cloned, any XData it contains should also be copied. So, what is it that you want to do exactly, when an object with xdata is cloned? Do you want to modify the xdata in the cloned copy or something else?

Message 7 of 7
SRSDS
in reply to: SRSDS

Thank you both for the help again. Solved. Now I understand, and it was the first blockreference appended that I needed.

@ActivistInvestor You were right. The cloned entities within the dynamic block retain the XData but I needed to transfer that XData to the blockreference created by the array .

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report