ilogic: Export component iproperties to excel

ilogic: Export component iproperties to excel

Anonymous
Not applicable
1,668 Views
4 Replies
Message 1 of 5

ilogic: Export component iproperties to excel

Anonymous
Not applicable

Hello,

i want to export iproperties of components of an iam to an excel file.

 

I have found a ilogic code for this and it works fine.

I have changed the iproperties to mass and it exports but the the mass propertie losts it Units:

Maybe someone could help me.

 

This is the Result of the Mass-property i get:

 

Part NumberDateMass
3307030a_00328.07.2016 10:33:03232.673.618.367.318
3307030a_00228.07.2016 10:31:027.084.782
100102504.07.2016 10:05:1514.956.997.139.373
1001025_00304.07.2016 10:03:45113.825
1001025_00104.07.2016 09:58:26497.297.139.372.957
1001025_00204.07.2016 10:02:2014004,4
DIN 1025 - IPBl 450-639920.03.2015 07:19:1589.427.186.291.118

 

 

 

This is the result i want:

 

Masse
894,272 kg
7,085 kg
2,327 kg
14,957 kg

 

 

This is my code:

 

GoExcel.Open("c:\Temp\AAA\EXPORT1.xlsx", "Tabelle1")

 

'Print column titles in the row 2

Dim Names={"Display name", "Title", "Part Number", "Date", "Material"}

GoExcel.CellValues("A2", "E2") = Names

 

Dim oAsmDoc As AssemblyDocument = TryCast(ThisApplication.ActiveDocument,AssemblyDocument)

If oAsmDoc Is Nothing Then

    MessageBox.Show("Activate assembly document first", "iLogic",MessageBoxButtons.OK,MessageBoxIcon.Information)

    Exit Sub

End If

 

Dim Data(4) As String    'string array for properties   

Dim row As Integer = 3    'start data row

Dim oPropSet As PropertySet

Dim oProp As Inventor.Property   

 

For Each oDoc As Inventor.Document In oAsmDoc.AllReferencedDocuments

    'full filename

    Data(0) = oDoc.FullFileName

 

    'Title

    oPropSet = oDoc.PropertySets.Item("Inventor Summary Information")

    oProp = oPropSet.Item("Title")

    Data(1) = oProp.Value

   

    'Part Number

    oPropSet = oDoc.PropertySets.Item("Design Tracking Properties")

    oProp = oPropSet.Item("Part Number")

    Data(2) = oProp.Value

   

    'Date

    oPropSet = oDoc.PropertySets.Item("Design Tracking Properties")

    oProp = oPropSet.Item("Creation Time")

    Data(3) = oProp.Value

   

    'Revision

    oPropSet = oDoc.PropertySets.Item("Design Tracking Properties")

    oProp = oPropSet.Item("Mass")

    Data(4) = oProp.Value

 

    'Masse

'    mass = iProperties.Mass

'    MessageBox.Show(mass, "Title")

'    Data(4) = mass

 

   

    GoExcel.CellValues("A" & CStr(row), "E" & CStr(row)) = Data

    row += 1

Next

 

GoExcel.Save

GoExcel.Close

   

MessageBox.Show("Done", "iLogic",MessageBoxButtons.OK,MessageBoxIcon.Information)

 

 

' === end of the rule ===

 

 

 

 

Maybe someone have a solution for me,

thanks Richi

0 Likes
1,669 Views
4 Replies
Replies (4)
Message 2 of 5

Owner2229
Advisor
Advisor

Hey, instead of:

oProp.Value

use:

oProp.Expression
Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
Message 3 of 5

Anonymous
Not applicable

Thank you for your answere, but i get the same result 😉

 

Part NumberDateMasse
3307030a_00328.07.2016 10:33:032.326.736.184
3307030a_00228.07.2016 10:31:027.084.782
100102504.07.2016 10:05:150,
1001025_00304.07.2016 10:03:45113.825
1001025_00104.07.2016 09:58:26497.297.139
1001025_00204.07.2016 10:02:2014004,4
DIN 1025 - IPBl 450-639920.03.2015 07:19:15894.271.862.911

 

 

0 Likes
Message 4 of 5

S_May
Mentor
Mentor
Hello,

Two tools for exporting iProperties to Excel.
 
Extension = EXE

greetingsSmiley Happy

Sascha
0 Likes
Message 5 of 5

Owner2229
Advisor
Advisor

Hey, it looks like you can't get the units from the iProperty directly, but you can get them from the document:

 

 'Revision
    oPropSet = oDoc.PropertySets.Item("Design Tracking Properties")
    oProp = oPropSet.Item("Mass")
    Dim UOM As UnitsOfMeasure = oDoc.UnitsOfMeasure
    Dim oMU As UnitsTypeEnum = UOM.MassUnits
    Dim oUnit As String = UOM.GetStringFromType(oMU)
    Data(4) = UOM.GetStringFromValue(oProp.Expression, oMU)
Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes