Marc A Jeeves



I'm building an application to dynamically create Jira tickets from an Interference simulation,  the problem I have right out of the gate, is getting the "InterferenceServices" it fails straight away either early or late bound.

Set ITFServices = CATIA.ActiveEditor.GetService("InterferenceServices") 

The RootOccurence is my initial assembly that has two sub assemblies ( my clash groups) and I want to create a new Interference simulation with these two clash groups


see attached image for error


Can anybody help



Sub CATMain() 

   ' Creation of a part body's view in assembly context 
   ' -------------------------------------------------- 

   ' 1/ Creates the Simulation 
   ' 2/ Sets the Interferences Groups 
   ' 3/ Executes the Simulation and compute the Interferences Results 
   ' 4/ Processes the Results 

   ' 1/ Creates the Simulation 
   ' ------------------------- 
   ' Gets the Root Reference 
   Dim RootOcc As VPMRootOccurrence 
   Set RootOcc = CATIA.ActiveEditor.ActiveObject 

   Dim RootRef As VPMReference 
   Set RootRef = RootOcc.ReferenceRootOccurrenceOf 

   ' Gets the Interference Service 
   Dim ITFServices As InterferenceServices 
   Set ITFServices = CATIA.ActiveEditor.GetService("InterferenceServices") 

   ' Creates the Simulation and sets its Specification Type and its Interference Groups Computation Type 
   Dim SpecificationType As CatInterferenceSpecificationType 
   SpecificationType = catInterferenceSpecificationTypeClash 

   Dim GroupCmpType2 As CatInterferenceGroupComputationType2 
   GroupCmpType2 = catInterferenceGroupComputationTypeGroupAgainstGroup 

   Dim ITFSimu As InterferenceSimulation 
   ITFServices.CreateInterferenceSimulation2 RootRef, GroupCmpType2, ITFSimu 

   ITFSimu.InterferenceSpecificationType = SpecificationType 

   ' 2/ Sets the Interferences Groups 
   ' -------------------------------- 
   ' Gets the SkateBody Occurence 
   Dim occSkateBody As VPMOccurrence 
   Set occSkateBody = RootOcc.Occurrences.Item(1) 

   ' Sets the Skate Body Group 
   Dim boardGroup As InterferenceGroupObjects 
   ITFSimu.GetGroupObjects 1, boardGroup 

   boardGroup.Add2 occSkateBody 

   ' Gets the TruckWheels Occurences 
   Dim occTruckWheel(1) As VPMOccurrence 
   Set occTruckWheel(0) = RootOcc.Occurrences.Item(2) 
   Set occTruckWheel(1) = RootOcc.Occurrences.Item(3) 

   ' Sets the Truck Group 
   Dim truckGroup As InterferenceGroupObjects 
   ITFSimu.GetGroupObjects 2, truckGroup 

   ' Creates the Wheel Group 
   Dim wheelGroup As InterferenceGroupObjects 
   ITFSimu.AddGroupObjects wheelGroup 

   ' Gets the Trucks Occurrences and the Wheels Occurrences and Adds them to their Group
   Dim occTruck As VPMOccurrence 
   Dim occWheel(1) As VPMOccurrence 
   For i = 0 To 1 
      ' Adds the Truck to the Truck Group 
      Set occTruck = occTruckWheel(i).Occurrences.Item(1) 
      truckGroup.Add2 occTruck 

      ' Adds the Wheels to the Wheel Group 
      Set occWheel(0) = occTruckWheel(i).Occurrences.Item(2) 
      wheelGroup.Add2 occWheel(0) 
      Set occWheel(1) = occTruckWheel(i).Occurrences.Item(3) 
      wheelGroup.Add2 occWheel(1) 

   ' 3/ Executes the Simulation and computes the Interferences Results 
   ' ---------------------------------------------------------------- 

   ' 4/ Processes the Results 
   ' ----------------------- 
   ' Gets the Interference Results
   Dim ListInterferences As InterferenceResults 
   Set ListInterferences = ITFSimu.InterferenceResults 
   ' Analizes each Result
   Dim oInterference As InterferenceResult 
   For i = 1 To ListInterferences.Count 
      Set oInterference = ListInterferences.Item(i) 
      If oInterference.Type = catInterferenceResultTypeContact Then 
         oInterference.UserType = catInterferenceResultUserTypeContact 
         oInterference.AnalysisStatus = catInterferenceResultStatusOK 
         oInterference.UserComment = "No problem" 
         oInterference.UserType = catInterferenceResultUserTypeUndefined 
         oInterference.AnalysisStatus = catInterferenceResultStatusKO 
         oInterference.UserComment = "Problem" 
      End If 
End Sub 

  • InterferenceServices Error.png (28.2k)
Edited By:
Marc A Jeeves[Gulfstream Aerospace Corporation] @ Aug 23, 2022 - 10:08 AM (America/Central)
Marc A Jeeves[Gulfstream Aerospace Corporation] @ Aug 23, 2022 - 10:08 AM (America/Central)

Little Cthulhu

RE: CATIA.ActiveEditor.GetService("InterferenceServices")
(in response to Marc A Jeeves)


Based on error message it's not getting service that fails but an assignment operator. VBA implicitly queries object returned by GetService to required interface (type) and fails to do so. 

It can be caused by an object itself (wrong object) or by interface being not registered or not exposed to Automation.

Where did you get "InterferenceServices" identifier string in the first place?