Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Options

[API] Why is `massproperties` returning three separate sets of data?

kenn_sebesta167kenn_sebesta167 Member Posts: 53 ✭✭
edited July 2022 in Using Onshape
When using the `massproperties` endpoint, we get three sets of data. Three 3D centroids, three masses, three tensor matrices for moment of inertia...

Finding docu on the API calls has been elusive, but when I look at the data, it's consistent with some kind of low/medium/high estimate. Although it seems to be presented as medium/low/high. Even then, there's some data formatting issues, such as 'centroid' and 'inertia' being flat arrays, instead of 3 arrays of 3D arrays whereas 'principal_axes' is split into three arrays of 3D tuples.

  1. Anyone know what's going on? 
  2. Is this a stable API output or should we expect things to evolve in the future?

Sample output

{
	'bodies': {
		'-all-': {
			'centroid': [-1.0042503280088468e-05,
				1.482968868956767,
				-0.10850477404260045,
				-0.0004082241547197037,
				1.4714758672098183,
				-0.11013804119136905,
				0.0003880814213651826,
				1.494527929574006,
				-0.10688083594369849
			],
			'has_mass': True,
			'inertia': [714.867020569292,
				-0.014160378394796422,
				0.004015898147491597,
				-0.014160378394796422,
				1131.586050729513,
				-53.50925669683793,
				0.004015898147491597,
				-53.50925669683793,
				1562.5523468371136,
				701.8487106243456,
				-5.522840015221163,
				-1.1145415625960162,
				-5.522840015221163,
				1111.699098197347,
				-59.31222835505792,
				-1.1145415625960162,
				-59.31222835505792,
				1548.9104146980378,
				729.4246845262535,
				5.4938937031232715,
				1.1225860729708868,
				5.4938937031232715,
				1151.461202245161,
				-47.47341185240581,
				1.1225860729708868,
				-47.47341185240581,
				1577.7024981879326
			],
			'mass': [1108.1590500187838,
				1104.9831903079348,
				1111.3349097296327
			],
			'mass_missing_count': 0,
			'periphery': [28.54436749362015,
				28.52381150513451,
				28.564923482105787
			],
			'principal_axes': [{
					'x': -0.9999999994305906,
					'y': -3.3645025311420136e-05,
					'z': 2.6136796041127386e-06
				},
				{
					'x': -3.307887953955009e-05,
					'y': 0.992603752707567,
					'z': 0.12139929578314308
				},
				{
					'x': 6.678830562829961e-06,
					'y': -0.12139929562755955,
					'z': 0.9926037532553086
				}
			],
			'principal_inertia': [714.8670200823695,
				1125.0416611936616,
				1569.0967368598874
			],
			'volume': [1.4441004096515049,
				1.4393286387365865,
				1.4488721805664238
			]
		}
	},
	'microversion_id': '80f46668d060ca5fd7bc9cc4'
}

Tagged:
Sign In or Register to comment.