7 Replies Latest reply on Jun 10, 2018 4:33 AM by Deepak Gupta

    Effects of macro fully execute after opening document properties and exiting

    Ben Langdon

      I made a macro that changes the default standard to ansi from iso, then changes the ordinate dimensions back to iso and changes the arrow head back to a slash.

      The reason why I am ultimately doing this is after setting the document to ansi i still want the chain dimensions on the ordinate dims. If this is the only way to go about doing this, here is the code.


      My problem with the code below, is that it doesn't take full effect unless i open up document properties and then close the window, does it fully work, thus putting the chain dimensions back on the ordinate dimensions.


      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

      ' Change Document to ansi

      boolstatus = Part.Extension.SetUserPreferenceInteger(swUserPreferenceIntegerValue_e.swDetailingDimensionStandard, 0, swDetailingStandard_e.swDetailingStandardANSI)

      ' Ordinate to ISO

      boolstatus = Part.Extension.SetUserPreferenceInteger(swUserPreferenceIntegerValue_e.swDetailingDimensionStandard, swUserPreferenceOption_e.swDetailingOrdinateDimension, swDetailingStandard_e.swDetailingStandardISO)

      'Dimensions head to Slash

      boolstatus = Part.Extension.SetUserPreferenceInteger(swUserPreferenceIntegerValue_e.swDetailingArrowStyleForDimensions, swUserPreferenceOption_e.swDetailingDimension, swArrowStyle_e.swSLASH_ARROWHEAD)

      End Sub


      I will try and post the a document that this works on tomorrow, as i can't show what i am working on. thanks for the help.