Calculating area moments of inertia in Rhinoscript (now with files)

Hi!

I’m not getting the same calculation results on my script that uses Rhino.SurfaceAreaMoments and Analyze > Mass Properties > Area Moments. I need the moments of inertia about the centroid coordinate axes. I’ve calculated the moments of inertia by hand and I’m sure that my code result is wrong haha. Does anyone see what I’m missing?

My code looks like this:

surfaces = Rhino.SelectedObjects

If IsArray(surfaces) Then
			For Each surface In surfaces
					inertias = Rhino.SurfaceAreaMoments(surface)

					If IsArray(inertias) Then
						Rhino.Print	Rhino.Pt2Str(inertias(10), 0)
				
		End If
	Next
	
End If

I’ve attached a Rhino file with the surfaces and a pdf with my calculation. The text is in Dutch but the numbers and calculations are clear.

Thanks in advance!

Rhino Testmodel 0 meting.3dm (119.8 KB) Calculation moments of inertia about centrooid axes.pdf (252.5 KB)

Hi Pim,

Not my area of expertice, but I’d like to comment that if you can post an example file and your calculations
It’s much easier for others to give meaningfull feedback.

you can attache files to your post with this button:
image

-Willem

Hi Willem,

Thanks! I’ve added some files. I hope this helps.

Kind regards,

Pim

Hi Pim,

FYI: Something went wrong with the link to the Rhino file, you might want to re-upload it

-Willem

Hi Willem,

Fixed the file, thanks!

Pim

@GregArden - can you look at this?

Let me see if I understand.

  1. You are wanting to compute the Area Moments of Inertia about the centroid for the composite of the two surfaces labeled 1 and 2 in the model.

  2. When you select both surfaces and run the Rhino command AreaMoments you get the correct results.

  3. Your script doesn’t produce these numbers.

The script computes the Area Moments for each object individually. RhinoScript doesn’t have a function to add together multiple AreaMoment results.

You either need to use RhinoCommon based scripting methods, or Join the objects into a polysurface and use your script.

Third option would be to calculate individual area moments, areas and centroids, and then combine for the composite moment using the appropriate algebraic formula.

Hi Greg,

Thanks for your reply, yes you got it right.
Joining the surfaces into a polysurface would be a good solution!

Pim

Hi David,

That’s what I’m doing right now, and I hope there is a quicker way haha.

Pim