Hallo KraBBy,
ich habe eine iLogic-Regel gefunden, die Haupt,- und Schwerpunk der Trägheitsmomente in Excel rausschreibt.
VG
Enric
'Code
RuleParametersOutput()
InventorVb.DocumentUpdate()
Dim massProps as MassProperties
Dim partDoc as PartDocument = TryCast(ThisDoc.Document, PartDocument)
If (partDoc IsNot Nothing) Then massProps = partDoc.ComponentDefinition.MassProperties
Dim assemDoc as AssemblyDocument = TryCast(ThisDoc.Document, AssemblyDocument)
If (assemDoc IsNot Nothing) Then massProps = assemDoc.ComponentDefinition.MassProperties
Dim moments(5) As Double
massProps.XYZMomentsOfInertia(moments(0), moments(1), moments(2), moments(3), moments(4), moments(5))
For i = 0 To 5
moments(i) = ThisDoc.Document.UnitsOfMeasure.ConvertUnits(moments(i), "kg cm^2", "kg mm^2")
Next
Ixx = moments(0)
Iyy = moments(1)
Izz = moments(2)
Ixy = moments(3)
Iyz = moments(4)
Ixz = moments(5)
'hier wird der Pfad angegeben wo die Exceltabelle liegt
'und bei Sheet1, wie das Tabellenblatt heißt (meist Tabelle1)
oMyFile = "C:\TEMP\Test.xlsx"
GoExcel.CellValue(oMyFile, "Sheet1", "A1") = "Moments: "
GoExcel.CellValue(oMyFile, "Sheet1", "A2") = " Ixx: "
GoExcel.CellValue(oMyFile, "Sheet1", "A3") = " Iyy: "
GoExcel.CellValue(oMyFile, "Sheet1", "A4") = " Izz: "
GoExcel.CellValue(oMyFile, "Sheet1", "B2") = Round(Ixx,3)
GoExcel.CellValue(oMyFile, "Sheet1", "B3") = Round(Iyy,3)
GoExcel.CellValue(oMyFile, "Sheet1", "B4") = Round(Izz,3)
GoExcel.CellValue(oMyFile, "Sheet1", "C2") = " kg mm^2"
GoExcel.CellValue(oMyFile, "Sheet1", "C3") = " kg mm^2"
GoExcel.CellValue(oMyFile, "Sheet1", "C4") = " kg mm^2"
GoExcel.CellValue(oMyFile, "Sheet1", "A6") = " Ixy: "
GoExcel.CellValue(oMyFile, "Sheet1", "A7") = " Iyz: "
GoExcel.CellValue(oMyFile, "Sheet1", "A8") = " Ixz: "
GoExcel.CellValue(oMyFile, "Sheet1", "B6") = Round(Ixy,3)
GoExcel.CellValue(oMyFile, "Sheet1", "B7") = Round(Iyz,3)
GoExcel.CellValue(oMyFile, "Sheet1", "B8") = Round(Ixz,3)
GoExcel.CellValue(oMyFile, "Sheet1", "C6") = " kg mm^2"
GoExcel.CellValue(oMyFile, "Sheet1", "C7") = " kg mm^2"
GoExcel.CellValue(oMyFile, "Sheet1", "C8") = " kg mm^2"
GoExcel.Save
GoExcel.Close
------------------
Konstruktion
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP