iProperties Still unavailable to call into iLogic

iProperties Still unavailable to call into iLogic

RNDinov8r
Collaborator Collaborator
892 Views
12 Replies
Message 1 of 13

iProperties Still unavailable to call into iLogic

RNDinov8r
Collaborator
Collaborator

Doing some searching and from what I can tell, the Global Inertia values in the iProperties are still not available to call for use in iLogic code? If that's not the case, how can those three properties be called. Ixx, Iyy, and Izz are the ones I would be wanting to call.

 

I ask because we have an assembly template that we use for designing End of Arm Tools. Our robots require the intertial values of the EOAT assemblies...but they are in units not available thru Inventors standard units...so I have to convert them "manually". It would be great if I could just pull the Global "I" values and run them thru a formula and show the new values.

0 Likes
893 Views
12 Replies
Replies (12)
Message 2 of 13

bhavik4244
Collaborator
Collaborator
0 Likes
Message 3 of 13

nmunro
Collaborator
Collaborator

Does the MassProperties.XYZMomentsOfInertia method not give you what you are after? iLogic rule code below.

 

    Dim doc As PartDocument = ThisDoc.Document
    
    Dim massProps As MassProperties
    massProps = doc.ComponentDefinition.MassProperties
    
    Dim Ixx As Double
    Dim Iyy As Double
    Dim Izz As Double
    Dim Ixy As Double
    Dim Iyz As Double
    Dim Ixz As Double
    
    massProps.XYZMomentsOfInertia(Ixx, Iyy, Izz, Ixy, Iyz, Ixz)
	
	Dim msg As String = "Ixx  " & Ixx.ToString()
	
	MessageBox.Show(msg, "You figure out the units")

        


https://c3mcad.com

0 Likes
Message 4 of 13

nmunro
Collaborator
Collaborator

Just to add, the values are in Inventor's default units (kg cm^2)

        


https://c3mcad.com

0 Likes
Message 5 of 13

RNDinov8r
Collaborator
Collaborator

@nmunro I'll check that out. It's not obvious to me that massProps.XYZMomentsofInertia is Global in lieu of principle. If it is, then great...that would likely solve my issue.

 

To the end of units...I have my template set so my units are g*mm² (which are easily converted to Fanuc's units of Kgf*cm*S² with a simple multiplier of 1.01971621E-9 

 

0 Likes
Message 6 of 13

RNDinov8r
Collaborator
Collaborator

I was able to apply the code and get to show what I needed in my form. Those are indeed the Global values. Thanks Neil

0 Likes
Message 7 of 13

RNDinov8r
Collaborator
Collaborator

I stand corrected, those values from what I can see are the Principle Inertia Values (shown as I1, I2, & I3) in the iProps Physical tab.

The description of the variable states its about the COG, not the origin. 

RNDinov8r_0-1631042404341.png

So, if my memory of engineering school from 20 years ago serves, I could just determine the offset of the COG from the origin, and mulitply the mass and that distance (squared), and that would be employing the parallel axis theorem?, thus giving me the global value?

0 Likes
Message 8 of 13

nmunro
Collaborator
Collaborator

It does really depend on what you are after but yes. if you want the mass moments of inertia relative to the XYZ axes you can modify the values obtained from the XYZMomentsOfInertia method which returns the MOIs about the XYZ axes translated to the COG point. Have a look at the attached part which includes a commented macro (sorry, I try to avoid iLogic for testing) that hopefully helps. 

 

The symmetry of the part and it's alignment with the coordinate system ensures the principal axes (and thus the Principal MOIs) are the same as the MOIs about the XYZ axes translated to the COG.

 

The initial sketch is offset -3mm along the X axis. This offset affects the MOI about the global Y and Z axes. Check the three options on the iProperties > Physical tab (Principal, Global, and Center of Gravity) and compare them to the output from the macro. The Debug.Print statements print to the Immediate window in the VBA editor.

 

Sorry but the file is Inventor 2022. 

        


https://c3mcad.com

0 Likes
Message 9 of 13

RNDinov8r
Collaborator
Collaborator

@nmunro 

 

Thanks for that info...I am working thru this right now...Looks like it may give me my solution now...after picking thru the code, think I found snippets I need. Will let you know.

0 Likes
Message 10 of 13

RNDinov8r
Collaborator
Collaborator

So, After verifying with hand calcs, this is what I came up with.

 

'Calculates the value of the inertia in Fancus preferred units of Kgf*cm*S²
    Dim doc As AssemblyDocument = ThisDoc.Document
    
    Dim massProps As MassProperties
    massProps = doc.ComponentDefinition.MassProperties
    'these are prinicple values. Ixy, Iyz, Ixz are not required.
    Dim Ixx As Double
    Dim Iyy As Double
    Dim Izz As Double
	Dim Ixy As Double
	Dim Ixz As Double
	Dim Iyz As Double
	Dim EOATMass As Double
	Dim Addxx As Double
	Dim Addyy As Double
	Dim Addzz As Double
	Dim COGx As Double
	Dim COGy As Double
	Dim COGz As Double
	Dim RadX As Double
	Dim RadY As Double
	Dim RadZ As Double
    
    massProps.XYZMomentsOfInertia(Ixx, Iyy, Izz, Ixy, Ixz, Iyz)
	'determin mass values
	EOATMass = iProperties.Mass
	EOAT_Mass = EOATMass
	'Determin offset parallel mass distance
	COGx = Sqrt(((iProperties.CenterOfGravity.Z)^2) + (iProperties.CenterOfGravity.Y)^2)
	COGy = Sqrt(((iProperties.CenterOfGravity.X)^2) + (iProperties.CenterOfGravity.Z)^2)
	COGz = Sqrt(((iProperties.CenterOfGravity.X)^2) + (iProperties.CenterOfGravity.Y)^2)
	COG_x = COGx
	COG_y = COGy
	COG_z = COGz
	
	Addxx = EOATMass * COGx ^ 2
	Addyy = EOATMass * COGy ^ 2
	Addzz = EOATMass * COGz ^ 2
	
	GlobalIxx = (Ixx*100000) + Addxx
	GlobalIyy = (Iyy*100000) + Addyy
	GlobalIzz = (Izz*100000) + Addzz
	'Dim msg As String = "Ixx  " & Ixx.ToString()
	'Use Parallel Axis Theorm to determine Global inertia based on principle values offset from origin
	
	'MessageBox.Show(msg, "You figure out the units")
FanucIxx = Ixx * 0.00000000101971621
FanucIyy = Iyy * 0.00000000101971621
FanucIzz = Izz * 0.00000000101971621

This works for now. I can equate these to parameters and then have those parameters show up in a form, so this seems to work well.  The only thing I'd like to be able to do, is control the format that the variables show up as...i.e. 2 decimal places versus 10 or whatever, but this is good enough. 

 

Secondly, its odd to me that my template file has units set to mm and g for default units of distance and mass, but I still have to apply a conversion factor to Ixx, Iyy, and Izz ? so they are at their root kg*cm² regardless of the files unit settings?

 

Ohh, and these were the Parameters I created.

RNDinov8r_0-1631130037751.png

 

0 Likes
Message 11 of 13

nmunro
Collaborator
Collaborator

Looks good. Inventor uses cm for length values internally, and kg for mass values so API properties and methods that extract this type data always return values in these units. Inventor does the conversions to the document units (or specified units) when showing values in the UI. There are all the conversion tools you could ever want in the UnitsOfMeasure object in the Inventor API. The developer help system is your friend! I'm not sure of the Round() syntax in iLogic but I'm sure there is a function for rounding values to specific decimal places in your code.

        


https://c3mcad.com

0 Likes
Message 12 of 13

RNDinov8r
Collaborator
Collaborator

So, I am not sure rounding is what I need. Ultimately I need to display my Parameters to more decimal places...Inventor is only allowing me to show 8 decimal places when I use the text box tool in a drawing.

RNDinov8r_0-1631136073484.png

I am pullng those values from the assembly inserted into the drawing.

0 Likes
Message 13 of 13

nmunro
Collaborator
Collaborator

Are you sure your unit conversions are correct? Do you have the option of creating a text based property instead of a parameter? if so you could format the value in scientific notation with appropriate sig figs. Below is a small iLogic example.

 

Dim dbl As Double = .00000583455414
Dim str As String = dbl.ToString("0.####e0")

messagebox.Show(dbl.ToString("#.############") & " as string = " & str)

 

        


https://c3mcad.com

0 Likes