Reply

Correct occurence

[ Edited ]

Hello all, I need to compute reference from down to top. This mean for example:

User selects one of screws in assembly and I need to now which one.

Assembly structure can be like this: a

|-b

|  |-c          

|  |  |-screw

|  |  |-screw

|  |

|  |-c          

|    |-screw

|    |-screw

|

|-d

  |-b

    |-c          

    |  |-screw

    |  |-screw

    |

    |-c          

      |-screw

      |-screw 

So I have selected from user reference of screw. This reference has methods: Object            - occurence of screw

ImmediateParent   - occurence of c-subassembly (but not reference)

Parent            - occurence of c-subassembly (but not reference) "c" subassembly occurence give me only information which of "c" subassemblies it is in "b" subassembly but I don't know which of "b" occurences is parrent of selected screw. Could anybody give an idea how to find correct occurence? Thanks,

Best Regards,

Jara

 

Posted by: Jara Ctverak
Post date: 1/10/2010 10:37:40 PM

4 REPLIES

RE: Correct occurence

[ Edited ]

Hi Jara,

 

if you loop the structure from down to top with a reference, you have ImmediateParent as reference, only in toplevel is the ImmadiateParent an occurrence and not reference.

 

Best Regards

JR

 

 

Posted by: JR
Post date: 1/11/2010 12:53:43 AM

RE: Correct occurence

[ Edited ]

 

Jara,

I saw you were still asking in the SE newsgroup.

JR gave you the correct answer, and i made a little example for you. It's still VB6 but i hope it's enough.

Just open the a.asm file, select an screw and run the tree.exe app.

You will be able to know which is the "down to top" path and select any intermediate occurrence.

Regards,

Julian

 

 

Posted by: Julian Guillo
Post date: 1/11/2010 5:11:35 AM

RE: Correct occurence

[ Edited ]

Hello Julian, Thanks to both of you who answered my question I know little bit more how to compute reference. But I still have trouble that last reference I got is from first subaasembly and next immediate parent is occurence of first subassembly. For boolean of screw I need reference of crew in top assembly so i tried compute reference of last assembly level via .CreateReference but it doesn't work.       public SolidEdgeFramework.Reference getUpRefOfRef(

            SolidEdgeFramework.Reference refDoc, ref int assemLevelsCount)

    {     

      if (refDoc.Type != SolidEdgeFramework.ObjectType.igReference)

      {

        return refDoc;

      }

      else

      {

        SolidEdgeFramework.Reference upRefDoc = null;         try

        {

          upRefDoc =

            (SolidEdgeFramework.Reference)refDoc.ImmediateParent;

        }

        catch

        {

          SolidEdgeAssembly.Occurrence firstSubAssemOcc =

            (SolidEdgeAssembly.Occurrence)refDoc.ImmediateParent;           SolidEdgeAssembly.Occurrences occs =

            (SolidEdgeAssembly.Occurrences)firstSubAssemOcc.Parent;           SolidEdgeAssembly.AssemblyDocument topAssemDoc =

            (SolidEdgeAssembly.AssemblyDocument)occs.Parent;           refDoc = (SolidEdgeFramework.Reference)

            topAssemDoc.CreateReference(firstSubAssemOcc, refDoc);           assemLevelsCount++;           return refDoc;

        }         assemLevelsCount++;         return getUpRefOfRef(upRefDoc, ref assemLevelsCount);

      }

    }   Thanks for any advice.

Best Regards,

Jara

 

Posted by: Jara Ctverak
Post date: 1/19/2010 2:36:55 AM

RE: Correct occurence

[ Edited ]

Jara,

What is your objective?

Do you want to substract one of the screws to an existing part at first level in the main assembly?

Just to get an idea of what you want to achieve...

 

Posted by: Julian Guillo
Post date: 1/19/2010 3:25:36 AM