6 Replies Latest reply on Apr 20, 2017 12:12 AM by Deepak Gupta

    Creating a Third Angle Drawing

    Sam Molony

      Hi,

       

      I have a program which creates a set of basic components and I would like to automate a simple third angle drawing with a few of the dimensions.

       

      Is there a specific line of code to do this while scaling the views to suit the sheet size?

       

      I have tried recording macros but no method I have tried has managed to import a view onto the sheet.

       

      Any help appreciated, cheers.

       

      Sam

        • Re: Creating a Third Angle Drawing
          Deepak Gupta

          Have you tried using Create3rdAngleViews2

            • Re: Creating a Third Angle Drawing
              Sam Molony

              Yes, I've tried that with the following code:

               

              Set Part = swApp.NewDocument("C:\ProgramData\SolidWorks\SOLIDWORKS 2016\templates\Drawing.drwdot", 2, 0.2794, 0.4318)

              boolstatus = Part.Create3rdAngleViews2(swApp.GetCurrentMacroPathFolder & "\HPC_Screw_" & PartNo & ".SLDPRT")

              Set Part = swApp.ActiveDoc

              myModelView.FrameLeft = 0

              myModelView.FrameTop = 0

              Set myModelView = Part.ActiveView

              myModelView.FrameState = swWindowState_e.swWindowMaximized

              swApp.ActivateDoc2 swApp.GetCurrentMacroPathFolder & "\HPC_Screw_" & PartNo & ".SLDPRT", False, longstatus

              Set Part = swApp.ActiveDoc

              Set myModelView = Part.ActiveView

              myModelView.FrameState = swWindowState_e.swWindowMaximized

               

               

              It will open a drawing document but no views are created.

                • Re: Creating a Third Angle Drawing
                  Deepak Gupta

                  I suspect on this line swApp.GetCurrentMacroPathFolder & "\HPC_Screw_" & PartNo & ".SLDPRT" Is the model path correct?

                   

                  Could you share the complete macro you're trying to use?

                    • Re: Creating a Third Angle Drawing
                      Sam Molony

                      Just before the code I sent you, I saved the part using this line:

                       

                      longstatus = Part.SaveAs3(swApp.GetCurrentMacroPathFolder & "\HPC_Screw_" & PartNo & ".SLDPRT", 0, 2)

                       

                      I will send the macro if this doesn't help.

                       

                      Cheers

                        • Re: Creating a Third Angle Drawing
                          Deepak Gupta

                          Sam, I used the following codes and it worked as expected.

                           

                          Sub main()   
                              Dim swApp                   As SldWorks.SldWorks
                              Dim swModel                 As SldWorks.ModelDoc2
                              Dim swDraw                  As SldWorks.DrawingDoc
                          
                              Set swApp = Application.SldWorks
                              Set swModel = swApp.ActiveDoc 'Active Part/Assy model
                              Set swDraw = swApp.NewDocument("C:\ProgramData\SolidWorks\SOLIDWORKS 2016\templates\Drawing.drwdot", 2, 0.2794, 0.4318) ' New Drawing
                              swDraw.Create3rdAngleViews2 swModel.GetPathName 'Places view
                          
                          End Sub
                          

                           

                          So to me looks like something not correct in macro or the file. Can you attach a sample part file and the full macro.