Get PartList Content


Hi Jason,

       I want to get partlist content, do you know how to get it?

       Now I can get the content from the part's properties of partlist item, but if the draft disconnect with its parts, how I get the content?



Posted by: Jack Yan
Post date: 9/2/2007 5:53:09 PM


RE: Get PartList Content

Hi Jack and welcome to the forums.


Assuming that the current document in SE is a Draft document, you can get to the parts list like this:


Application -> ActiveDocument -> PartsLists


My Solid Edge Spy program will help you if you're not familiar with the object structure. I'm not exactly sure what you mean by if the draft is disconnected. Are you meaning that the referenced assembly is not available?


Posted by: Jason Newell
Post date: 9/3/2007 5:45:01 PM

RE: Get PartList Content


Yes, the assembly file cannot be found in the path.

My code as below:

Private Sub Command1_Click()

    Dim i As Integer, j As Integer

    Dim objPartList As PartsList

    Dim objModelNode As ModelNode

    Set ObjSheet = ObjDoc.ActiveSheet

    For i = 1 To ObjSheet.DrawingObjects.Count

        If TypeOf ObjSheet.DrawingObjects(i) Is PartsList Then

            Set objPartList = ObjSheet.DrawingObjects(i)

            Exit For

        End If


    If objPartList Is not Nothing Then

        ReDim Part(0)

        For i = 1 To objPartList.ModelLink.ModelNodes.Count

            Set objModelNode = objPartList.ModelLink.ModelNodes(i)

            If objModelNode.IncludeInPartsList And objModelNode.IsBallooned Then

                ReDim Preserve Part(UBound(Part) + 1)

                Part(UBound(Part)).ItemNo = objModelNode.ItemNumber

                Part(UBound(Part)).PartNo = GetPartNo(objModelNode.FileName)

            End If


    End If

End Sub

Function GetPartNo(FullFileName As String) As String

    Dim objPropSet As Object

    Dim objPropSets As Object

    Dim i As Integer


    On Error Resume Next

    Set objPropSets = CreateObject("SolidEdge.FileProperties")

    objPropSets.Open FullFileName

    Set objPropSet = objPropSets.Item("ProjectInformation")

    GetPartNo = Trim(objPropSet.Item("Document Number").Value)


    On Error GoTo 0

End Function

If the file of "FullFileName" cannot be found, how to get the part number of the file properties?



Posted by: Jack Yan
Post date: 9/3/2007 6:04:13 PM

RE: Get PartList Content



I don't think it's possible unless the referenced file is available because there is no information about the file embedded into the Draft other than it's path.


Posted by: Jason Newell
Post date: 9/3/2007 6:07:16 PM

RE: Get PartList Content


Jason, Ok. Thanks for your help. 


Posted by: Jack Yan
Post date: 9/3/2007 6:17:11 PM