- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Could I ask for your help with some fine tuning?
I hacked together the code below with help from all of you on the forums - thanks!
It takes a list of Parameters and cycles through the assembly looking for parts with the same parameter names. It then copies the value of the parameter from the assembly down to the part.
It occured to be that this would be more efficient if I didn't have to manually create a list of parameters to compare.
What I'd like to do is create a list of all parameters in the assembly file that begin with the prefix 'A_', and compare this list against the parameter list held in each subassmbly and part file in the assembly, copying the values down as before.
Could anyone offer me any advice on how to build the parameter list?
Cheers,
Paul.
' set a reference to the assembly component definintion. ' This assumes an assembly document is open. Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition 'Iterate through all of the occurrences Dim oOccurrence As ComponentOccurrence For Each oOccurrence In oAsmCompDef.Occurrences 'check for and skip virtual components '(in case a virtual component trips things up) If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then Parameter.Quiet = True 'Match up the slab height If Parameter(oOccurrence.Name, "A_CeilingSlab") Then Parameter(oOccurrence.Name, "A_CeilingSlab") = A_CeilingSlab End If 'Match up the coffered ceiling height If Parameter(oOccurrence.Name, "A_CeilingCoffer") Then Parameter(oOccurrence.Name, "A_CeilingCoffer") = A_CeilingCoffer End If 'match up the finished ceiling height If Parameter(oOccurrence.Name, "A_CeilingFinished") Then Parameter(oOccurrence.Name, "A_CeilingFinished") = A_CeilingFinished End If 'Match up the coving height If Parameter(oOccurrence.Name, "A_Coving") Then Parameter(oOccurrence.Name, "A_Coving") = A_Coving End If 'Match up the picture rail height If Parameter(oOccurrence.Name, "A_PictureRail") Then Parameter(oOccurrence.Name, "A_PictureRail") = A_PictureRail End If 'Match up the dado height If Parameter(oOccurrence.Name, "A_DadoHeight") Then Parameter(oOccurrence.Name, "A_DadoHeight") = A_DadoHeight End If 'Match up the datum height If Parameter(oOccurrence.Name, "A_Datum") Then Parameter(oOccurrence.Name, "A_Datum") = A_Datum End If 'Match up the skirting height If Parameter(oOccurrence.Name, "A_SkirtingHeight") Then Parameter(oOccurrence.Name, "A_SkirtingHeight") = A_SkirtingHeight End If 'Match up the finished floor level If Parameter(oOccurrence.Name, "A_FloorFinished") Then Parameter(oOccurrence.Name, "A_FloorFinished") = A_FloorFinished End If 'Match up the slab floor level If Parameter(oOccurrence.Name, "A_FloorSlab") Then Parameter(oOccurrence.Name, "A_FloorSlab") = A_FloorSlab End If 'Match up the slab floor level If Parameter(oOccurrence.Name, "A_RoomLength") Then Parameter(oOccurrence.Name, "A_RoomLength") = A_RoomLength End If 'Match up the slab floor level If Parameter(oOccurrence.Name, "A_RoomWidth") Then Parameter(oOccurrence.Name, "A_RoomWidth") = A_RoomWidth End If Else End If Next 'Uodate the document to see the changes InventorVb.DocumentUpdate()
Customer Adoption Specialist: Autodesk Informed Design
Help | Learn | Forum | Blog | Ideas | Sample content | Linkedin
Solved! Go to Solution.