×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How could I access a part of subass

How could I access a part of subass

How could I access a part of subass

(OP)
How could I access a part of subassembly from assembly document via VB?

RE: How could I access a part of subass

You can use the Occurrences object of Solid Edge, that represents a collection of Occurrence objects, here is an example of code, I hope that helps you


   Dim objApp As Object
   Dim objParts As SolidEdgeAssembly.Occurrences
   Dim objDoc As SolidEdgeAssembly.AssemblyDocument
   Dim objPart As SolidEdgeAssembly.Occurrence
   
   ' Connect to a running instance of Solid Edge.
   Set objApp = GetObject(, "SolidEdge.Application")
   
   If GetActive = True Then
      Set objDoc = objApp.ActiveDocument
   Else
      Set objDoc = ActiveDoc
   End If
   
   Set objParts = objDoc.Occurrences
   For Each objPart In objParts
      Dim FileName As String
      FileName = objPart.OccurrenceFileName
   Next

RE: How could I access a part of subass

Sorry, this code is for access to the part's of an assembly, to access to a part of a subassembly you can go through the objPart.OccurrenceDocument, and this is the Part of the document of the subassembly, so:

   Dim objApp As Object
   Dim objParts As SolidEdgeAssembly.Occurrences
   Dim objDoc As SolidEdgeAssembly.AssemblyDocument
   Dim objPart As SolidEdgeAssembly.Occurrence
   Dim objDocSubAss As SolidEdgeAssembly.AssemblyDocument
   Dim objPartsSubAss As SolidEdgeAssembly.Occurrences
   Dim objPartSubAss As SolidEdgeAssembly.Occurrence
   
   ' Connect to a running instance of Solid Edge.
   Set objApp = GetObject(, "SolidEdge.Application")
   
   If GetActive = True Then
      Set objDoc = objApp.ActiveDocument
   Else
      Set objDoc = ActiveDoc
   End If
   
   Set objParts = objDoc.Occurrences
   For Each objPart In objParts
      Set objDocSubAss   = objPart.OccurrenceDocument
      Set objPartsSubAss = objPartSubAss.Occurrences
      For Each objPartSubAss In objPartsSubAss

...

      Next
   Next

RE: How could I access a part of subass

(OP)
ailuJ,thanks for your help. I solved the problem with your instruction.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources