AnsweredAssumed Answered

Edit equations for all assembly components

Question asked by Nate Moorman on Jan 20, 2021
Latest reply on Jan 22, 2021 by Peter Brinkhuis

I'm trying to put together a macro that will loop through all components in an assembly, including all subassemblies and the top level assembly. I need to edit the equation manager for each one and then rebuild it. I am having trouble being able to use the GetModelDoc2 method. I am getting the "Object doesn't support this property or method" error while looping through the array that I get from comps = assembly.GetComponents(False). The line that fails is Part = comps(i).GetModelDoc2. As far as I know, it is necessary to have the ModelDoc2 or AssemblyDoc in order to use GetEquationMgr. Just to be clear, I already have the code written for what I need to do to the equations, and I have tested it on assemblies and parts, and it works. The only thing I need to figure out is how to loop through the entire assembly and run that code on every single component, including the assembly itself. Anything helps, thanks!