3 Replies Latest reply on Oct 26, 2016 2:54 PM by Keith Rice

    Drawing Views

    Keith King

      I am a faculty member working on an Excel VBA grading program for uploaded student files (part, drawing, and assembly) in an introductory SolidWorks course.  I have a series of questions for drawing files that I have not been able to find answers for and would appreciate any help people could offer.  I am not very experienced with VBA or SolidWorks API, but have significant programming knowledge.


      1) Is there a way to get the specific view type?  Students are to upload drawings with the front, right side, top, and isometric views shown.  Is there a way to determine if these specific views are present or are all of these under the broad "regular" view category?

      2)  For a specific view, is there a way to determine if hidden lines are shown?  I have found a way to make them visible or disable, but have not found the ability to check to see if they are turned on/off.

      3)  For a specific view, is there a way to determine if tangent edges are shown?  Again, I found a way to turn them off and on, but no way to check to see the status.

      4)  Is there a way to compile the number of dimensions displayed for a given view?  The actual values of the dimensions are not necessary, just how many dimensions are visible.


      I have already spent a significant amount of time searching online for ways to do these, but have been unsuccessful.  I realize that these may or may not be easily accomplished in SolidWorks, but any help or specific links that anyone could offer on any of the questions above would be most appreciated.

        • Re: Drawing Views
          Josh Brady

          1) View::GetOrientationName

          2) View::GetDisplayMode2

          3) View::GetDisplayTangentEdges2

          4) View::GetDimensionCount


          Not intending to be a jerk, but this took me 5 minutes... The learning curve for the SolidWorks object model is much steeper than Excel's before you can achieve useful stuff.  If your goal is to learn it, understand it, and become proficient, by all means proceed! It's rewarding.  However, if your goal is to complete this one project, it might be more economical to write a small PO to someone who specializes in this sort of thing.  Depends on whether you have more time or money.  Keith Rice is a good resource for either learning or finished code.


          Also, I recommend using the offline API help rather than the web help.  Inside SolidWorks, point to "Help", then un-check "Use SOLIDWORKS Web Help".  Then point to Help->API Help.

            • Re: Drawing Views
              Keith King


              Thank you very much for your helpful reply and pointing me in the right direction.  It looks like each of these will work for what I need.  I appreciate the suggestions and I will check out the offline API help to see if it is easier to use.


              My goal is indeed to learn it and become more proficient so that we have a product that not only is usable, but also so that more features can be added slowly (as we have ideas about what to add) and so that it can be maintained long term.  Not only that, but it provides a fun side project to stretch myself and learn something new.


              Would you happen to know if there is a similar method for getting the dimension count for sketches in a part file?


              I really appreciate you pointing me in the right direction.  I should be able to add some program code now.

              • Re: Drawing Views
                Keith Rice

                Appreciate the recommendation, Josh, and great answer to Keith. I'll second you in saying that the local API Help is easier to navigate than the online API Help.


                Keith Rice

                SolidWorks API Training and Services