If you edit the part you can access the equations direct from the assembly
but if you want to have the option of not saving your changes, you might prefer to open the part
In the first instance I would make sure that you have a saved position of where you are so that if you want to go back you can always reload
The edit mode that Rob mentions should be available using the API as well, so what you want should be possible.
sorry, didn't notice was posted in API section,, I presumed searching meant by filter
In my head I see it like this:
1. Select the component with SelectByID2 from the assembly (or search for it by a part of its name as a string);
2. Open the part so the equation can be edited; (Here I am having trouble figuring it out)
3. Search for the equation with Equation manager, edit the desired equation and rebuild the modified mart within the assembly;
4. Make the assembly active again for the rest of the code to be executed.
Can you assist me with some example code from the second and third points as by now I have only modified parts before they are added to the assembly, but here I need it to be done after the fact?
Here is the loop thru the equation list. You can enter name and value you want to change
Not sure how much you know about VB - just a hint: you can put the list of equations from the loop into a listbox and select what item you want to change
dim swEquationMgr As SldWorks.EquationMgr Set swEquationMgr = swModelDoc.GetEquationMgr Dim i As Integer Dim vSplit As Variant For i = 0 To swEquationMgr.GetCount - 1 If InStr(swEquationMgr.Equation(i), "@") = 0 Then 'skip all equations which are not global vSplit = Split(swEquationMgr.Equation(i), "=") vSplit(0) = Replace(vSplit(0), Chr(34), Empty) If vSplit(0) = sVarName Then swEquationMgr.Equation(i) = Replace(swEquationMgr.Equation(i), vSplit(1), sVarValue) Exit Sub End If End If Next i
Thank you for the example. It will help for sure.