I'm working on a macro that adds a grid to the primary views (front, top, right) of an assembly drawing. So far, it works fine when the macro generates the drawing from scratch; I just call Create3rdAngleViews2() and there are only 3 views on the drawing to traverse (all of which conform to the grid that I want to draw). Now I want to be able to start the macro while the drawing is open so that the user can add grid features to an existing drawing or change the grid resolution.
When I iterate over the views on the active sheet, I need a way to determine whether or not the view is parallel to an axis of the coordinate system that the grid is referencing. The only problem is if the user has already drawn an isometric view, my macro needs skip that view and not attempt to draw a grid on it. I can't seem to find a method or property that will differentiate between isometric and (non-isometric, orthographic?) views.
I know that the Create3rdAngleViews2() will draw one "parent" view of type swDrawingNamedView with two views of type swDrawingProjectedView. Unfortunately, the isometric projected view is also of type swDrawingProjectedView. There appears to be a method GetOrientationName() that will return the name of the model view associated with a drawing view. Unfortunately, this returns an empty string when the views are of type swDrawingProjectedView. I've scoured the iview documentation looking for a method or property that will differentiate between orthographic and isometric views. The only workaround that I can think of is to look inside the ModelToViewTransform() and see if it describes a rotation of some multiple of 90 degrees. This seems like an awful lot more work than I want to do just to determine whether or not a drawing view is isometric or orthographic.
If anyone has a suggestion, please let me know
Thanks,
John
*edit: I am constrained to Solidworks 2012 API.
SolidworksApi macros