Jump to content

Recommended Posts

Posted

Hi everyone,

 

I am trying to name/identify a AcDbLine object in the drawing (a AutoCAD line draws by the user). I found his objectID or handle properties but the problem is that if the user makes a cut/copy-past of the object then his objectID and his handle properties change.

 

How can I identify a object? Shall I use getxdata to store his name? Or selectionsets, dictionary, groups…

 

Thank you for your help and excuse my english

Posted

If you copy any object well then it has a new unique identity the old line will still have the correct handle ID the only way is do you really need to identify the new object if so you must start to look at some form of controlling user input via menu's or your created commands.

 

I know of one company that turned off commands like Line etc so you had to use the company standards

Posted

Thanks for the answer. Even if I control the user input, how can I iterate to find my object ? How can I name it ?

 

The problem is also that the objectID changes when you save the file, close and reopen it !

 

Thank you for your time

Posted

Even if I control the user input, how can I iterate to find my object ? How can I name it ?

 

The problem is also that the objectID changes when you save the file, close and reopen it !

 

To persistently 'track' an Object you'd need to store some persistent identification criteria, such as custom Dictionary, etc.

 

The first challenge is identifying the source entity, and then tracking it through user manipulation (i.e., PEDIT, Copy, etc.)... The second is storing the 'current' status prior to SAVE/CLOSE so that your code can 'pick up where it left off' so-to-speak.

 

To the former, you need to decide how you want to store your persistent identification criteria... Perhaps storing per-entity XData, etc., and implement the appropriate mechanism to do so, most likely when IExtensionApplication.Initialize() is called (assuming this is a plug-in). The other side of this, is how to keep it up-to-date, and specific to your question how to 'find' it when you need it. By storing your identifying criteria to the entity, rather than storing some entity-specific data to a custom Dictionary (within the NOD [Named Object Dictionary], etc.), you can easily pass it onto resultant entities from user manipulation. As for getting it when you want it, you might consider storing the Object(s) to a private Field as List, etc..

 

[Edit] ... Next aspect is implementing per-Document data, to account for MDI.

 

To the latter, methinks storing custom XData, etc. rather than storing to NOD, however, you need to use what works best for your situation... I may not have all of the relevant information to suggest the best solution for your needs.

 

HTH (Hope This Helps)

Posted

All right thanks. I will use the handle object proprety.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...