Hide bend line without warning

Hi,

I just want to share a little experience which might be of value to others. For a customer I have made a macro years ago which hides bend-line sketches in all drawing views. Until now they have used SW2014 and it worked like a charm. The customer is now upgrading to SW2017 so I was testing the macro here.

In the macro I traverse the feature tree in each view, identifies and selects the bend-line sketch and then uses the ModelDoc2::BlankSketch to hide the sketch. In SW2017 you get the warning: "If you hide bend lines in a flat pattern view..."

In SW2014 I didn't get this message when running the macro so it wasn't a problem until now. It will be annoying for the users so I dug into it to get rid of this warning. First I tried to select each note and hide them before using BlankSketch - same result. Then I stumbled across IView::ShowSheetMetalBendNotes which hides all bend notes. When using this first BlankSketch activates without the warning. Voila!

SolidworksApi macros
Comments 1
DM
DM 2024-05-08

Okay, but now I'm curious how you identify the bend line sketch.  It feels like you could use IFeature::Name and just trust that the name of the bend line sketch always starts with "Bend-Lines", but I feel like there has to be a more foolproof way of sorting that out.