Message 1 of 4
Toggle through broken Constraints to repair
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I want to write an iLogic that finds a broken constraints in an assembly and opens the constraints edit window. The affected components are isolated, the others are hidden.
Is there a way in the script to wait for the user to close the window. Among other things, to reset the view at the end of the script?
Currently I'm manually running the rule twice to get backt to the original view.
option explicit on
Dim oAssemblyDoc As AssemblyDocument = ThisDoc.Document
Dim oPart1 As ComponentOccurrence
Dim oPart2 As ComponentOccurrence
Dim oView As DesignViewRepresentation
Dim oViewMerker As DesignViewRepresentation = ThisDoc.Document.ComponentDefinition.RepresentationsManager.ActiveDesignViewRepresentation
ThisDoc.Document.ComponentDefinition.RepresentationsManager.DesignViewRepresentations.item("Vorgabe").Activate
Try
ThisDoc.Document.ComponentDefinition.RepresentationsManager.DesignViewRepresentations.item("Reperatur").Delete
Catch
End Try
For Each oConstraint As AssemblyConstraint In oAssemblyDoc.ComponentDefinition.Constraints
If oConstraint.HealthStatus <> oConstraint.HealthStatus.kUpToDateHealth And _
oConstraint.HealthStatus <> oConstraint.HealthStatus.kSuppressedHealth Then
Try
ThisDoc.Document.ComponentDefinition.RepresentationsManager.DesignViewRepresentations.item("Reperatur").Activate
Catch
Logger.Info("Ansicht Reperatur nicht gefunden --> anlegen")
oView = ThisDoc.Document.ComponentDefinition.RepresentationsManager.DesignViewRepresentations.Add("Reperatur")
oView.Activate
End Try
oPart1 = oConstraint.OccurrenceOne
oPart2 = oConstraint.OccurrenceTwo
ThisApplication.CommandManager.DoSelect(oPart1)
ThisApplication.CommandManager.DoSelect(oPart2)
ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyIsolateCmd").Execute
ThisApplication.CommandManager.DoUnSelect(oPart1)
ThisApplication.CommandManager.DoUnSelect(oPart2)
ThisApplication.CommandManager.DoSelect(oConstraint)
ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyEditConstraintCtxCmd").Execute
ThisApplication.CommandManager.DoUnSelect(oConstraint)
Return
End If
Next