I am horribly new to macro/programming.
I just finished recording a macro by selecting a part in an assembly and set it to transparent. I was planning to use this macro on other places where I could multi -select parts where I want to toggle transparency.
But as I guess, the macro only worked with the part that I selected during the recording.
So my first question is which part of the code should I change to make it more "universal". Like set transparent on selected parts only and can work on other assemblies.
Also I can see "boolstatus = swAssembly.SetComponentTransparent(true);" if True set to false I guess that would be setting a part from transparent to opaque. My second part of the question is what code do I put it so that I can do a transparency toggle. In other words, the selected parts would be set transparent if they are currently opaque and vice versa.
My last question would be is there other places to pick up APIs for beginners like me?
This is my code below
public partial class SolidWorksMacro
public void Main()
ModelDoc2 swDoc = null;
PartDoc swPart = null;
DrawingDoc swDrawing = null;
AssemblyDoc swAssembly = null;
bool boolstatus = false;
int longstatus = 0;
int longwarnings = 0;
swDoc = ((ModelDoc2)(swApp.ActiveDoc));
boolstatus = swDoc.Extension.SelectByID2("", "FACE", -0.13356289656850606, 0.020099154942499808, 0.023311305031086249, false, 0, null, 0);
boolstatus = swDoc.Extension.SelectByID2("machined_05-1@Assem1", "COMPONENT", 0, 0, 0, false, 0, null, 0);
swAssembly = ((AssemblyDoc)(swDoc));
boolstatus = swAssembly.SetComponentTransparent(true);
/// The SldWorks swApp variable is pre-assigned for you.
public SldWorks swApp;