AnsweredAssumed Answered

GetPolylines... for outline only?

Question asked by David Mandl on Dec 22, 2015
Latest reply on Dec 23, 2015 by Amen Allah Jlili

My colleague and I are creating a script to create some basic dimensions on sheet metal parts.  Naturally, part one of that process involves enumerating the lines in a view (you can't dimension what you don't know is there).  To that end, we've been using IView.GetPolylines7().  I'd say that it's working pretty well, but there is a downside.


In our application, we're really only interested in the outline of the view (it's a flat pattern view, it's mostly being utilized after the flat is cut, so no need to dimension internal features).  It's probably a low percentage of parts that would be impacted by this, but it'd be great if the array we get at that part of our code excluded interior features.


I'm hoping that I've simply missed something, but I can't find a function in the help files that is "like GetPolylines7(), but only the outline".  (Hopefully one of you can tell me how wrong and foolish I am)  The closest workarounds I can come up with is one of the following:

  • Piggy-back off of the example for IModeler.GetBodyOutline2().  Make a sketch for the outline in the part, then use... something... to enumerate those sketch entities and locate them in the flat view.  Truth be told, I haven't yet thought through exactly how we'd use the sketch data.  We haven't yet tested if GetPolylines7() would pick up sketch entities and/or differentiate them from the model edges, but we'll cross that bridge when we get to it..
  • The output array for GetPolylines7 gives us start and endpoints for each line/arc/etc.  This will likely get convoluted (maybe not too bad... a new column on the outline and a looping sub to mark each entity in the array?), but I suppose it's possible to use that data to understand which entities are sharing vertices, and therefore "select the loop"/"connect the dots" (so to speak) and get the outline that way.  The interior lines, for instance, aren't going to share vertices with the outline.  In other words my leftmost vertex will not be connected to a line, which is connected to another line, which is connected to another line (and so on) that's connected to an "interior feature".


I think my life is a lot easier if I don't have to force my colleague to go down either of those two roads.  It seems to me that it'd be a lot easier if there's a "get the outline polylines" function we can use in drawing views.