Good day.
A non-systemic (random) error occurred while calling SetAutomaticKutList of one part in different configurations.
The macro works, but only with swModelPart.Visible = true enabled. But this greatly increases the execution time of the macro. Whoever encountered this, please help me fix the code without swModelPart.Visible = true.
Code below
swModel = (ModelDoc2)swApp.ActiveDoc;
AssemblyDoc swAssy = (AssemblyDoc)swModel;
swAssy.ResolveAllLightWeightComponents(true);
Object[] vComps = swAssy.GetComponents(false);
for (int i = 0; i < vComps.Length; i++)
{
swComp = (Component2)vComps[i];
NameswComp = swComp.GetPathName();
if (swComp.IsSuppressed() == false)
{
NamePart = GetName(NameswComp);
configName = swComp.ReferencedConfiguration;
if (NamePart != "")
{
swModelPart = swComp.GetModelDoc();
Feature swFeat = swComp.FirstFeature();
while (swFeat != null)
{
if (swFeat.GetTypeName2() == "SolidBodyFolder" & NameswComp.ToLower().IndexOf(".sldasm") == -1)
{
SolidBodiFolder = swFeat;
swModelPart.Visible = true; <<<<<<<<<<<<<<<<<<
boolstatus = swModelPart.ShowConfiguration2(configName);
boolstatus = swBodyFolder.SetAutomaticCutList(true); <<<<<<<<<< Does not give an error
boolstatus = swBodyFolder.UpdateCutList();
boolstatus = swBodyFolder.SetAutomaticCutList(false);
swModelPart.Visible = false; <<<<<<<<<<<<<<<<<<<How to get rid of this ???
swApp.CloseDoc(NameswComp);
break;
}
swFeat = swFeat.GetNextFeature();
}
}
}
}
It works only with a visible part window. But that doesn’t suit me???
Attached video links.
Works without mirror reflections - Works - YouTube
Doesn't work with mirror images - Doesn't work - YouTube
Works with swModelPart.Visible = true - Works1 - YouTube