[TS6] Reading the references and IProperties of an Assembly. BOM?

All topics about specific development with COM interface, LIP language, API in VB, ...

Moderators: remi77, Daniel, jacs

Post Reply
GSus42
Private First Class
Private First Class
Posts: 12
Joined: Wed Jul 06, 2016 2:32 pm
TopSolid Version: 7.7
Location: Germany

[TS6] Reading the references and IProperties of an Assembly. BOM?

Post by GSus42 » Tue Jul 19, 2016 1:11 pm

Hello,

I would like to iterate through a TS6-document(*.top especially, *.dft would also be nice) and print out all sub-references to any sub-assemblies/-parts, and to each sub-part/-assembly I would like to read the IProperties.
I thought that is, what a BOM is. But it seems the BOM is constructed out of all shapes?!


I tried to use the "Getting a BOM"-Example from the API-Online-Doc, but could not yet manage to get any sensible information out of it.
I can count the shapes. But they don't seem to have a sensible toString-Method implemented that returns more than "System-COMObject" for all Objects.

Or do I try it wrong? Do I have to give some static method some IDs from the sublevels to get information/IProperties from them?

GSus42
Private First Class
Private First Class
Posts: 12
Joined: Wed Jul 06, 2016 2:32 pm
TopSolid Version: 7.7
Location: Germany

Re: [TS6] Reading the references and IProperties of an Assembly. BOM?

Post by GSus42 » Wed Jul 20, 2016 12:19 pm

Ok, it seems like I found something.
The GetAllStructure-Method of the IBOM-Interface "returns"(it does actually modify 6 Parameters-Objects and insert the values into them) some Lists of IDs(Integer) and Strings.

I still can't fully make sense of it yet, but at least the Designations and Properties seem to have some sensible information, when I use the top.bom-BOMModel (in C:\Missler\V616\bin\top.bom)
But all References are empty, but some properties include file-References.

ATM I use this method:

Code: Select all

Private Sub PrintGetAllStructure(topBom As TopSolid.IBOM)
        textBox.AppendText("PrintGetAllStructure" + vbNewLine)
        'Sub GetAllStructure(ByRef ElementList As Object, ByRef LevelList As Object, ByRef DesignationList As Object, ByRef ReferenceList As Object, ByRef ElementCountList As Object, ByRef PropertiesList As Object)
        Dim ElementList As Object = Nothing
        Dim LevelList As Object = Nothing
        Dim DesignationList As Object = Nothing
        Dim ReferenceList As Object = Nothing
        Dim ElementCountList As Object = Nothing
        Dim PropertiesList As Object = Nothing

        topBom.GetAllStructure(ElementList, LevelList, DesignationList, ReferenceList, ElementCountList, PropertiesList)

        textBox.AppendText("ElementList.ToString():" + ElementList.ToString() + vbNewLine)
        For Each elem As Object In ElementList
            textBox.AppendText("Element:" + elem.ToString() + vbTab)
        Next elem
        textBox.AppendText(vbNewLine)

        textBox.AppendText("LevelList.ToString():" + LevelList.ToString() + vbNewLine)
        For Each level As Object In LevelList
            textBox.AppendText("Level:" + level.ToString() + vbTab)
        Next level
        textBox.AppendText(vbNewLine)

        textBox.AppendText("DesignationList.ToString():" + DesignationList.ToString() + vbNewLine)
        For Each designation As Object In DesignationList
            textBox.AppendText("Designation:" + designation.ToString() + vbTab)
        Next designation
        textBox.AppendText(vbNewLine)

        textBox.AppendText("ReferenceList.ToString():" + ReferenceList.ToString() + vbNewLine)
        For Each ref As Object In ReferenceList
            textBox.AppendText("Reference:" + ref.ToString() + vbTab)
        Next ref
        textBox.AppendText(vbNewLine)

        textBox.AppendText("ElementCountList.ToString():" + ElementCountList.ToString() + vbNewLine)
        For Each elemCount As Object In ElementCountList
            textBox.AppendText("ElementCount:" + elemCount.ToString() + vbTab)
        Next elemCount
        textBox.AppendText(vbNewLine)

        textBox.AppendText("PropertiesList.ToString():" + PropertiesList.ToString() + vbNewLine)
        For Each strProp As Object In PropertiesList
            textBox.AppendText("Property:" + strProp.ToString() + vbTab)
        Next strProp
        textBox.AppendText(vbNewLine)
    End Sub
The Designations of the example StepperLuxePartialExploded.top then are these:

Code: Select all

Designation:ENSEMBLE Pied Stepper	Designation:Tube Pied	Designation:Tube Central	Designation:Tube Arrière	Designation:Axe Verin	Designation:Axe Appui Chaussure	Designation:Support Pied Avant	Designation:Support Pied Arrière	Designation:Support Pied Arrière	Designation:Biellette	Designation:Noyau	Designation:Noyau	Designation:Bouchon	Designation:Bouchon	Designation:Cale	Designation:Cale	Designation:ENSEMBLE Appui Chaussure	Designation:Appui Chaussure	Designation:vis C HC M5-30	Designation:Tube Appui Chaussure	Designation:Attache Tige	Designation:Axe Appui Chaussure	Designation:vis F X M4-10	Designation:vis F X M4-10	Designation:vis F X M4-10	Designation:vis F X M4-10	Designation:Attache	Designation:Attache	Designation:ENSEMBLE Appui Chaussure	Designation:Appui Chaussure	Designation:vis C HC M5-30	Designation:Tube Appui Chaussure	Designation:Attache Tige	Designation:Axe Appui Chaussure	Designation:vis F X M4-10	Designation:vis F X M4-10	Designation:vis F X M4-10	Designation:vis F X M4-10	Designation:Attache	Designation:Attache	Designation:ENSEMBLE Système Amortissement	Designation:ENSEMBLE Tige Amortisseur	Designation:Tige Amortisseur	Designation:anneau élastique extérieur 10×1	Designation:Axe Tige	Designation:anneau élastique extérieur 10×1	Designation:Corps Amortisseur	Designation:ENSEMBLE Système Amortissement	Designation:ENSEMBLE Tige Amortisseur	Designation:Tige Amortisseur	Designation:anneau élastique extérieur 10×1	Designation:Axe Tige	Designation:anneau élastique extérieur 10×1	Designation:Corps Amortisseur	Designation:ORDINATEUR	
And the Properties are these:

Code: Select all

Property:TYPE_SA;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\ENSEMBLE PIED STEPPER.top;;TopSolidProjects;;;;1;ENSEMBLE Pied Stepper;;;;(modified);;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\ENSEMBLE PIED STEPPER.top;;;;;;1;    Tube Pied;;aluminum;;;;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\ENSEMBLE PIED STEPPER.top;;;;;;1;    Tube Central;;aluminum;;;;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\ENSEMBLE PIED STEPPER.top;;;;;;1;    Tube Arrière;;aluminum;;;;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\ENSEMBLE PIED STEPPER.top;;;;;;1;    Axe Verin;;steel;;;;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\ENSEMBLE PIED STEPPER.top;;;;;;1;    Axe Appui Chaussure;;steel;chrome plated;;;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\ENSEMBLE PIED STEPPER.top;;;;;;1;    Support Pied Avant;;polyvinyle chloride (rigid) PVC U;glossy orange paint;(modified);;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\ENSEMBLE PIED STEPPER.top;;;;;;1;    Support Pied Arrière;;polyvinyle chloride (rigid) PVC U;glossy orange paint;;;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\ENSEMBLE PIED STEPPER.top;;;;;;1;    Support Pied Arrière;;polyvinyle chloride (rigid) PVC U;glossy orange paint;;;;;;;;;;;	Property:TYPE_SA;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\BIELLETTE.top;;TopSolidProjects;;;;1;Biellette;;;chrome plated;;;;;;;;;;;	Property:TYPE_SA;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\NOYAU.top;;TopSolidProjects;;;;1;Noyau;;steel;chrome plated;;;;;;;;;;;	Property:TYPE_SA;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\NOYAU.top;;TopSolidProjects;;;;1;Noyau;;steel;chrome plated;;;;;;;;;;;	Property:TYPE_SA;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\BOUCHON.top;;TopSolidProjects;;;;1;Bouchon;;polyvinyle chloride (rigid) PVC U;;;;;;;;;;;;	Property:TYPE_SA;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\BOUCHON.top;;TopSolidProjects;;;;1;Bouchon;;polyvinyle chloride (rigid) PVC U;;;;;;;;;;;;	Property:TYPE_SA;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\CALE.top;;TopSolidProjects;;;;1;Cale;;polyvinyle chloride (rigid) PVC U;;;;;;;;;;;;	Property:TYPE_SA;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\CALE.top;;TopSolidProjects;;;;1;Cale;;polyvinyle chloride (rigid) PVC U;;;;;;;;;;;;	Property:TYPE_SA;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\APPUI CHAUSSURE.top;;TopSolidProjects;;;;1;ENSEMBLE Appui Chaussure;;;;(modified);;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\APPUI CHAUSSURE.top;;;;;;1;    Appui Chaussure;;polyvinyle chloride (rigid) PVC U;;;;;;;;;;;;	Property:TYPE_STD;$STD=AFNOR\fastener\screw#V=25125#I=02#R=NR.top;AFNOR;fastener;screw;25125;02;1;    vis C HC M5-30;;steel;;;;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\APPUI CHAUSSURE.top;;;;;;1;    Tube Appui Chaussure;;steel;;;;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\APPUI CHAUSSURE.top;;;;;;1;    Attache Tige;;steel;;;;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\APPUI CHAUSSURE.top;;;;;;1;    Axe Appui Chaussure;;steel;;;;;;;;;;;;	Property:TYPE_STD;$STD=AFNOR\fastener\screw#V=25107#I=02#R=NR.top;AFNOR;fastener;screw;25107;02;1;    vis F X M4-10;;steel;;;;;;;;;;;;	Property:TYPE_STD;$STD=AFNOR\fastener\screw#V=25107#I=02#R=NR.top;AFNOR;fastener;screw;25107;02;1;    vis F X M4-10;;steel;;;;;;;;;;;;	Property:TYPE_STD;$STD=AFNOR\fastener\screw#V=25107#I=02#R=NR.top;AFNOR;fastener;screw;25107;02;1;    vis F X M4-10;;steel;;;;;;;;;;;;	Property:TYPE_STD;$STD=AFNOR\fastener\screw#V=25107#I=02#R=NR.top;AFNOR;fastener;screw;25107;02;1;    vis F X M4-10;;steel;;;;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\APPUI CHAUSSURE.top;;;;;;1;    Attache;;steel;;(modified);;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\APPUI CHAUSSURE.top;;;;;;1;    Attache;;steel;;(modified);;;;;;;;;;	Property:TYPE_SA;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\APPUI CHAUSSURE.top;;TopSolidProjects;;;;1;ENSEMBLE Appui Chaussure;;;;(modified);;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\APPUI CHAUSSURE.top;;;;;;1;    Appui Chaussure;;polyvinyle chloride (rigid) PVC U;;;;;;;;;;;;	Property:TYPE_STD;$STD=AFNOR\fastener\screw#V=25125#I=02#R=NR.top;AFNOR;fastener;screw;25125;02;1;    vis C HC M5-30;;steel;;;;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\APPUI CHAUSSURE.top;;;;;;1;    Tube Appui Chaussure;;steel;;;;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\APPUI CHAUSSURE.top;;;;;;1;    Attache Tige;;steel;;;;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\APPUI CHAUSSURE.top;;;;;;1;    Axe Appui Chaussure;;steel;;;;;;;;;;;;	Property:TYPE_STD;$STD=AFNOR\fastener\screw#V=25107#I=02#R=NR.top;AFNOR;fastener;screw;25107;02;1;    vis F X M4-10;;steel;;;;;;;;;;;;	Property:TYPE_STD;$STD=AFNOR\fastener\screw#V=25107#I=02#R=NR.top;AFNOR;fastener;screw;25107;02;1;    vis F X M4-10;;steel;;;;;;;;;;;;	Property:TYPE_STD;$STD=AFNOR\fastener\screw#V=25107#I=02#R=NR.top;AFNOR;fastener;screw;25107;02;1;    vis F X M4-10;;steel;;;;;;;;;;;;	Property:TYPE_STD;$STD=AFNOR\fastener\screw#V=25107#I=02#R=NR.top;AFNOR;fastener;screw;25107;02;1;    vis F X M4-10;;steel;;;;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\APPUI CHAUSSURE.top;;;;;;1;    Attache;;steel;;(modified);;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\APPUI CHAUSSURE.top;;;;;;1;    Attache;;steel;;(modified);;;;;;;;;;	Property:TYPE_SA;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\AMORTISSEUR COMPLET.top;;TopSolidProjects;;;;1;ENSEMBLE Système Amortissement;;;;;;;;;;;;;;	Property:TYPE_SA;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\TIGE AMORTISSEUR.top;;TopSolidProjects;;;;1;    ENSEMBLE Tige Amortisseur;;steel;;;;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\TIGE AMORTISSEUR.top;;;;;;1;        Tige Amortisseur;;steel;;;;;;;;;;;;	Property:TYPE_STD;$STD=AFNOR\fastener\springring#V=22163#I=01#R=NR.top;AFNOR;fastener;spring ring for shaft;22163;01;1;        anneau élastique extérieur 10×1;;steel;;;;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\TIGE AMORTISSEUR.top;;;;;;1;        Axe Tige;;steel;;;;;;;;;;;;	Property:TYPE_STD;$STD=AFNOR\fastener\springring#V=22163#I=01#R=NR.top;AFNOR;fastener;spring ring for shaft;22163;01;1;        anneau élastique extérieur 10×1;;steel;;;;;;;;;;;;	Property:TYPE_SA;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\CORPS AMMORTISSEUR.top;;TopSolidProjects;;;;1;    Corps Amortisseur;;polyoxymethylene POM (delrin);;;;;;;;;;;;	Property:TYPE_SA;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\AMORTISSEUR COMPLET.top;;TopSolidProjects;;;;1;ENSEMBLE Système Amortissement;;;;;;;;;;;;;;	Property:TYPE_SA;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\TIGE AMORTISSEUR.top;;TopSolidProjects;;;;1;    ENSEMBLE Tige Amortisseur;;steel;;;;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\TIGE AMORTISSEUR.top;;;;;;1;        Tige Amortisseur;;steel;;;;;;;;;;;;	Property:TYPE_STD;$STD=AFNOR\fastener\springring#V=22163#I=01#R=NR.top;AFNOR;fastener;spring ring for shaft;22163;01;1;        anneau élastique extérieur 10×1;;steel;;;;;;;;;;;;	Property:TYPE_PART;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\TIGE AMORTISSEUR.top;;;;;;1;        Axe Tige;;steel;;;;;;;;;;;;	Property:TYPE_STD;$STD=AFNOR\fastener\springring#V=22163#I=01#R=NR.top;AFNOR;fastener;spring ring for shaft;22163;01;1;        anneau élastique extérieur 10×1;;steel;;;;;;;;;;;;	Property:TYPE_SA;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\CORPS AMMORTISSEUR.top;;TopSolidProjects;;;;1;    Corps Amortisseur;;polyoxymethylene POM (delrin);;;;;;;;;;;;	Property:TYPE_SA;C:\TopSolidProjects\Samples\NewStepperLuxe\Lib\ORDINATEUR.top;;TopSolidProjects;;;;1;ORDINATEUR;;steel;;;;;;;;;;;;

Anyone any advice how I can sort through this in a sensible fashion?

User avatar
JuP
Master Chief
Master Chief
Posts: 122
Joined: Tue Sep 09, 2014 5:45 pm

Re: [TS6] Reading the references and IProperties of an Assembly. BOM?

Post by JuP » Wed Jul 20, 2016 3:48 pm

Hello,

You want keep a hierarchy or your question is just about the display?
Julien . P
Youtube
Grabcad

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest