Moritero
Mechanical
- Apr 14, 2019
- 2
Hello!
I have a pretty basic question.
I am trying to write a journal to move assembly constraints to specific layer.
I can write the journal works with bodies:
"Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.NXObject
Module Module1
Sub Main()
Dim theSession As Session = Session.GetSession()
If IsNothing(theSession.Parts.BaseWork) Then
Return
End If
Dim workPart As Part = theSession.Parts.Work
' Bodies to layer 1
Const BodiesLayer As Integer = 1
Dim displayModification2 As DisplayModification
displayModification2 = theSession.DisplayManager.NewDisplayModification()
displayModification2.NewLayer = BodiesLayer
displayModification2.Apply(workPart.Bodies.ToArray)
displayModification2.Dispose()
End Sub
End Module"
And it works fine. But with constrains it didnt work:
displayModification2.Apply(workPart.ComponentAssembly.Positioner.Constraints.ToArray)
Syntax errors:
Line:"It is not possible to convert a 1-D array from NXOpen.Positioning.Constraint to 1-D array from NXOpen.DisplayableObject, because NXOpen.Positioning.Constraint is not derived from NXOpen.DisplayableObject"
Any help would be greatly appreciated!!!
I have a pretty basic question.
I am trying to write a journal to move assembly constraints to specific layer.
I can write the journal works with bodies:
"Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.NXObject
Module Module1
Sub Main()
Dim theSession As Session = Session.GetSession()
If IsNothing(theSession.Parts.BaseWork) Then
Return
End If
Dim workPart As Part = theSession.Parts.Work
' Bodies to layer 1
Const BodiesLayer As Integer = 1
Dim displayModification2 As DisplayModification
displayModification2 = theSession.DisplayManager.NewDisplayModification()
displayModification2.NewLayer = BodiesLayer
displayModification2.Apply(workPart.Bodies.ToArray)
displayModification2.Dispose()
End Sub
End Module"
And it works fine. But with constrains it didnt work:
displayModification2.Apply(workPart.ComponentAssembly.Positioner.Constraints.ToArray)
Syntax errors:
Line:"It is not possible to convert a 1-D array from NXOpen.Positioning.Constraint to 1-D array from NXOpen.DisplayableObject, because NXOpen.Positioning.Constraint is not derived from NXOpen.DisplayableObject"
Any help would be greatly appreciated!!!