Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: eliana on July 19, 2005, 04:25:15 am

Title: add-in an element
Post by: eliana on July 19, 2005, 04:25:15 am
Salve a tutti, ho un problema con l' Enterprise Architect e spero che qualcuno di voi ci sia già passato in modo da darmi un aiuto.
Devo aggiungere un elemento in un diagram ma per aggiungerlo ho bisogno di un ID da assegnarli. Il problema è che l' Id è univoco e dovrebbe essere creato automaticamente. In che modo posso dargli un ID univoco?
_________________________________________
Hi everybody
I have a question to pose you. I have to add a new element to a diagram by code, but to do this I need to give an Id to this new element. The problem is that the Id has to be unique and It should be created automatically. How can I give an Id to the element if I don't know it? ???
Sorry for my english  :P
Thank you
Eliana
Title: Re: add-in an element
Post by: sargasso on July 19, 2005, 03:57:48 pm
Eliana,

If you are using the EA automation model, the element insertion methods will add the ref GUID's automatically.

If you aren't ... you should be.

If you still aren't, as long as you generate a GUID that will not collide with any of the EA generated ones (insert weeks of work here) it appears to work.  (here's a tip - no guarantee though - replace the least variant part of the generated GUID with a string which identifies "you" - so far this has worked for me  :-X )

bruce
Title: Re: add-in an element
Post by: Rob_M on July 19, 2005, 04:42:25 pm
Perhaps use the VB or C# NewGuid function.

Check here

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemguidclassnewguidtopic.asp