How to get active "in edit" component ?

 

Hello to all!

Does anybody know if it's possible to get edited in place component in the assembly?

For example, a user has a simple assembly with one simple component.

The user call the command "Edit " from the context menu  for the component.

The component  becomes acive and we can edit it in the context of the assembly.

 

So, In that situation Is it possible to get the information via API that the current opened ( not active!!! [active doc is part] ) document  is assembly ?( And get pointer to it )

I also need to get  the pointer to the activated component (probably as Occurrence or as Reference object)

From the API reference I haven't found we way how to get that information. 

 

Thanks.

 

Posted by: Sergey Sergeenko
Post date: 7/20/2010 4:37:00 AM

11 REPLIES

RE: How to get active "in edit" component ?

SEApp.ActiveDocument as SolidEdgeFramework.SolidEdgeDocument;

 

Posted by: fat kids
Post date: 7/20/2010 4:47:05 PM

RE: How to get active "in edit" component ?

In that situation App.ActiveDocument returns PartDocument( Document of a component ).

But I need to get somehow the document of my assembly ( top-level opened document or at least one level up document )

 

Posted by: Sergey Sergeenko
Post date: 7/20/2010 8:30:32 PM

RE: How to get active "in edit" component ?

you want get the "Edit "'s parent?

 

Posted by: fat kids
Post date: 7/20/2010 10:11:15 PM

RE: How to get active "in edit" component ?

Yes

I want to get what component is 'in edit' and the parent of that component

 

Posted by: Sergey Sergeenko
Post date: 7/20/2010 10:26:26 PM

RE: How to get active "in edit" component ?

 

You can return to the assembly , and then find the "edit"'s part through name in this assembly, then find his parent assembly.

 

Posted by: fat kids
Post date: 7/21/2010 5:07:44 AM

RE: How to get active "in edit" component ?

See PartDocument.GetContainerDocumentAndMatrixOfIPADoc in the SE SDK help.

I think this is what you are looking for.

 

Posted by: Julian Guillo
Post date: 7/21/2010 6:04:58 AM

RE: How to get active "in edit" component ?

Julian Guillo

Your way has helped me. That method returns the direct owner of my part(the assembly). Thanks.

 

Probably you also know how to identify the component that is "in edit" ? It could be possible that in the assembly there are more than one similiar parts. Of course I can get all occurrences of the assembly and compare Documents pointers and transformation Matrixes. But probably there is better way..

 

Posted by: Sergey Sergeenko
Post date: 7/21/2010 10:00:45 PM

RE: How to get active "in edit" component ?

Hi Sergey,

Normally, the document that is "in place activated" should be the active one in your SE session.

So, as someone else told you, this should give you the document: (SEApp.ActiveDocument)

If it is not the active one, you can loop through the opened documents and check the "InPlaceActivated" property:

For i=1 to SEApp.Documents.Count

if SEApp.Documents.Item(i).InPlaceActivated then

oMyDoc=SEApp.Documents.Item(i)

exit for

endif

next

 

Regards,

Julian

 

Posted by: Julian Guillo
Post date: 7/21/2010 11:01:52 PM

RE: How to get active "in edit" component ?

 

Julian,

 

I agree with you. To get Document object I call App->ActiveDocument.

But it is not enough for me. I need to get the object that describes the instance of that Document in the Assembly - Occurrence, SubOccurrence or something else. The PartDocument interface does not have such information and It mustn't...

 

Thanks

 

Posted by: Sergey Sergeenko
Post date: 7/22/2010 4:42:29 AM