Search code examples
apisolidworks

- SolidWorks API - View outline and inner boundaries


I am working on the SolidWorks app to detect if the view overlaps or not. If we use the view outlines to detect if the view overlap or not is not always correct. as shown below. enter image description here

I would like to get the outline for the inner rectangle show in the diagram. The swView.getOutline gives the rectangle that is much bigger than the original view. as shown below.

enter image description here


Solution

  • Using the following View Scale Macro. I manage to find the approximate inner rectangle. It's not the best solution, whereas it's not complex and it's not with heavy computation like other available solutions

    double[] outline = view.GetOutline();
      outline[0] += BorderWidth;
      outline[1] += BorderWidth;
      outline[2] -= BorderWidth;
      outline[3] -= BorderWidth;