I have an odd issue I've been searching for but I haven't found anything like I'm seeing. I'm processing drawing components with a small function, to hide or show the components - here's a snippet:
private string ProcessDrawingComponent(ModelDoc2 swDoc, object[] childComps, string drawingCompName, bool visibility)
{
bool selected;
Debug.Print("Searching for: "\"" + drawingCompName + "\"");
foreach (DrawingComponent ChildComp in childComps)
{
Debug.Print(" Processing: \"" + ChildComp.Name + "\"");
if (ChildComp.Name == drawingCompName)
{
Debug.Print(" Selecting component");
selected = ChildComp.Select(false, null);
if (selected)
{
if (visibility)
{
Debug.Print(" Showing component");
swDoc.ShowComponent2();
}
else
{
Debug.Print(" Hiding component");
swDoc.HideComponent2();
}
ChildComp.DeSelect();
return "Success";
...
..
The array I pass in looks like this:
string[] comps = new string[] { "StartAssembly-SectionAssembly-2-1/PHOTOCELL-2",
"StartAssembly-SectionAssembly-2-1/FASTENER-5",
"StartAssembly-SectionAssembly-2-1/Control_Station-1" };
The first time through the ProcessDrawingComponent, it works, and my debug statements produce this (which is what I would expect):
Searching for: "StartAssembly-SectionAssembly-2-1/PHOTOCELL-2"
Processing: "StartAssembly-SectionAssembly-2-1/PHOTOCELL-1"
Processing: "StartAssembly-SectionAssembly-2-1/PHOTOCELL-2"
Selecting component
Showing component
But the second call to ProcessDrawingComponent, produces this (which is what I would NOT expect):
Searching for: "StartAssembly-SectionAssembly-2-1/FASTENER-5"
Processing: "StartAssembly-SectionAssembly-2<1>/FASTENER<5>"
Processing: "StartAssembly-SectionAssembly-2<1>/FASTENER<10>"
Error: Couldn't find "StartAssembly-SectionAssembly-2-1/FASTENER-5"
For some reason, SolidWorks now uses the <> instead of a dash.
Has anyone else seen this issue - I'm really hoping it's something I'm doing wrong, or maybe I could it better?
Thanks in advance for any help.
SolidworksApi/macros