Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Journal To Move Assembly Constraints To Layer

Status
Not open for further replies.

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!!!
 
Replies continue below

Recommended for you

I think Constraints , like features cannot be moved to a separate layer.



John Joyce
Manufacturing Engineer

NX 11 & 12.01 Vericut 8.0.3

If I asked people what they wanted, they would have said faster horses

- Henry Ford
 
If you choose the "move to layer" function, "assembly constraint" is an option in the filter window. I've used this many times to organize the display, and am also very interested in automating this operation.

NX 12.0.1.7 Windows 10
 
There is a DisplayedConstraint object type that is used to represent the constraint in the graphics window. These objects inherit from the DisplayableObject type and can be hidden, moved to a new layer, etc. If you have a reference to a constraint object, use its .GetDisplayedConstraint method to get the corresponding displayed constraint.

www.nxjournaling.com
 
Do you have a good reason why move these ?

Regards,
Tomas

 
Yes, I need to draw up a lot of models, and I want to automate it. But I still didnt finish a journal...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor