• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

parameter moment of inertia

  • Thread starter Thread starter dunga77
  • Start date Start date
I do it on profiles. I select the profile face and create a sketch, then I project all geometries. Key desto > region property and select projected sketch. in the window opening selective calculates and gives me all the parameters. I don't know if that's what you need.
 
I don’t know how to do it on inventor, but in general you have to specify if you mean the static moment of area inertia, the one in mm^4 (to which definitely refers zac69), or the moment of inertia properly said, the dynamic one, in kg*mm^2.
 
Thank you, unfortunately I need a variable parameter.

I create a set with ilogic with an intercapedine, see attached, where at the varying ø external and table length vary masses and consequently the moment of inertia.

Therefore I should share in the table the moment of inertia for the customer.
 

Attachments

  • Tamburo.webp
    Tamburo.webp
    59.3 KB · Views: 25
I don't know if I understand what you need, however with this code you extract from every part of a whole a lot of information, including: volume, mass, material, name part and moments of inertia and write them on a text file (in the example on the desktop).
I hope it's useful.
Code:
public sub get_globalmoi_ofparts_in_this_assy()

    'deskttop path
    dim desktoppath as string
    desktoppath = getdesktop 'getdesktop path for using the function
    
    'write to text file for records
    dim filepath as string
    
    filepath = desktoppath & "\getprops.txt"
    open filepath for output as #1
    
    'assembly doc defintion
    dim oassemblydoc as assemblydocument
    set oassemblydoc = thisapplication.activedocument
    
    'set component definition
    dim ocompdef as assemblycomponentdefinition
    set ocompdef = oassemblydoc.componentdefinition 'this is the overall assembly we're in
    
    'create a list for use
    dim newoccurrencelist as new collection

    'get the total # of sub-parts in assembly
    dim totsubpartoccurences as integer
    totsubpartoccurences = ocompdef.occurrences.count
    
    'add each sub part to the list of occurences
    dim subpartcount as integer
    for subpartcount = 1 to totsubpartoccurences
        'for each sub part
        if ocompdef.occurrences.item(subpartcount).definitiondocumenttype = kpartdocumentobject then
        newoccurrencelist.add ocompdef.occurrences.item(subpartcount) 'add it to the list
        end if
    next

    'helpers
    dim lbstokg as double: lbstokg = 0.453592
    dim okgtolbs as double: okgtolbs = 2.20462
    dim inchtocm as double: inchtocm = 2.54
    dim ocmtoin as double: ocmtoin = 0.393701
    'declare desired properties
    dim volume as double
    dim mass as double
    'top level parts
    dim momentsxyz(5) as double 'xyz moments about the reference axis about it's cg
    dim momentsxyzglobal(5) as double ' global to be calculated
    dim momentsofprince(2) as double ' i1,i2,i3 about the principla axis
    'cg placeholders
    dim partcgx as double
    dim partcgy as double
    dim partcgz as double
    dim omassprops as massproperties
    'for loops
    dim i as integer
    dim j as integer


    'iterate through the assembly and other occurrences i.e. parts in the list
    dim occurcount as integer
    'get the current part in the list and do the following
    for occurcount = 1 to newoccurrencelist.count 'start with the first occurence
 
        dim thisocc as componentoccurrence
        set thisocc = newoccurrencelist.item(occurcount)
        
        'this occurence defined as a partdoc
        dim thisoccpardef as partdocument
        set thisoccpardef = thisocc.definition.document
        
        'part docs component def
        dim thisocccompdef as componentdefinition
        set thisocccompdef = thisoccpardef.componentdefinition
        
        'part name
        dim partname as string: partname = thisocc.name
    
        'get these properties
        volume = thisocc.massproperties.volume
        mass = thisocc.massproperties.mass
        partcgx = thisocc.massproperties.centerofmass.x
        partcgy = thisocc.massproperties.centerofmass.y
        partcgz = thisocc.massproperties.centerofmass.z
    
        'define mass props to use with moi function
        set omassprops = thisocc.massproperties
        
        'check if mass property results are already available at a high accuracy level
        'or better. if so, simply print out the results, else, set a flag to not cache
        'the results in the document.
        if omassprops.availableaccuracy <> k_high and _
            omassprops.availableaccuracy <> k_veryhigh then
            ' set the accuracy to high.
             omassprops.accuracy = k_high
            'set cacheresultsoncompute property to false so that results are not saved with
            'the document and hence the document is not 'dirtied'.
            omassprops.cacheresultsoncompute = false
        end if
    
        'call the mass moi function
        call omassprops.xyzmomentsofinertia(momentsxyz(0), momentsxyz(1), momentsxyz(2), momentsxyz(3), momentsxyz(4), momentsxyz(5))
        
        'call the principal moi function
        call omassprops.principalmomentsofinertia(momentsofprince(0), momentsofprince(1), momentsofprince(2))
        
        'calculate global moi's using the
        'parallel axis theorem
        'i'(x',y',z') = i(xc,yc,zc) + md^2
        'i'x',y',z' = moi gobal
        'ixc,yc,zc = moi of local centroid
        'm = mass
        'd = normal distance between cg and iglobal ref point ( resultant distance in 3d d = sqr(d1^2 + d2^2) )
        'ixx
        momentsxyzglobal(0) = momentsxyz(0) + mass * math.sqr(partcgy ^ 2 + partcgz ^ 2) ^ 2
        'iyy
        momentsxyzglobal(1) = momentsxyz(1) + mass * math.sqr(partcgx ^ 2 + partcgz ^ 2) ^ 2
        'izz
        momentsxyzglobal(2) = momentsxyz(2) + mass * math.sqr(partcgx ^ 2 + partcgy ^ 2) ^ 2
        
        'parallel axis theorem for global product mois
        'i'(xy',yz',xz') = i(xyc,yzc,xzc) + m*ci*cj
        'i'xz',yz',xz' = moi product gobal
        'ixyc,yzc,xzc = moi of local centroid
        'm = mass
        'ci = x,y,z global cg coordinate
        'cj = x,y,z global cg coordinate
        'ixy - na
        momentsxyzglobal(3) = -(momentsxyz(3) + mass * partcgx * partcgy) ' "-" iprop negative integral
        'iyz - na
        momentsxyzglobal(4) = -(momentsxyz(4) + mass * partcgy * partcgz) ' "-" iprop negative integral
        'ixz - na
        momentsxyzglobal(5) = -(momentsxyz(5) + mass * partcgx * partcgz) ' "-" iprop negative integral
    
        'convert the moi's to usable units
        for i = 0 to 5
            momentsxyzglobal(i) = thisoccpardef.unitsofmeasure.convertunits(momentsxyzglobal(i), "kg cm^2", "lbmass in^2")
        next
        for j = 0 to 2
            momentsofprince(j) = thisoccpardef.unitsofmeasure.convertunits(momentsofprince(j), "kg cm^2", "lbmass in^2")
        next
        
        'write to the txt file
        write #1, "part: " & partname _
        & "vol(in^3): " & volume / inchtocm ^ 3 & "," _
        & " mass:" & mass / lbstokg _
        & " ixx: " & momentsxyzglobal(0) _
        & " iyy: " & momentsxyzglobal(1) _
        & " izz: " & momentsxyzglobal(2) _
        & " princ1: " & momentsofprince(0) _
        & " princ2: " & momentsofprince(1) _
        & " prince3: " & momentsofprince(2) _
        & " material: " & thisocccompdef.material.name _
        & vbnewline
        ' & " ixy: " & momentsxyzglobal(3) _
        ' & " iyz: " & momentsxyzglobal(4) _
        ' & " ixz: " & momentsxyzglobal(5) _

    next 'next occurence i.e. part in assembly list
 
    'close the text file
    close #1
    
    msgbox ("we're done getting part props")

end sub

function getdesktop() as string
    dim owshshell as object
    
    set owshshell = createobject("wscript.shell")
    getdesktop = owshshell.specialfolders("desktop")
    
    set owshshell = nothing
end function
 
Hello adahm, I see this old post and your answer with the code. where and how should this code be inserted in inventor to have the information? Thank you.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top