.NET

Reply
Contributor
mabe2k11
Posts: 24
Registered: ‎03-14-2006
Message 1 of 8 (262 Views)

Copy entity - new ObjectId / Handle?

262 Views, 7 Replies
05-04-2006 09:55 AM
Hello!

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.

Thank you.
Distinguished Contributor
Alexander Rivilis
Posts: 303
Registered: ‎09-26-2004
Message 2 of 8 (262 Views)

Re: Copy entity - new ObjectId / Handle?

05-04-2006 10:37 AM in reply to: mabe2k11
I think this can be done with help of reactor: AcDbObjectReactor::copied(const AcDbObject* oldObj,const AcDbObject* newObj);
Contributor
mabe2k11
Posts: 24
Registered: ‎03-14-2006
Message 3 of 8 (262 Views)

Re: Copy entity - new ObjectId / Handle?

05-04-2006 01:35 PM in reply to: mabe2k11
Is there a dotnet-EventHandler for AcDbObjectReactor::copied(...)?
Distinguished Contributor
Alexander Rivilis
Posts: 303
Registered: ‎09-26-2004
Message 4 of 8 (262 Views)

Re: Copy entity - new ObjectId / Handle?

05-04-2006 01:45 PM in reply to: mabe2k11
Oops. IMHO, answer is NO - because ObjectARX .NET can not produce custom object... :smileysad: You must do it with help of native ObjectARX.
Contributor
simonkx
Posts: 20
Registered: ‎12-29-2005
Message 5 of 8 (262 Views)

Re: Copy entity - new ObjectId / Handle?

05-05-2006 06:07 AM in reply to: mabe2k11
Hi,
I want to know how to copy an entity with C#,and can you show me some examples?
Thanks
Contributor
mabe2k11
Posts: 24
Registered: ‎03-14-2006
Message 6 of 8 (262 Views)

Re: Copy entity - new ObjectId / Handle?

05-05-2006 12:22 PM in reply to: mabe2k11
Hi!

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.
*James Maeding
Message 7 of 8 (262 Views)

Re: Copy entity - new ObjectId / Handle?

05-09-2006 08:33 AM in reply to: mabe2k11
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
thats tricky.

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.

mabe2k <>
|>Hi!
|>
|>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.
James Maeding
Civil Engineer and Programmer
jmaeding - athunsaker - com
Contributor
mabe2k11
Posts: 24
Registered: ‎03-14-2006
Message 8 of 8 (262 Views)

Re: Copy entity - new ObjectId / Handle?

05-11-2006 11:04 AM in reply to: mabe2k11
Hi!

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.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community