Moment of inertia to custom properties

Moment of inertia to custom properties

sgs
Explorer Explorer
428 Views
2 Replies
Message 1 of 3

Moment of inertia to custom properties

sgs
Explorer
Explorer

I have created a sketch named "Area" 

Projected cut faces in it.

Now i look for a rule to transfer the area moment of inertia to custom properties IX IY IZ.

Cant figure the API rule for that.

Help please, I think it is simple. But still have a lot to learn 🙂

0 Likes
Accepted solutions (1)
429 Views
2 Replies
Replies (2)
Message 2 of 3

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

Try this snippet:

    Dim oDoc As PartDocument = ThisDoc.Document
	Dim oCompdef As PartComponentDefinition = oDoc.ComponentDefinition
	Dim oSketch As Sketch = oCompdef.Sketches.Item("Area")
    Dim oProfile As Profile= oSketch.Profiles.AddForSolid
    Dim oRegionProps As RegionProperties= oProfile.RegionProperties

    oRegionProps.Accuracy = kMedium

    Dim Ixx As Double
    Dim Iyy As Double
    Dim Izz As Double
    Dim Ixy As Double
    Dim Iyz As Double
    Dim Ixz As Double
    Call oRegionProps.MomentsOfInertia(Ixx, Iyy, Izz, Ixy, Iyz, Ixz)
	
	iProperties.Value("Custom", "Ixx") = Ixx
	iProperties.Value("Custom", "Iyy") = Iyy
	iProperties.Value("Custom", "Izz") = Izz

R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 3 of 3

sgs
Explorer
Explorer

you are an expert thank you very much.

Sofus

0 Likes