×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Delete all constraints from the assembly and subassemblies at once

Delete all constraints from the assembly and subassemblies at once

Delete all constraints from the assembly and subassemblies at once

(OP)
Hi to all.

There is anyway of deleting all contraints from a big assembly?


I have a big assembly, with a lot of sumassemblies. Each one has restrictions.

I would like to clean/delete all restrictions at once.

If I access to Constraints navigator I can´t delete subassemblies restrictions.

The only way I am able is expanding each subassembly in Assembly Navigator and deleting the restrictions.


Any help??

Airin
NX Designer

RE: Delete all constraints from the assembly and subassemblies at once

Hi,
Unfortunatly no without any VB journal

Regards
Didier Psaltopoulos
http://www.psi-cad.fr

RE: Delete all constraints from the assembly and subassemblies at once

(OP)
Hi Didier.
Thank you!

Airin
NX Designer

RE: Delete all constraints from the assembly and subassemblies at once

You Could use arrangements that ignore all constraints combined with making the component positions arrangement specific. Another useful feature is Override Component position which makes it possible to define new constraints at a higher assembly level.

RE: Delete all constraints from the assembly and subassemblies at once

Hi Petulf,
That could do the job but It seems to be time consuming

Regards
Didier Psaltopoulos
http://www.psi-cad.fr

RE: Delete all constraints from the assembly and subassemblies at once

After deleted all what you go to do.
re constraint ? Work without constraints ?

I'm only curious.

RE: Delete all constraints from the assembly and subassemblies at once

(OP)
Thanks to all. I have already found vb journal

Airin
NX Designer

RE: Delete all constraints from the assembly and subassemblies at once

Hi Airin,

Could you share it ?

Regards
Didier Psaltopoulos
http://www.psi-cad.fr

RE: Delete all constraints from the assembly and subassemblies at once

(OP)
Sorry for the delay.

This is the journal:

Option Strict Off
Imports System
Imports System.IO
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.UI
Imports NXOpen.Utilities
Imports NXOpen.Assemblies
Imports NXOpen.Positioning

Module delete_all_assembly_constraints
Public s As Session = Session.GetSession()
Public ufs As UFSession = UFSession.GetUFSession()
Public lw As ListingWindow = s.ListingWindow
Public dp As Part = s.Parts.Display
Public msg As NXMessageBox = UI.GetUI().NXMessageBox
Public Lsub_assembly As Collection = New Collection

Sub Main()
If (dp Is Nothing) Then
msg.Show("", NXOpen.NXMessageBox.DialogType.Error, "No Display Part !!!")
Return
End If

Try ' return a collection of all the sub_assembly in the displayed part
Lsub_assembly.Add(dp, dp.ToString)
Scan_Assembly(dp.ComponentAssembly.RootComponent, Lsub_assembly)
Catch e As Exception
End Try

Dim nom As String
Dim comp, parent As Component
For Each part As Part In Lsub_assembly
nom = Descriptive_Part_Name(part)
Echo("Part = " & nom)
Try
Dim save_arrangement = part.ComponentAssembly.ActiveArrangement

Dim marque As Session.UndoMarkId = s.SetUndoMark(Session.MarkVisibility.Visible, "Delete Constraints")

For Each a As Arrangement In part.ComponentAssembly.Arrangements
part.ComponentAssembly.ActiveArrangement = a
Echo(vbTab & "Arrangement = " & a.Name)
For Each c As ComponentConstraint In part.ComponentAssembly.Positioner.Constraints
s.UpdateManager.AddToDeleteList(c)
Echo(vbTab & vbTab & "Constraint deleted = " & c.Name)
Next
s.UpdateManager.DoAssemblyConstraintsUpdate(marque)

Next
part.ComponentAssembly.ActiveArrangement = save_arrangement

Catch ex As Exception
End Try
Next
ufs.Modl.Update()
End Sub
Private Sub Scan_Assembly(ByVal c As Component, ByRef Lsub_assembly As Collection)

Dim enfants As Component() = c.GetChildren()
Dim maquette As Part = CType(c.Prototype, Part)

If enfants.Length <> 0 And Not Lsub_assembly.Contains(maquette.ToString) Then
Lsub_assembly.Add(maquette, maquette.ToString)
End If

For Each comp As Component In enfants
Scan_Assembly(comp, Lsub_assembly)
Next

End Sub
Private Function Descriptive_Part_Name(ByVal part As Part) As String
Dim chaine() = part.FullPath.Split("\")

Descriptive_Part_Name = chaine(chaine.Length - 1)

End Function
Public Sub Echo(ByVal output As String)
lw.Open()
lw.WriteLine(output)
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
End Function
End Module

Airin
NX Designer

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources