I have a problem with ObjectIDs / handles.
In my drawing I have a dynamic block and a text which shows the attributes of that. To keep it up-to-date I added XDATA to the text, with the handle of the block. So I can update the text sometimes.
But when I copy (ACAD copy) both, the block and the text, I get a very big problem. The handle at the XDATA of the text is the same like before. But it should be the handle of the copy.
Is it possible to manage this?
Perhaps I can add an event-listener. But how do I get the oldID and the copyID of the block.
The copy-method, I mean is the one of AutoCAD (the user make the copy). I've never done this in .net before. But you can drive the
COPY command via the command line (http://discussion.autodesk.com/thread.jspa?threadID=467227).
But back to my question. Is it possible to make a connection between two entities in .net? I'm going forward do this with groups (both objects are in a group, and when i change one, I look in the group for the other object to change it too). But I think it's not the best solution.
I've thought about this a bunch in the past, because to make a callout whose text is, say, a northing or easting,
representing the end of the leader, you have to make the text "aware" of the leader. Same goes when labeling stations
and offsets of a home brew road alignment. The leader is not just one segement, but can be a bunch, meaning the text
can move in relation to teh leader "end".
Groups are pretty handy for this, but if you wblock stuff around, the groups get lost. We wblock stuff around like
balls in a clown's hands so that is an obstacle.
The thing about groups is they are automatically maintained when you do a copy command.
I thought about using xdata to teach the leader and text about eachother so they could "heal" themselves if confused.
I never came to a good answer though because you don't want a command reactor involved, anyone can mess that up by using
a session without "my tools". The mapcad folks did the leader callout thing using a custom object. But I hate custom
objects. I want a tool that can hook text and leader from any text and pline. I would still need a prog to do
something with that, like update a station or offset, but thats ok. Its just keeping the text and leaders in order
I'd sure like to know if a persistent reactor could be done for the text and leader, so they know to modify themselves
when copied. Not sure how persistent reactors get propogated though, and how stable that would be.
|>The copy-method, I mean is the one of AutoCAD (the user make the copy). I've never done this in .net before. But you can drive the
|>COPY command via the command line (http://discussion.autodesk.com/thread.jspa?threadID=467227).
|>But back to my question. Is it possible to make a connection between two entities in .net? I'm going forward do this with groups (both objects are in a group, and when i change one, I look in the group for the other object to change it too). But I think i
|>t's not the best solution.
Civil Engineer and Programmer
jmaeding - athunsaker - com
I did it with groups and I thought it woks quite good. But then I have seen your reply. I have never copied the group (copy/paste or with wblock) into a new drawing. Now I see the disaster. The groups get really lost!
I thought I can build a new copy command, but it's difficult to tell the draftsmen to use this instead of the normal command if they copy something with my groups.
So I agree that a quite good solution could be adding xdata to each object for selfhealing. But then I have to use event handlers to do this after inserting objects. But what's with the windows "copy/paste"?
I'm not glad about this - the source code gets more and more complex and the performance is not the best with all these event handlers.