D.S

adndevblog.typepad.com

Inertia in custom units - Manufacturing DevBlog

Inertia in custom units - Manufacturing DevBlog Manufacturing DevBlog The resource for software developers working with Design, Lifecycle and Simulation technologies from Autodesk. Home Subscribe Follow Useful Links Autodesk About this Blog « Search non- Ballooned Components | Main | AddDesignVisualizationAttachmentBadAttachmentOrder error » 10/01/2014 Inertia in custom units By  Adam Nagy As mentioned in this blog post internal units are fixed so that mass is always kg, length is always cm, etc: http://adndevblog.typepad.com/manufacturing/2012/07/unitsofmeasure-object-and-example.html The same is true for compound units like the one for inertia, which is mass * length ^ 2, and so internally it's kg cm^2 Based on the document settings it might be displayed as lbmass in^2. You can easily convert the internal unit to that using the above mentioned UnitsOfMeasure object: Sub UnitTest() Dim uom As UnitsOfMeasure Set uom = ThisApplication.UnitsOfMeasure Dim conversion As Double conversion = uom.ConvertUnits(1, "kg cm^2", "lbmass in^2") Dim doc As PartDocument Set doc = ThisApplication.ActiveDocument Dim mp As MassProperties Set mp = doc.ComponentDefinition.MassProperties Dim m As Double m = mp.Mass ' Internal units are cm, kg Dim Ixx As Double, Iyy As Double, Izz As Double Dim Ixy As Double, Iyz As Double, Ixz As Double Call mp.XYZMomentsOfInertia(Ixx, Iyy, Izz, Ixy, Iyz, Ixz) Dim Ixx2 As Double, Iyy2 As Double, Izz2 As Double Dim Ixy2 As Double, Iyz2 As Double, Ixz2 As Double Ixx2 = Ixx * conversion Iyy2 = Iyy * conversion Izz2 = Izz * conversion Ixy2 = Ixy * conversion Iyz2 = Iyz * conversion Ixz2 = Ixz * conversion End Sub Posted at 04:42 PM in Adam Nagy , Inventor | Permalink | | | Comments Inertia in custom units By  Adam Nagy As mentioned in this blog post internal units are fixed so that mass is always kg, length is always cm, etc: http://adndevblog.typepad.com/manufacturing/2012/07/unitsofmeasure-object-and-example.html The same is true for compound units like the one for inertia, which is mass * length ^ 2, and so internally it's kg cm^2 Based on the document settings it might be displayed as lbmass in^2. You can easily convert the internal unit to that using the above mentioned UnitsOfMeasure object: Sub UnitTest() Dim uom As UnitsOfMeasure Set uom = ThisApplication.UnitsOfMeasure Dim conversion As Double conversion = uom.ConvertUnits(1, "kg cm^2", "lbmass in^2") Dim doc As PartDocument Set doc = ThisApplication.ActiveDocument Dim mp As MassProperties Set mp = doc.ComponentDefinition.MassProperties Dim m As Double m = mp.Mass ' Internal units are cm, kg Dim Ixx As Double, Iyy As Double, Izz As Double Dim Ixy As Double, Iyz As Double, Ixz As Double Call mp.XYZMomentsOfInertia(Ixx, Iyy, Izz, Ixy, Iyz, Ixz) Dim Ixx2 As Double, Iyy2 As Double, Izz2 As Double Dim Ixy2 As Double, Iyz2 As Double, Ixz2 As Double Ixx2 = Ixx * conversion Iyy2 = Iyy * conversion Izz2 = Izz * conversion Ixy2 = Ixy * conversion Iyz2 = Iyz * conversion Ixz2 = Ixz * conversion End Sub View the entire comment thread. Please enable JavaScript if you would like to comment on this blog. Search Submit Mfg DevBloggers Adam Nagy Augusto Goncalves Balaji Ramamoorthy Daniel Du Philippe Leefsma Vladimir Ananyev Wayne Brill Xiaodong Liang November 2016 Sun Mon Tue Wed Thu Fri Sat     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30       Autodesk Blogs ADN DevBlog - AEC Our DevBlog for Revit, Navisworks, AEC and BIM technology APIs. ADN DevBlog - AutoCAD Our DevBlog for AutoCAD and other platform technology APIs. ADN DevBlog - Cloud and Mobile Our DevBlog for Cloud and Mobile technologies. ADN DevBlog - Infrastructure Modeling Our DevBlog for Infrastructure Modeling technology APIs. ADN DevBlog - Manufacturing Our DevBlog for Design, Lifecycle and Simulation technologies. Around the Corner Cyrille Fauvel's Maya platform developer blog - Autodesk Media and Entertainment technology. Civilized Development Isaac Rodriguez's AutoCAD Civil 3D developer blog Dances with Elephants Jim Quanci's blog on partnering with large companies. It's All Just Ones and Zeros Doug Redmond's Vault developer blog Mod the Machine Brian Ekins' and Adam Nagy's Inventor developer blog The 360 View Mikako Harada's BIM 360 developer blog The 3D Web Coder Jeremy Tammik's web and mobile programming blog The Building Coder Jeremy Tammik's Revit developer blog Through the Interface Kean Walmsley's AutoCAD developer blog Yet more on autodesk.com ... Central blog list on autodesk.com Share Recent Posts iLogic: ActiveDocument.ComponentDefinition throws exception for specific document Fusion API: Usage of Table Control Introduction to Fusion 360 API Create Sketch Text on Face of Assembly Fusion API: Usage of Mouse Event Making your add-in callable from VBA Autodesk App Store Forge and Fusion 360 Hackathon September 1 - October 31 Fusion API: Toggle [Capture Design History] Check or UnCheck iProperties Date Created and Date Checked example Delete Obje