how to turn off draft analysis?

I modified Andrew Jackson’s cool zebra stripe hack so it sets image quality (SetTessellationQuality) to “100”. I am trying to create another macro that sets the image quality back to “8” and turns off draft analysis (to help prevent users from saving oversize part files).

I got the image quality changes done, but I cannot figure out how to turn off the draft analysis. I was able to change display modes, but that doesn’t kill draft analysis. I could use some help.

Thanks

Dwight


Dim swApp As Object
Dim swModel As Object

Sub main()

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc

’ Set the image quality to coarse
swModel.SetTessellationQuality 8

End Sub

For once I found that recording a macro helped write a macro. I find that . . .

myModelView.FrameState = swWindowState_e.swWindowMaximized
longstatus = swApp.CallBack(“sldanalysistoolsu@MoldHideDraftAnalysisResults”, 0, “”)

. . . turns it off.

Now I find that a “100” tessellation quality takes it to only the bottom of the red zone, not high enough for looking at zebra stripes.

. . . but a “1000” tessellation takes it to the very top. The difference is this . . .
image.png
. . . and this . . .
image.png
However, there’s still something wrong, not always making the change.

Dwight

I can’t get this to work.

Case 1: starting with tessellation set manually to low, the line . . .

swModel.SetTessellationQuality 1000

. . . sets the image quality slider to the top of the red, but the image quality shows a tessellation that’s only about at the bottom of the red. I can then use macro commands to move the tessellation setting anywhere, but the actual image quality never goes above the bottom of the red.

Case 2: starting with tessellation set manually to the top of the red, the actual image quality is at the top of the red. I can then use macro commands to move the tessellation setting anywhere, and when I use the line . . .

swModel.SetTessellationQuality 1000

. . . it sets both the image quality slider and the actual image quality to the top of the red.

I don’t know what it is about setting it manually that makes a difference.

Dwight

Is this a System Options and Document Setting thing?

If you can show how it is done manually, I will point to the right API call (if it exists).

1 Like

Glad to see you on here Amen!

2 Likes

Thank you @AlexLachance ! The SW community is something dear to my heart. I will go wherever they go.

Good on the forum owners for using Discourse. This is a 100% the right decision.

3 Likes

Thanks for your reply. I got this working with . . .

Sub main()

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set Part = swApp.ActiveDoc
Set myModelView = Part.ActiveView

’ Turn off draft analysis
myModelView.FrameState = swWindowState_e.swWindowMaximized
longstatus = swApp.CallBack(“sldanalysistoolsu@MoldHideDraftAnalysisResults”, 0, “”)

’ Set the image quality to coarse
swModel.SetTessellationQuality 10

’ Redraw
Part.GraphicsRedraw2

End Sub

1 Like

Curious, where did you find this line? MoldHideDraftAnalysisResults is exposed as a public member in sldanalysistoolsu’s AddIn class?

Amen

Sorry, I have no idea at this point. To construct a macro I blindly search for code, find scrapes, mix it up, beat my head against my desk.

Dwight

3 Likes

It’s exported from the DLL:

C:\Program Files\Microsoft Visual Studio\2022\Professional>dumpbin /exports "c:\Program Files\SolidWorks Corp\SOLIDWORKS (2)\sldanalysistoolsu.dll"
Microsoft (R) COFF/PE Dumper Version 14.32.31336.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file c:\Program Files\SolidWorks Corp\SOLIDWORKS (2)\sldanalysistoolsu.dll

File Type: DLL

  Section contains the following exports for sldanalysistoolsu.dll

    00000000 characteristics
    FFFFFFFF time date stamp
        0.00 version
           1 ordinal base
          27 number of functions
          27 number of names

    ordinal hint RVA      name

          1    0 0000224D DllCanUnloadNow
          2    1 00002874 DllGetClassObject
          3    2 000011E5 DllRegisterServer
          4    3 00002491 DllUnregisterServer
          5    4 000023AB GetFaceCountInEachDraftType
          6    5 000027B6 GetFaceCountInEachUndercutType
          7    6 0000114F HideDraftAnalysisResults
          8    7 00002D60 HideUndercutAnalysisResults
          9    8 0000154B IsDraftDynamicDisplayOn
         10    9 00002973 IsGPUAnalysisEnabled
         11    A 000026E4 IsPartingLineDynamicDisplayOn
         12    B 00002784 IsUndercutDynamicDisplayOn
         13    C 00001B45 MoldDraftAnalysis
         14    D 0000101E MoldHideDraftAnalysisResults
         15    E 00002158 MoldHideUndercutAnalysisResults
         16    F 00001B04 MoldUndercutAnalysis
         17   10 00002B35 OnDisplayDraftAnalysis
         18   11 00002239 OnDisplayPartingLineAnalysis
         19   12 000018B6 OnDisplayUndercutAnalysis
         20   13 00001285 OnDraftAnalysis
         21   14 000018B1 OnModifyDraftAnalysis
         22   15 00001B09 OnModifyPartingLineAnalysis
         23   16 000020E5 OnModifyUndercutAnalysis
         24   17 0000246E OnPartingLineAnalysis
         25   18 000024B9 OnUndercutAnalysis
         26   19 0000221B ShowDraftAnalysisResults
         27   1A 00002AD1 ShowUndercutAnalysisResults