Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Surface stress calc of an Inventor IDW section view?

5 REPLIES 5
Reply
Message 1 of 6
Nik_Barbour
484 Views, 5 Replies

Surface stress calc of an Inventor IDW section view?

Hi,

Something I have just been asked to investigate by my employer... (and after investigating, I can't think of a workable answer using Inventor, but thought i'd ask here in case someone else can).

 

As part of our design process, we currently design Welded structures which consist of numerous seperate ipt files assembled together as an iam. We currently drop the iam onto an idw sheet, cut various sections, save these out to Autocad, Where an Autolisp program I wrote 12 years ago, then performs the following functions, to prove the design is aceptable...

1- It creates a region of each section element selected.

2- It then performs a massprop on all regions to get bounding box and lower left corner coords.

3- It then changes the ucs to be the lower left boundary point, and performs a further massprop to obtain Centroid X & Y coords, and the second moment of area (Ix).

4 - The prog (having read a bending moment) then calcs the upper and lower surface stress and puts a nice text and line diagram over the section.

 

For audit reasons, my employer was recently asked "how do you know the AutoCAD sections are current and up to date with the Inventor Model?", and as a result, they now wish to do the calc within an Inventor IDW sheet live, so that the section stress data updates, if the iam file changes as mods are made to the model.

 

Problems I have found with this wish...

I can't get at Region properties (Ix and centroid X & Y) from the IDW sheet sections directly.

Also can't get the Ix and centroid X & Y from an IAM even.

The only succesfull method I have is to Shrinkwrap the IAM to an IPT, at which point 'Section Analysis' and 'Region Properties' can give me the data, but its a live inquiry as opposed to something I can automate on an idw sheet. And its a more manual process than the AutoCAD method which is the root of the Audit problem.

 

Is there a way to get Ix and centroid XY coords directly from an Inventor IDW section view?

If so how do you get at it directly using VBA?

Is there a better way to achieve live (updating to model changes) section data, removing as many manual steps as possible?

 

Thanks in advance if anyone has any ideas.

Nik

 

(Existing Autolisp output shown below as example)

section stress.jpg

 

5 REPLIES 5
Message 2 of 6
Nik_Barbour
in reply to: Nik_Barbour

Got a little further with this.

Using Google fu, I found a posted iLogic rule shown below...

 

====================================

 

Sub Main
  Dim oSketch As PlanarSketch = FindSketch(ThisDoc.Document, "Sketch1")
  GetProfileRegionProperties(oSketch)
End Sub
Public Sub GetProfileRegionProperties(oSketch As Sketch)
   
    ' Create a default profile from the sketch.
    Dim oProfile As Profile
    oProfile = oSketch.Profiles.AddForSolid
   
    ' Set a reference to the region properties object.
    Dim oRegionProps As RegionProperties
    oRegionProps = oProfile.RegionProperties
' Set the accuracy to medium.
    oRegionProps.Accuracy = AccuracyEnum.kMedium
' Display the region properties of the profile.
    MsgBox ("Area: " & oRegionProps.Area)
   
    MsgBox ("Perimeter: " & oRegionProps.Perimeter)
   
    MsgBox ("Centroid: " & _
                    oRegionProps.Centroid.X & ", " & _
                    oRegionProps.Centroid.Y)

Dim adPrincipalMoments(2) As Double
    Call oRegionProps.PrincipalMomentsOfInertia(adPrincipalMoments(0), _
                                                    adPrincipalMoments(1), _
                                                    adPrincipalMoments(2))
    MsgBox ("Principal Moments of Inertia: " & _
                    adPrincipalMoments(0) & ", " & _
                    adPrincipalMoments(1))
Dim adRadiusOfGyration(2) As Double
    Call oRegionProps.RadiusOfGyration(adRadiusOfGyration(0), _
                                            adRadiusOfGyration(1), _
                                            adRadiusOfGyration(2))
    MsgBox ("Radius of Gyration: " & _
                    adRadiusOfGyration(0) & ", " & _
                    adRadiusOfGyration(1))
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)
    Trace.WriteLine( "Moments: ")
    MsgBox ( " Ixx: " & Ixx)
    MsgBox ( " Iyy: " & Iyy)
    MsgBox ( " Ixy: " & Ixy)
   
    MsgBox ("Rotation Angle from projected Sketch Origin to Principal Axes: " _
    & oRegionProps.RotationAngle)
   
End Sub
Public Function FindSketch(ByVal doc as Document, ByVal sketchName As String) As Inventor.PlanarSketch
    Dim sketches As Inventor.PlanarSketches = Nothing
    Dim oPartDoc As Inventor.PartDocument
    Dim oAssemDoc As Inventor.AssemblyDocument
    If (doc.DocumentType = Inventor.DocumentTypeEnum.kPartDocumentObject) Then
        oPartDoc = doc
        sketches = oPartDoc.ComponentDefinition.Sketches
    ElseIf (doc.DocumentType = Inventor.DocumentTypeEnum.kAssemblyDocumentObject) Then
        oAssemDoc = doc
        sketches = oAssemDoc.ComponentDefinition.Sketches
    End If
   
    If (sketches IsNot Nothing) Then
        For Each Sketch As Inventor.PlanarSketch In sketches
            If (String.Compare(Sketch.Name, sketchName, True) = 0) Then
                Return Sketch
            End If
        Next
    End If
   
    Throw New ArgumentException("No sketch named " & sketchName & " was found.")
End Function

======================================

 

This gives me Second moment of area, but centroid is relative to sketch origin (as is the 'region props' tool outputs).

Inventor should automatically reposition the sketch origin to be the centroid. And it should also give a bounding box data set in the region props outputs.

 

As it is, it isn't useful as a user could have used anything as their sketch origin, and I have no way to determine the distance from the centroid to the upper and lower surfaces of the fab, allowing me to calc the surface stress.

 

hmmm - further digging is required.

Message 3 of 6
Nik_Barbour
in reply to: Nik_Barbour

Done digging I think.

 

In summary the Inventor 'Region Properties' tool isn't useful for non symetrical regions, as Inventor doesn't calculate the moment of ineria about the centroid (its calculated from wherever the sketch origin is based.)

It can be corrected by moving the sketch origin to the centroid of the region, but this is a very manual process and open to user error.

The region properties tool is also lacking bounding box data for the region, making it hard to programatically determine the dist from the centroid to the upper or lower surface of the region.

 

So I guess for now this boils down to becoming a future wishlist item...

 

I wish Inventor 'Region Properties' would calculate moment of inertia about the centroid (not from the sketch origin).

I also wish 'Region Properties' contained Bounding Box data - similar to AutoCAD's Massprop command.

 

And if we were really really wishing - I'd wish the above could be done on an idw sliced section.

 

Message 4 of 6
adam.nagy
in reply to: Nik_Barbour

Hi Nick,

 

The code you used could be extended for Section Views as well:

http://adndevblog.typepad.com/manufacturing/2014/06/region-properties-for-section-view.html

 

Cheers,



Adam Nagy
Autodesk Platform Services
Message 5 of 6
adam.nagy
in reply to: Nik_Barbour

The RegionProperties object also has the CentroidMomentsOfInertia function which does what I think you need.

Also, you could get the extents from the sketch: http://adndevblog.typepad.com/manufacturing/2014/06/sketch-extents.html



Adam Nagy
Autodesk Platform Services
Message 6 of 6
Nik_Barbour
in reply to: adam.nagy

Hi Adam,

 

It's definately a step closer to what I was aiming for, but unfortunately with the dist to centroid info not being present, I'm still not able to perform quick on the fly surface stress calcs without dumping out to AutoCAD and using the massprop command.

 

massprop.jpg

 

 

As a structural engineer, I'm looking for Second moment of area with origin at the regions centroid (not the sketch origin), and then a bounding box data set which gives me the dist from the centroid to the upper and lower surfaces of the region. This is the minimum data (along with your bending moment) to calculate surface stresses.

 

I'd love to be able to analyse a region or sectioned sketch, and know its bounding box data, its dist in Y to its centroid from the lower surface (or upper), and its second moment of area calculated from the regions centroid (not sketch origin).

 

I do really appreciate the code snippets you have sent, and will definately use these. Thanks Adam.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report