0 Replies Latest reply on Dec 13, 2017 2:15 AM by Vniiaen Vniiaen

    Macro does not put the required dimensions on the drawing

    Vniiaen Vniiaen

      Hi!

       

      I wrote a macro that executes this drawing and dimensioning (Figure 1).

       

       

      But I encountered such a problem. On the view "Drawing view3" you need to set the dimensions of 5 degrees and 45 degrees. But on the big drawing, the size is set only 45 degrees (Figure 2).

       

       

      I checked several different sizes and found out that sizes less than 10 degrees are not put on the drawing. When you run a separately recorded macro on the dimensioning data, it works fine -  all the necessary dimensions are put (Figure 3). Help to understand what the problem.

       

       

      The sketch shows the required dimensions (Figure 4).

       

       

      For dimensions, the property "not marked for the drawing" is supplied. The code from the recorded macro to insert only the given size added to the common macro to create a drawing of figure 1. There is no difference. I do not understand what the problem is.

       

      Simple macro:

      Dim swApp As Object

      Dim Part As Object

      Dim boolstatus As Boolean

      Dim longstatus As Long, longwarnings As Long

       

      Sub main()

      Set swApp = _

      Application.SldWorks

      Set Part = swApp.ActiveDoc

      boolstatus = Part.Extension.SelectByID2("Drawing view3", "DRAWINGVIEW", 0.378520322952433, 0.29807703924775, 0, False, 0, Nothing, 0)

      Dim vAnnotations As Variant

      vAnnotations = Part.InsertModelAnnotations3(0, swInsertDimensionsNotMarkedForDrawing, False, True, False, True)

      End Sub

       

      General macro:

      ...

      Dim vAnnotations As Variant

       

      boolstatus = Part.ActivateView("Drawing view1")

      boolstatus = Part.Extension.SelectByID2("Drawing view1", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)

      vAnnotations = Part.InsertModelAnnotations3(0, swInsertDimensionsNotMarkedForDrawing, False, True, False, True)

      Part.ClearSelection2 True

       

      Set Part = swApp.ActiveDoc

      boolstatus = Part.Extension.SelectByID2("Drawing view3", "DRAWINGVIEW", 0.378520322952433, 0.29807703924775, 0, False, 0, Nothing, 0)

      vAnnotations = Part.InsertModelAnnotations3(0, swInsertDimensionsNotMarkedForDrawing, False, True, False, True)

      ...

       

      Thanks!