Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Center of gravity as work point

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
3578 Views, 6 Replies

Center of gravity as work point

Dear all,
I have a question:
Is it possible assign a work point at the center of gravity?

Thanks in advance.
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: Anonymous




--
Dennis Jeffrey, Autodesk Inventor Certified
Expert
Autodesk Manufacturing Implementation Certified
Expert.
Instructor/Author/Sr. App Engr. Tel. (260) 399-6615
AIP 2008 SP3,
AIP 2009-SP1 PcCillin AV
HP zv5000  AMD64 2GB - Geforce Go 440, Driver:
.8185
XP Pro SP3, Windows XP Silver Theme

href="http://teknigroup.com">http://teknigroup.com
Message 3 of 7
Anonymous
in reply to: Anonymous

Dear Dennis,
Thank you for the answere but the macro iCOG seems not work in my system. Infact the iCOG macro is not load by Inventor. I think that the problem is the windows vista 64 bit operating system. Could you solve thi problem?
Message 4 of 7
Anonymous
in reply to: Anonymous


I'm building up my XP64 system this weekend. I'll let you
know....


--
Dennis Jeffrey, Autodesk Inventor Certified
Expert
Autodesk Manufacturing Implementation Certified
Expert.
Instructor/Author/Sr. App Engr. Tel. (260) 399-6615
AIP 2008 SP3,
AIP 2009-SP1 PcCillin AV
HP zv5000  AMD64 2GB - Geforce Go 440, Driver:
.8185
XP Pro SP3, Windows XP Silver Theme

href="http://teknigroup.com">http://teknigroup.com
Message 5 of 7
Yijiang.Cai
in reply to: Anonymous

View -> Center of Gravity to get the coordinate of COG and then assign a work point using the values of this coordinate. But the work point can't be associated with the changes of COG. Please see the attached image.



When you use the VBA code for assigning work point in COG below, it will be associative with the COG changed.



Thanks,

River



Public Sub WorkPointAtMassCenter()

' Check to make sure a part document is active.

If ThisApplication.ActiveDocumentType kPartDocumentObject Then

MsgBox "A part document must be active."

Exit Sub

End If



' Set a reference to the active document.

Dim oDoc As PartDocument

Set oDoc = ThisApplication.ActiveDocument



' Get the Center of Mass.

Dim oCenterOfMass As Point

Set 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

Set oWorkPoint = oDoc.ComponentDefinition.WorkPoints.Item("Center Of Mass")

If Err.Number = 0 Then

Dim oFixedDef As FixedWorkPointDef

Set oFixedDef = oWorkPoint.Definition



oFixedDef.Point = oCenterOfMass

oDoc.Update

Else

' Create a new workpoint at the location of the center of mass.

Set oWorkPoint = oDoc.ComponentDefinition.WorkPoints.AddFixed(oCenterOfMass)



' Rename the work point.

oWorkPoint.Name = "Center Of Mass"

End If

End Sub
Thanks,
River Cai

Inventor Quality Assurance Team
Autodesk, Inc.
Email: River-Yijiang.Cai@autodesk.com
Message 6 of 7
Anonymous
in reply to: Anonymous

Thanks.
Now I'm going to try your code and then I'll let you know if I manage to make it work.
Message 7 of 7
Anonymous
in reply to: Anonymous

Ok, the code works perfectly. I just added the condition <> in the first function "if":



If ThisApplication.ActiveDocumentType <> kPartDocumentObject Then



Thanks,



bye bye



Edited by: nekao on Mar 24, 2009 5:19 PM



Edited by: nekao on Mar 25, 2009 1:46 PM Edited by: nekao on Mar 25, 2009 1:46 PM

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

Post to forums  

Autodesk Design & Make Report