I'm having a bit of a problem trying to figure out how to change display states using the API. Could anyone point me in the direction of what I need to do? I've recorded this macro, but when I try and transfer the code to the add-in I'm developing the AddDisplayState() method no longer works.
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));
swDoc.ClearSelection2(true);
boolstatus = swDoc.Extension.SelectByID2("My Component.SLDPRT", "COMPONENT", 0, 0, 0, false, 0, null, 0);
Configuration myConfiguration = null;
myConfiguration = ((Configuration)(swDoc.GetConfigurationByName("Default")));
boolstatus = myConfiguration.ApplyDisplayState("Hook");
}
Any suggestions?