Snapping line to a center of gravity

Snapping line to a center of gravity

Nauris47
Enthusiast Enthusiast
683 Views
4 Replies
Message 1 of 5

Snapping line to a center of gravity

Nauris47
Enthusiast
Enthusiast

Hello, im trying to build a geo dome out of icosahedron, and i faced a problem while doing that.

The problem is that i need to draw a 3D line from a center point of icosahedron to the one of the faces edge. Ive tried to add Center of Gravity and draw a line but it doesn't snap to it, is there any other way i could achieve this ?

 

Thanks in advance !

 

0 Likes
Accepted solutions (1)
684 Views
4 Replies
Replies (4)
Message 2 of 5

creggo
Enthusiast
Enthusiast
Accepted solution

Here's an ilogic rule to create a workpoint at the CoG. Works well for us!

I believe this was the original source: https://forums.autodesk.com/t5/inventor-forum/center-of-gravity-as-work-point/td-p/2451558

Dim oDoc As Document = ThisDoc.Document

If oDoc.DocumentType = Inventor.DocumentTypeEnum.kDrawingDocumentObject Then
i = MessageBox.Show("The CoG rule is for use in part (ipt) or assembly files (iam) only.", "Wrong Document Type", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1)

ElseIf oDoc.DocumentType = Inventor.DocumentTypeEnum.kPartDocumentObject Or Inventor.DocumentTypeEnum.kAssemblyDocumentObject Then
	
    ' Get the Center of Mass.
    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 AssemblyWorkPointDef
        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
End If

 Cheers

0 Likes
Message 3 of 5

Nauris47
Enthusiast
Enthusiast

Thanks for the possible solution, but i get a error on line 10, any idea whats causing it ?

nsvedarauskas_0-1667984916887.png

 

0 Likes
Message 4 of 5

creggo
Enthusiast
Enthusiast
Ahh, looking at the screenshots again, is your part made of surfaces? I think the rule will only work if there's solid bodies.
0 Likes
Message 5 of 5

Nauris47
Enthusiast
Enthusiast

Thanks ! i've made it to solid ant it works perfectly now. Thank you once again, have a great day.