giftopk.blogg.se

Autodesk inventor cost
Autodesk inventor cost








autodesk inventor cost

The 'ComponentOccurrences' will only contain the direct children of the Assembly, not the childrens' children. If oOcc.DefinitionDocumentType = kAssemblyDocumentObject ThenĬall TraverseAssembly(oOcc.SubOccurrences, Level + 1, oCost) ' and recursively call this function to traverse through it. ' Check to see if this occurrence represents a subassembly OPropSet = ("Design Tracking Properties") ' Get the iPropertySet that constains the estimated cost property ' Get the document file for this occurrence ' The occurrence is valid count the cost. Or oOcc.BOMStructure = BOMStructureEnum.kReferenceBOMStructure Then If oOcc.BOMStructure = BOMStructureEnum.kPhantomBOMStructure _ ' represents the occurrences at the top level of an assembly.įor Each oOcc As ComponentOccurrence In Occurrences ' Iterate through all of the occurrence in this collection. Private Sub TraverseAssembly(ByVal Occurrences As ComponentOccurrences, _ ' Call the function that does the recursion.Ĭall TraverseAssembly(, 1, oCost) I think this code which I recently wrote would serve you IProperties.Value("Project", "estimated cost") = Round (sumNumber,2) YNumber = iProperties.Value(oOccurrence.Name, "Project", "estimated cost") XNumber = iProperties.Value("Project", "estimated cost") 'If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then '(in case a virtual component trips things up)

autodesk inventor cost autodesk inventor cost

OAsmCompDef = įor Each oOccurrence In oAsmCompDef.Occurrences 'This assumes an assembly document is open.ĭim oAsmCompDef As Assembl圜omponentDefinition 'set a reference to the assembly component definintion. IProperties.Value("Project", "estimated cost") = 0 'clear the custom property in the assembly 'oCustomPropertySet.Add(0, propertyName1) ' Assume error means not found so create it 'oProp = oCustomPropertySet.Item(propertyName1) 'oCustomPropertySet = ("Inventor User Defined Properties") 'Dim propertyName1 As String = "HK_Stand" 'Look at all of the files referenced in the open documentįor Each docFile In openDoc.AllReferencedDocuments I Need your help to modify the code that it will sum parts and sub-assemblies. If i have a sub-assembly with parts, i dont get the sum of this one. I found this code and i changed it a bit - works ok but only for parts in an assembly.










Autodesk inventor cost