0 Replies Latest reply on Jun 13, 2016 11:54 AM by Chiheb Gouta

    Interference test increment

    Chiheb Gouta

      Experts,

       

      I am performing interference detection with API on SOLIDWORKS 2016 with the code implemented with VB.NET. I move a component then I detect the interference.

      I have a problem on the increment: For now, I choose the increment as the minimum edge of the bounding box of each moving component,

      but this method does not generate accurate results.

       

      I thought about thickness analysis implementation so I take as an increment the minimum thickness within the moving component so I guarantee that my component can collide with each eventual component in its direction and here is the code :

       

          Private Function Min_Thikness_Calculation(ByRef swmodel3 As ModelDoc2) As Double
      
              Dim swModel As ModelDoc2
              Dim utAddIn As gtcocswUtilities
              Dim utThicknessAnalysis As gtcocswThicknessAnalysis
              Dim nOption As gtResultOptions_e
              Dim nResolution As gttckResolutionOptions_e
              Dim strReportName As String
              Dim lStatus As Long
              Dim bAddToBinder As Boolean
              Dim bSaveToEdwg As Boolean
              Dim bOverWrite As Boolean
              Dim dThicknessLimit As Double
              Dim errorCode As Long
              Dim name As String
              '-------------------------'
              swModel = iSwApp.ActivateDoc3(name, False, swRebuildOnActivation_e.swRebuildActiveDoc, longstatus)
              '-------------------------'
              ' Load the SOLIDWORKS Utilities add-in
              utAddIn = iSwApp.GetAddInObject("Utilities.UtilitiesApp")
              ' Get the thickness analysis tool
              utThicknessAnalysis = utAddIn.ThicknessAnalysis
              ' Initialize the thickness analysis tool
              lStatus = utThicknessAnalysis.Init()
              'If Not errorCode = gtError_e.gtNOErr Then
              ' Save the report
              nOption = gtResultOptions_e.gtResultSaveReport
              ' Use high resolution
              nResolution = gttckResolutionOptions_e.gttckHighResolution
              ' Save the report to this folder
              strReportName = "c:\test\report"
              ' Add the report to the Design Binder
              bAddToBinder = True
              ' Do not save the report to eDrawings
              bSaveToEdwg = False
              ' Allow the report to be overwritten, both in Design Binder and
              ' on disk, so that you can rerun the analysis
              bOverWrite = True
              ' Set the thickness threshold
              dThicknessLimit = 0.5
              ' Run the analysis
              lStatus = utThicknessAnalysis.RunThinAnalysis2(dThicknessLimit, nResolution, nOption, strReportName, bAddToBinder, bSaveToEdwg, bOverWrite)
      
              ' Check the result
      
                  ' Close the thickness analysis tool
                  lStatus = utThicknessAnalysis.Close()
      
                  ' Release
                  utThicknessAnalysis = Nothing
                  utAddIn = Nothing
              
              Dim Min As Double = CDbl(utThicknessAnalysis.GetMinTckOnAnalArea(lStatus))
              ' Close the thickness analysis tool
              lStatus = utThicknessAnalysis.Close()
      
              ' Release
              utThicknessAnalysis = Nothing
              utAddIn = Nothing
      
              ' Done
              Min_Thikness_Calculation = Min * 1000
      
              iSwApp.CloseDoc(swmodel3.GetTitle)
          Exit Function
          End Function
      

       

      But This code do not give me the increment that I want:

      For example for this part I want the thickness (A) as an increment but the result of the minimum thickness by the previous code is :  0.0264368104020076 mm and in the picture as you see there is a thickness equal to 0.6147 mm.

       

      Thickness analysis.png

      Can anyone help to choose the right increment whether by thickness analysis implementation or an other method and thank you in advance.