get_mass_properties
Calculate mass, volume, surface area, center of mass, density, and principal moments of inertia for a SolidWorks part or assembly to support quoting, lightening analysis, or dynamic inertia studies.
Instructions
Propiedades de masa — read mass, volume, surface area, center of mass, density, and principal moments of inertia for the active part OR assembly (works on both doc types). Read-only.
Returns a dict in mm-native units: - mass_g (float, gramos): total mass in grams. - volume_mm3 (float): total volume in mm³. - surface_area_mm2 (float): total surface area (área superficial) in mm². - center_of_mass_mm (list[float], 3): [x, y, z] of the centro de gravedad in the part frame (mm). - density_kg_per_m3 (float): density (densidad) in kg/m³ — the SW canonical density unit, NOT mm-converted. - principal_moments_g_mm2 (list[float], 3): [Ixx, Iyy, Izz] in g·mm² about the centroid.
Caveat: requires a material to be set on the part for mass to be
meaningful. SW's "Default Material" returns mass_g=0 (no density
assigned). Call set_material first if the part has no material.
Common autoparts uses: - Cotización (quoting): mass_g × material price/kg. - Lightening pass: measure mass before / after a vaciado, target a mass reduction without dropping below stiffness threshold. - Inertia for dynamic analysis: principal_moments_g_mm2.
Example — quote a turned shaft: set_material("AISI 1045 Steel") props = get_mass_properties() cost = (props["mass_g"] / 1000) * 65.0 # MXN/kg
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||