''This macro wil save your current open Assembly or Part to a Derived Part and will show you the total weight. ''Macro created by Stefaan Boel ''Copyright by Inventor Wizard (http://www.inventorwizard.be) ''Use this macro at your own risk. ''You may only copy/modify this or part of the code if you leave this header! Public Sub SaveAsDerivedPart() 'declare the environment Dim oApp As Application Dim oCurrentDoc As Document Dim oNewDoc As Document Dim UseDefaultTemplate As Boolean Dim sCurrentFileName As String Dim sTemplatePart As String Set oApp = ThisApplication Set oCurrentDoc = oApp.ActiveDocument Select Case oApp.ActiveDocumentType Case kAssemblyDocumentObject, kPartDocumentObject sCurrentFileName = ThisApplication.ActiveDocument.FullFileName If sCurrentFileName = "" Then MsgBox "The active file must first be saved", vbInformation, "Warning" Exit Sub End If 'if you want to use the default template then set UseDefaultTemaplte = True 'if you want to use a custom template set the path and filename of sTemplatePart and UseDefaultTemaplte = False UseDefaultTemplate = False sTemplatePart = "C:\Program Files\Autodesk\Inventor 11\Templates\Standard.ipt" 'Change this path if necessary Select Case UseDefaultTemplate Case True Set oNewDoc = oApp.Documents.Add(kPartDocumentObject) Case False Set oNewDoc = oApp.Documents.Add(kPartDocumentObject, sTemplatePart, True) End Select 'If your template has an active sketch you need to close it. Dim oSketch As Sketch On Error Resume Next Set oSketch = oNewDoc.ComponentDefinition.Sketches.Item(1) oSketch.ExitEdit oSketch.Delete On Error GoTo 0 'Get the control definition that represents the derived part command. Dim oDerivedCommandDef As ControlDefinition Set oDerivedCommandDef = ThisApplication.CommandManager.ControlDefinitions.Item("PartDerivedComponentCmd") 'Post the filename to the private event queue. Call ThisApplication.CommandManager.PostPrivateEvent(kFileNameEvent, sCurrentFileName) 'Get ISO view + fit SendKeys "{F6}", True Dim oView As View Set oView = ThisApplication.ActiveView oView.Fit 'Delete these lines if you don't whan't the mass to be shown Dim dblMass As Double dblMass = oCurrentDoc.ComponentDefinition.MassProperties.Mass MsgBox CStr(dblMass) & " kg" 'ThisApplication.ActiveDocument.ComponentDefinition.MassProperties.Mass = dblMass 'Delete up to here 'Start the derived part command. oDerivedCommandDef.Execute SendKeys "{HOME}", True SendKeys "{Enter}", True SendKeys "{F6}", True Case Else MsgBox "You must first have a Part or Assembly document open" End Select End Sub