Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
mports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.UI
Imports NXOpen.Utilities
Module make_ref_set
Sub Main()
Dim s As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim origin(2) As Double
Dim matrix(8) As Double
Dim ref_set_tag As NXOpen.Tag
Dim cntr As Integer
Dim disp_props As New NXOpen.UF.UFObj.DispProps
ufs.Mtx3.Identity(matrix)
Dim all_bodies() As Body = s.Parts.Work.Bodies.ToArray()
Dim body_tags(all_bodies.Length - 1) As Tag
For i As Integer = 0 To all_bodies.Length - 1
ufs.Obj.AskDisplayProperties(all_bodies(i).Tag, disp_props)
If disp_props.layer = 1 Then
body_tags(cntr) = all_bodies(i).Tag
cntr = cntr + 1
End If
Next
ufs.Assem.CreateRefSet("MY_REF_SET", origin, matrix, body_tags, cntr, ref_set_tag)
If ref_set_tag <> NXOpen.Tag.Null Then
MsgBox("ref_set_tag: " & ref_set_tag.ToString)
End If
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = UFConstants.UF_UNLOAD_IMMEDIATELY
End Function
End Module
Option Strict Off
Imports System
Imports NXOpen
Module NXJournal
Sub Main (ByVal args() As String)
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Create New Reference Set")
Dim referenceSet1 As ReferenceSet
referenceSet1 = workPart.CreateReferenceSet()
Dim markId3 As Session.UndoMarkId
markId3 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Add Components to Reference Set")
Dim markId4 As Session.UndoMarkId
markId4 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Edit Name of Reference Set")
referenceSet1.SetName("test1")
[highlight #FCE94F]referenceSet1.SetAddComponentsAutomatically(False,False)[/highlight]
Dim nErrs2 As Integer
nErrs2 = theSession.UpdateManager.DoUpdate(markId4)
theSession.DeleteUndoMarksUpToMark(markId3, Nothing, False)
End Sub
End Module
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.UI
Imports NXOpen.Utilities
Module Module118
Sub Main()
Dim s As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim markId2 As Session.UndoMarkId
markId2 = s.SetUndoMark(Session.MarkVisibility.Visible, "Create New Reference Set")
Dim origin(2) As Double
Dim matrix(8) As Double
Dim ref_set_tag As NXOpen.Tag
Dim cntr As Integer
Dim disp_props As New NXOpen.UF.UFObj.DispProps
ufs.Mtx3.Identity(matrix)
Dim all_bodies() As Body = s.Parts.Work.Bodies.ToArray()
Dim body_tags(all_bodies.Length - 1) As Tag
For i As Integer = 0 To all_bodies.Length - 1
ufs.Obj.AskDisplayProperties(all_bodies(i).Tag, disp_props)
If disp_props.layer = 1 Then
body_tags(cntr) = all_bodies(i).Tag
cntr = cntr + 1
End If
Next
ufs.Assem.CreateRefSet("MY_REF_SET", origin, matrix, body_tags, cntr, ref_set_tag)
Dim myNewRefSet As ReferenceSet = Nothing
If ref_set_tag <> NXOpen.Tag.Null Then
MsgBox("ref_set_tag: " & ref_set_tag.ToString)
myNewRefSet = Utilities.NXObjectManager.Get(ref_set_tag)
myNewRefSet.SetAddComponentsAutomatically(False, False)
End If
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = UFConstants.UF_UNLOAD_IMMEDIATELY
End Function
End Module
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.UI
Imports NXOpen.Utilities
Module create_ref_set_of_all_solid_bodies_on_layer_one
Sub Main()
Dim s As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim markId2 As Session.UndoMarkId
markId2 = s.SetUndoMark(Session.MarkVisibility.Visible, "Create New Reference Set")
Dim origin(2) As Double
Dim matrix(8) As Double
Dim ref_set_tag As NXOpen.Tag
Dim cntr As Integer
Dim disp_props As New NXOpen.UF.UFObj.DispProps
ufs.Mtx3.Identity(matrix)
Dim all_bodies() As Body = s.Parts.Work.Bodies.ToArray()
Dim body_tags(all_bodies.Length - 1) As Tag
For i As Integer = 0 To all_bodies.Length - 1
ufs.Obj.AskDisplayProperties(all_bodies(i).Tag, disp_props)
If disp_props.layer = 1 Then
body_tags(cntr) = all_bodies(i).Tag
cntr = cntr + 1
End If
Next
ufs.Assem.CreateRefSet("MY_REF_SET", origin, matrix, body_tags, cntr, ref_set_tag)
If ref_set_tag <> NXOpen.Tag.Null Then
MsgBox("ref_set_tag: " & ref_set_tag.ToString)
ufs.Assem.SetAutoAddNewComps(ref_set_tag, False)
End If
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = UFConstants.UF_UNLOAD_IMMEDIATELY
End Function
End Module
referenceSet1.SetAddComponentsAutomatically(False,False)
referenceSet1.RemoveObjectsFromReferenceSet(components1)
For each component1 As NXOpen.Assemblies.Component in ...
[indent]referenceSet1.RemoveObjectsFromReferenceSet(component1) [/indent]
next