VIEW MULTIPLE CENTERS OF GRAVITY OF ALL OR SELECTED SUB ASSEMBLIES OF AN INVENTO

VIEW MULTIPLE CENTERS OF GRAVITY OF ALL OR SELECTED SUB ASSEMBLIES OF AN INVENTO

anthony_kootsouradis
Explorer Explorer
832 Views
4 Replies
Message 1 of 5

VIEW MULTIPLE CENTERS OF GRAVITY OF ALL OR SELECTED SUB ASSEMBLIES OF AN INVENTO

anthony_kootsouradis
Explorer
Explorer

IT WOULD BE NICE TO BE ABLE TO VIEW MULTIPLE CENTERS OF GRAVITY OF ALL OR SELECTED SUB ASSEMBLIES OF AN INVENTOR ASSEMBLY AND BE ABLE TO SHOW THEM ON AN IDW.

0 Likes
833 Views
4 Replies
Replies (4)
Message 2 of 5

WCrihfield
Mentor
Mentor

I know this isn't exactly what you were looking for, but it's in the same neighborhood.  This iLogic code works from an active drawing document.  It will place a centermark in the drawing view you select, at the center of gravity of the model being shown within your selected drawing view.  You can then place a dimension or other drawing elements from that point to any other model edge, point, etc.

What you're talking about sounds doable though.  Do you need to show & use these 3D points within your Assembly, or do you just need to show & use them within your drawings? 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 5

WCrihfield
Mentor
Mentor

Oops. I forgot to attach the code I mentioned in my first post.  Here it is.

Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim oView As DrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a drawing view.")
Dim oCOG As Centermark = oSheet.Centermarks.AddByCenterOfGravity(oView)

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 5

anthony_kootsouradis
Explorer
Explorer
I would like to see it in both the assembly and the drawing with a denotation showing which is which.
Thanks
Tony
0 Likes
Message 5 of 5

WCrihfield
Mentor
Mentor

Here is an iLogic code you can run from an AssemblyDocument to create workpoints at the CenterOfMass of each Occurrence within the main assembly.

Dim oADoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
Dim oOccs As ComponentOccurrences = oADef.Occurrences
Dim oPoint As Point
Dim oWPoints As WorkPoints = oADef.WorkPoints
Dim oWPoint As WorkPoint

For Each oOcc As ComponentOccurrence In oOccs
	oPoint = oOcc.MassProperties.CenterOfMass
	oWPoint = oWPoints.AddFixed(oPoint, False)
	oWPoint.Name = oOcc.Name & " - Center Of Mass"
Next

Then you just need to "Include" them on the DrawingDocument side, per view.  This can be done by code too, but I would need to know if the drawing already exists, if it does exist, is it already open, if it doesn't exist, do you want to create it, etc.?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)