Tuesday, February 07, 2012
How to get active "in edit" component ?
Last Post 22 Jul 2010 11:32 AM by Julian Guillo. 11 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
SergeyUser is Offline
New Member
New Member
Posts:19

--
20 Jul 2010 09:37 AM  

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.

fatkidsUser is Offline
New Member
New Member
Posts:53

--
20 Jul 2010 09:47 PM  
SEApp.ActiveDocument as SolidEdgeFramework.SolidEdgeDocument;
SergeyUser is Offline
New Member
New Member
Posts:19

--
21 Jul 2010 01:30 AM  
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 )
fatkidsUser is Offline
New Member
New Member
Posts:53

--
21 Jul 2010 03:11 AM  
you want get the "Edit "'s parent?
SergeyUser is Offline
New Member
New Member
Posts:19

--
21 Jul 2010 03:26 AM  
Yes
I want to get what component is 'in edit' and the parent of that component
fatkidsUser is Offline
New Member
New Member
Posts:53

--
21 Jul 2010 10:07 AM  

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

Julian GuilloUser is Offline
Guru
Basic Member
Basic Member
Posts:125

--
21 Jul 2010 11:04 AM  
See PartDocument.GetContainerDocumentAndMatrixOfIPADoc in the SE SDK help.
I think this is what you are looking for.
SergeyUser is Offline
New Member
New Member
Posts:19

--
22 Jul 2010 03:00 AM  
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..
Julian GuilloUser is Offline
Guru
Basic Member
Basic Member
Posts:125

--
22 Jul 2010 04:01 AM  
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
SergeyUser is Offline
New Member
New Member
Posts:19

--
22 Jul 2010 09:42 AM  

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

Julian GuilloUser is Offline
Guru
Basic Member
Basic Member
Posts:125

--
22 Jul 2010 11:20 AM  
AFAIK that information is not exposed in the API.
Julian GuilloUser is Offline
Guru
Basic Member
Basic Member
Posts:125

--
22 Jul 2010 11:32 AM  
Oh, one idea more.
With the method GetContainerDocumentAndMatrixOfIPADoc you get an orientation matrix that should be a simple array of values type Double.
In the Occurrence and SubOccurrence you can call GetMatrix and get the orientation matrix as well.
You could do a loop that goes through Occurrences and SubOccurrences and then:
- Get the Occurences matching your part filename (compare with OccurrenceFileName or SunbOccurrenceFileName)
- Obtain the matrix of those Occurrences and SubOccurrences with GetMatrix method
- Compare the Occurrence matrix with the one you got before with GetContainerDocumentAndMatrixOfIPADoc.

The result should be unique unless you have the same part placed several times in your assembly just in the same place.(which is a very uncommon situation)
This way you obtain the Occurrence or suboccurrence corresponding to the In place activated part
Never surrender ;)
Julian
You are not authorized to post a reply.

Active Forums 4.2
Copyright © 2011 JasonNewell.NET