Tuesday, February 07, 2012
Problem while getting the objects using "SelectSet" property.
Last Post 19 Sep 2011 08:26 AM by SHV. 4 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
pthoratUser is Offline
New Member
New Member
Posts:3

--
22 Aug 2010 07:59 AM  

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 <= objSelectedSet.Count; 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);

 

JRUser is Offline
New Member
New Member
Posts:91

--
26 Aug 2010 07:35 AM  
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

IBZUser is Offline
New Member
New Member
Posts:5

--
18 Sep 2011 08:26 AM  
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
JRUser is Offline
New Member
New Member
Posts:91

--
19 Sep 2011 01:03 AM  
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
...


SHVUser is Offline
New Member
New Member
Posts:13

--
19 Sep 2011 08:26 AM  
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


You are not authorized to post a reply.

Active Forums 4.2
Copyright © 2011 JasonNewell.NET