Problem while getting the objects using "SelectSet" property.

 

I have an SolidEdge Assembly which is having an one more assembly in it .i.e assembly having a subassembly.

I am opening this assembly in Solidedge ST version application.

Then I am selecting some parts from MainAssembly and then some parts from its subassembly from path finder window , treeview.

Then , I am reading these selections  using "SelectSet" property  API on the main assembly

I am getting the currect  total count of selected part form SelectSet property 

But while reading and converting the objects in "SeletionSet', I am successful in converting the objects of main assembly parts  only and while converting the objects of parts which are selected from subassembly, program does not able to convert these objects in any type of Solidedge document type.

So, please give me the information about , how I can access these parts which are selected from the subassembly using 'SelectSet' API.

For reference ,Code  was written  as follows.

 

 

AssemblyDocument)objApp.ActiveDocument;Occurrence objOccur = null;for (int n = 1; n try

{

objOccur = (SolidEdgeAssembly.

 

}

 

{

 

}

 

}Occurrence)objSelection; //Gives error while loops for object of subassembly parts in main assembly.catch (Exception ex)throw ex;

objAsmDoc = (SolidEdgeAssembly.

objAsmOccurrences = objAsmDoc.Occurrences;

objSelectedSet = objAsmDoc.SelectSet;

SolidEdgeAssembly.

 

{

objSelection = objSelectedSet.Item(n);

 

 

Posted by: pratap thorat
Post date: 8/22/2010 2:59:31 AM

4 REPLIES

RE: Problem while getting the objects using "SelectSet" property.

Hi,

 

by selection the type of objects on the first level in an assembly are "Ocurrences", but from second level are the selected objects "References"

 

try for reference:

objOccur = (SolidEdgeAssembly.Occurrence)objSelection.object

 

 

 

Posted by: JR
Post date: 8/26/2010 2:35:53 AM

RE: Problem while getting the objects using "SelectSet" property.

Hi,

 

I have some preselected part in top assy or subassy or subassy in top assy or subassy.

how can i figure it out where am i ?

Of what typ (reference or occurence) selected object is ??

 

Thanks

Mariusz

 

 

Posted by: Mariusz Zamojski
Post date: 9/18/2011 3:26:01 AM

RE: Problem while getting the objects using "SelectSet" property.

Hi Mariusz,

 

when you want to know, where you are, you must go from Rerence to ParentReference and so on. If the TypeOf Parent is an Occurrence and no more Reference you are on the top level.

The type of selection you can get with "m

myObject.GetType()" or with

...

object myObject;

SolidEdgeFramework.Application objApp;

SolidEdgeFramework.SelectSet objSelSet;

objApp = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");

objSelSet = (SolidEdgeFramework.SelectSet)objApp.ActiveSelectSet;

myObject = objSelSet.Item(1);

if (myObject is SolidEdgeFramework.Reference)

{

...;

}

if (myObject is SolidEdgeAssembly.Occurrence)

{

...;

}

 

in VB:

...

if TypeOf myObject is SolidEdgeAssembly.Occurrence then

...

 

 

 

 

Posted by: JR
Post date: 9/18/2011 8:03:28 PM

RE: Problem while getting the objects using "SelectSet" property.

I have this subrutine in VB.net maybe it can help you for what you want to do or at least get an idea.

 

Sergio

 

Dim objApp As SolidEdgeFramework.Application = Nothing

Dim objAssy As SolidEdgeAssembly.AssemblyDocument = Nothing

Dim objSelectSet As SolidEdgeFramework.SelectSet = Nothing

Dim objOccurrance As SolidEdgeAssembly.Occurrence = Nothing

Try

objApp = Marshal.GetActiveObject("SolidEdge.Application")

objAssy = objApp.ActiveDocument

' SE user must select a part in thhe assembly

objSelectSet = objApp.ActiveSelectSet

objOccurrance = objSelectSet.Item(1)

' now the occurrance is transferred from SE path finder over to your program

' then you do what ever you need to do with that occurrance

Catch ex As Exception

 

Finally

'Release all your objects

 

End Try

 

 

 

 

Posted by: Sergio Vallejo
Post date: 9/19/2011 3:26:51 AM