Community
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Project center of gravity to sketch point

Project center of gravity to sketch point

Example: I design lamps and they are hanging on the ceiling. Sometimes they have complex look and it is hard to design appropriate wall holder because I don't know where to put joint. In that case I need to find center of gravity and that is not problem but the problem is to exactly determine axis of the z-vector of the gravity center.

 

It would be much easier to project center of the gravity to point on desired plane or to sketch. 

 

Center of Gravity point.

 

1111.PNG

 

I suggest new option in sketch -> Project Genter of Gravity

See image

Untitled.png

 

And result is point in desired sketch

 

3232.PNG

 

Thanks

 

Adam

 

22 Comments
jletcher
Advisor

Here is an ilogic that will put a center point at the Center of Gravity point. It will work in an assembly or a part file..

 

After point is there you can use it to project to your sketch..

 

Hope this helps....

 

 

Dim openDoc As Document
openDoc = ThisDoc.Document
Dim docFile As Document
oDoc = ThisApplication.ActiveDocument





Dim oCenterOfMass As Point
    oCenterOfMass = oDoc.ComponentDefinition.MassProperties.CenterOfMass

    ' Check to see if a work point for center of mass already exists.
    ' This uses the name of the work feature to identify it.
    On Error Resume Next
    Dim oWorkPoint As WorkPoint
    oWorkPoint = oDoc.ComponentDefinition.WorkPoints.Item("Center Of Mass")
    If Err.Number = 0 Then
        Dim oFixedDef As FixedWorkPointDef
        oFixedDef = oWorkPoint.Definition

        oFixedDef.Point = oCenterOfMass
        oDoc.Update
    Else
        ' Create a new workpoint at the location of the center of mass.
        oWorkPoint = oDoc.ComponentDefinition.WorkPoints.AddFixed(oCenterOfMass)

        ' Rename the work point.
        oWorkPoint.Name = "Center Of Mass"
    End If

 

If you add or subtract parts you have to delete the old point and run rule again. This is a work in progress and I have not had time to add if something changes....

 

Good Luck...........

 

 

jletcher
Advisor

You do not have to delete in a part after change just run rule and the point will move to new point. And if you projected it the point your project will also move..

 

 

adam.gracanin
Participant

It works. This rule will faster and improve my designs.

 

Problem solved

 

Thank you

Josh_Hunt
Advocate

, great workaround.

 

adam.gracanin, I doubt this will ever become an automatic feature. That would have the danger of running into an infinite loop during part updates.
Anonymous
Not applicable

Would it be possible to make it so that you can turn the center of mass for a sub assembly on and leave it on so that you could check to make sure that a component doesn't over balance itself somehow?

kmeldfreyssinet
Collaborator

Hi,

I see some activity on the topic here.

 

I tried this rule but it doesn't update position of the point after CoG is changed and rule is run. 

I work in Level of Detail. 

 

I cannot fix this problem myself. Could you help?

 

Cris.

freesbee
Collaborator

...here a VBA code that will create or update a point named COG in your current document (part or assembly).

You can project the point to a sketch and use it as you like with the advantage that if you update the point the projections will remain.

The only downside is that if your geometry changes you need to run the macro again.

I am personally not that much a fun of an element not updating by itself... and I also think that jhunt107 is quite right (high risk of infinite loops if the feature gets "native").

 

If you prefer the COG to be visible instead of invisible simply replace False with True in your code (I prefer to keep performance killers invisible if I can, and after all if you need to see the point you can always reach it from the browser)

 

I'm still in trouble to understand the advantages of iLogic (I never used it, I don't even know if I will). But a specialist at AU yesterday told me that I'm not missing anything after he made 1 hour presentation on iLogic... so I think I'll keep on the VBA/VB.net path

 

Have fun! Smiley Wink

MaX

 

Public Sub currentCOGpoint()
Dim COGpresent As Boolean
Dim oDoc As Document
Dim oDef As ComponentDefinition
Dim oMassProperties As MassProperties
Dim oControlDef As ControlDefinition
Dim COGx, COGy, COGz As Double
Dim wp As WorkPoint
COGpresent = False

If ThisApplication.ActiveDocument Is Nothing Then
    MsgBox "  ! ! ! no active document ! ! !" & vbCr & "command will be terminated", vbOKOnly + vbExclamation, "! ! unable to proceed ! !"
    Exit Sub
End If

Set oDoc = ThisApplication.ActiveDocument
If (oDoc.DocumentType = kPartDocumentObject Or oDoc.DocumentType = kAssemblyDocumentObject) Then

  'read center of gravity coordinates
  Set oDef = oDoc.ComponentDefinition
  Set oMassProperties = oDef.MassProperties
  Set oControlDef = ThisApplication.CommandManager.ControlDefinitions.Item("AppCenterOfGravityCmd")
  oControlDef.Execute

  COGx = oMassProperties.CenterOfMass.X
  COGy = oMassProperties.CenterOfMass.Y
  COGz = oMassProperties.CenterOfMass.Z

  'update eventually present COG workpoint
  For Each wp In oDef.WorkPoints
    If wp.Name = "COG" Then
      Call wp.SetFixed(ThisApplication.TransientGeometry.CreatePoint(COGx, COGy, COGz))
      wp.Visible = False
      COGpresent = True
      Exit For
    End If
  Next

  'create COG point if not present
  If COGpresent = False Then
    Set wp = oDef.WorkPoints.AddFixed(ThisApplication.TransientGeometry.CreatePoint(COGx, COGy, COGz))
    wp.Name = "COG"
    wp.Visible = False
  End If
Else
    MsgBox "wrong active document type" & vbCr & "command will be terminated", vbOKOnly + vbExclamation, "! ! unable to proceed ! !"
End If
End Sub
mnorman
Advocate

This looks fine. But it seems ludicrous that we have to have a work around for something that should be a simple built-in single click option?

mnorman
Advocate

I am re-submitting an idea that was raised several years ago but went no further (https://forums.autodesk.com/t5/inventor-ideas/project-center-of-gravity-to-sketch-point/idc-p/776257...).

 

Apart from some over complex and unnecessary i logic and macros, I can't see any way of adaptively projecting the Centre of Gravity to a sketch.

As part of VA VE, we are continually attempting to simplify design, remove mass etc from our components. If I had a way of continually monitoring the c of g, this would speed up the entire process.

freesbee
Collaborator

I don't have any official confirmations on the potential high risk of infinite loops if the feature gets "native".

I imagine that an idea with 36 votes as it is now, is already been watched by moderators, so anyone of them could give us a sign if we are asking something "dangerous" or "critical"

@dan_szymanski can you give us any indication?

mnorman
Advocate

I have re-submitted this idea to try and resurrect it. It seems Autodesk are happy to let simple ideas like this, collect dust and ultimately disappear...

 

https://forums.autodesk.com/t5/inventor-ideas/project-center-of-gravity-to-sketch-point/idi-p/776263...

 

dan_szymanski
Autodesk

Hi @mnorman,

 

No need to resubmit an idea until the Master Idea gets archived.  I merged your new Idea to this one and it was good to see you garnered a couple extra votes.  @freesbee, I feel @SteveMDennis might be able to shed some potential light on this?  I personally do not know.  Thanks.

SteveMDennis
Autodesk

I don't think that infinite loops are a potential problem but the part would potentially not be correct. Imagine this scenario:

  1. Design a part
  2. Project the COG to a point
  3. cut out a slot based on that COG point somehow

The cut out of the slot will change the COG maybe which means the slot is no longer in the right place... (and if we kept trying to get it right we would do Josh's infinite loop perhaps).

 

We calculate the COG when asked but the feature definition itself requires the COG so the COG would either be the LAST COG calculated or something that is not accurate.

 

@mnorman I'm sorry to say that "Simple Ideas" are very rarely simple when you start to figure out how it affects EVERYONE's workflows not just 42 users who are asking for an idea.  To formalize something like this we have to make sure it doesn't adversely affect any of our 300K+ users...

freesbee
Collaborator

...well, explained as Steven explains there is not much left to tell!!

Few of my guys dealing with high accelerating machine parts asked me this feature. Now I know that the solution I gave them (sub currentCOGPoint() posted up here) is the most reasonable.

Thank you Dan, thank you Steven.

mnorman
Advocate

Hi Steven, Dan

 

Thanks for the reply. In my experience, for every person that stands up and asks for something, there are 100 more who wanted to but didn't. 

 

 

SteveMDennis
Autodesk

I agree with you mnorman and kudo count is just one thing we use to prioritize the thousands of requests we get here and through other channels.

ross.butterfield
Contributor

Infinite loops went out in the 70's... last time a computer blew up from that was on Star Trek when they asked it the "liar paradox."

 

Every time you constrain a sketch, you create series that may or may not converge.  If they do, fine.  If they don't, it warns you.  Who hasn't stumped Inventor occasionally?  You can easily create geometry that solves OK for some positions but freaks out if you move a point outside a zone of convergence.

 

Try something like this -- it worked for me:

1) Sketch an arbitrary scalene triangle.  (Dimension the base & height, define an area parameter Atriangle)

2) Construct the center of area.  If extruded, center of mass follows trivially.

3) Put a circular hole in the triangle.  Center of area (mass) is obvious. (dimension the circle and define area Acircle)

4) Draw a line between the centroids of the circle and triangle.  Give it a driven dimension "Offset".

5) Place a point on the line, representing the composite center of mass.

6) Dimension the point with the formula Offset * (Acircle)/(Atriangle-Acircle)

 

Now create an "infinite loop" by constraining the intersection of the circle and offset to lie on the calculated CG.

Nothing blows up, everything is fine.  You can change the dimensions or drag the free points, it all adjusts dynamically.  No reason to avoid or prohibit this kind of construction from being automated.

 

freesbee
Collaborator

Dear Ross,

This sounds very interesting.

Maybe you can post the ipt, so that others who may want to follow would save some time?

(you know, today is the "day for garden and children", rather than the day for Inventor)

just my 50 cent's solidworks does it, so it's possible

dan_szymanski
Autodesk
Status changed to: Future Consideration

Idea added to backlog for future consideration [45125]. Thanks!

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

Submit Idea  

Autodesk Design & Make Report