Reply

How to create Reference of occurrence which Parent is occurrence?

[ Edited ]

 

Hi,

help me, how to create Reference (via method AssemblyDocument.CreateReference(occurrence,entity)) from occurrence, where parent of occurrence is occurrence (3. level of assembly)?

 

I create Reference (C#):

SolidEdgeFramework.Reference reference=SolidEdgeAssembly.CreateReference(((SolidEdgeAssembly.SubOccurrence)occurrence.Parent).ThisAsOccurrence, occurrence.ThisAsOccurrence);

It's ok. But if i use this reference to select suoccurrence (using method SelectSet.Add(reference)), occurs error.

Does anyone know how to create such Reference that can be used to selec suboccurrence?

Thanks.

 

Posted by: Juraj Joob
Post date: 1/12/2010 6:43:36 PM

5 REPLIES

RE: How to create Reference of occurrence which Parent is occurrence?

[ Edited ]

Hi Juraj,

 

Example in VB:

Private Function Get_Sub_Reference(ByRef objSub As SolidEdgeAssembly.SubOccurrence) As SolidEdgeFramework.Reference

Dim objParent1 As SolidEdgeAssembly.SubOccurrence

Dim objParent2 As SolidEdgeAssembly.Occurrence

Dim objOccu As SolidEdgeAssembly.Occurrence

Dim objRef1 As SolidEdgeFramework.Reference

 

objParent1 = objSub.Parent() 'is SubOccurrence 2. Level

objParent2 = objParent1.Parent 'is a Occurrence 1. Level

objOccu = objParent1.ThisAsOccurrence 'this must be, "make" it not in CreateRefernece(...

objRef1 = objParent2.OccurrenceDocument.CreateReference(objOccu, objSub.ThisAsOccurrence)

Get_Sub_Reference = objSub.TopLevelDocument.CreateReference(objParent2, objRef1)

 

End Function

 

The "Get_Sub_Reference" can be selected.

 

Regards

JR

 

Posted by: JR
Post date: 1/15/2010 1:51:53 AM

RE: How to create Reference of occurrence which Parent is occurrence?

[ Edited ]

Hi JR,

 

meanwhile, as i was on the forum a found out how to create reference to Suboccurrence for all levels of assembly.

 

Thanks.

 

Posted by: Juraj Joob
Post date: 1/18/2010 6:57:16 PM

RE: How to create Reference of occurrence which Parent is occurrence?

[ Edited ]

Hi JR,

 

meanwhile, as i was on the forum a found out how to create reference to Suboccurrence for all levels of assembly.

 

Thanks.

 

Posted by: Juraj Joob
Post date: 1/18/2010 6:57:18 PM

Re: RE: How to create Reference of occurrence which Parent is occurrence?

Hi,

I tried it.

I found this program can select all SubOccurrence in 3th level ,but how to select all SubOccurrence in 4th level?

Re: How to create Reference of occurrence which Parent is occurrence?

Hi Juraj,

 

I'm not sure if it's exactly what you are looking for, but if you take a look at the SEAssemblyRelationshipBrowser sample that is delivered in the custom samples folder, there is a function called GenerateOccurrencePathString. This function takes a face as an input and uses the GetOccurrencesInPath method on the reference to return an array of all suboccurrences from the top occurrence all the way down to the face.

 

Hope this helps,

Greg