Reply

Reading component properties from Assembly level.

[ Edited ]

I am working with a macro to list a single parts property. I was able to get the properties from within the part. My question is how to do this from the assembly level. Either is a top level part or a part / sheet metal within a sub-assembly. Like part 2 or 3

Eg… Top – Level Assembly

|

Part / Sub-Assy

|

Part2 / Part3 / etc..

I have tried the [u]select case[/u] example from the programming guide but I am not doing something correctly. Thanks for pointing me in the right direction.

Jason

 

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 
    End Sub

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim objApp As SolidEdgeFramework.Application
        Dim objDoc As SolidEdgePart.PartDocument
        Dim objPropertySets As SolidEdgeFramework.PropertySets
        Dim objProperties As SolidEdgeFramework.Properties

        Dim objProperty As SolidEdgeFramework.Property
        Dim icount As Integer
        Dim jcount As Integer
        Dim PropValue As String
        '
        ' Clear the List Box...
        ListBox1.Items.Clear()
        '
        ' Attach to the current Solid Edge Document (Part file...)
        '
        objApp = GetObject(, "SolidEdge.Application")
        objDoc = objApp.ActiveDocument
        '

        'For each Property Set in the document, list all the properties in the list box form..
        '
        objPropertySets = objDoc.Properties
        '
        'Loop through the property sets..
        '
        For icount = 1 To objPropertySets.Count
            objProperties = objPropertySets.Item(icount)
            '
            'Loop through each property in the current set..
            '
            For jcount = 1 To objProperties.Count
                objProperty = objProperties.Item(jcount)
                PropValue = objProperty.Value
                ListBox1.Items.Add(objProperties.Name + " " + objProperties.Name + "= " + PropValue)
            Next
        Next
        '
        objDoc = Nothing

        objApp = Nothing
    End Sub

 

Posted by: Jason Smith
Post date: 10/2/2012 11:22:15 AM

1 REPLY

Reading component properties from Assembly level.

[ Edited ]

I might didn't get what you want correctly, however you can get the summeryInfo for each son of the asm.

Running on sub elements of asm with the Occurrences (in C# but it will be the same in VB):

if (currDocument.Type == DocumentTypeConstants.igAssemblyDocument)
{
  SolidEdgeAssembly.AssemblyDocument assemblyDocument = (SolidEdgeAssembly.AssemblyDocument)currDocument;
  // Get a reference to the occurrences collection
  SolidEdgeAssembly.Occurrences occurrences = assemblyDocument.Occurrences;
  foreach (SolidEdgeAssembly.Occurrence occurrence in occurrences)
  {
    SolidEdgeFramework.SolidEdgeDocument sonDocument = (SolidEdgeFramework.SolidEdgeDocument)occurrence;
    sonDocument.SummaryInfo  //the summary information which contains the author etc'
  }            

 

Posted by: joseph polk
Post date: 10/2/2012 1:14:52 PM