Low Level User
Aerospace
- Jun 12, 2019
- 4
Hello,
Searching the forums I found very helpful information. cowski posted some NX Open code that I was hoping him or someone else could help me with.. The Code is to completely move datum Csys (origin, 3 axes, 3 planes) to a new layer.
I cant figure out how to specify to only move the datum csys from a particular layer. Ex. "move all datum csys completely from layer 2 to layer 99" And not effect the Datum Csys on say layer 3 they stay where they are at.
Here is the code i found before:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Features
Imports NXOpen.Utilities
Imports NXOpen.UF
Module ChangeDatums
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim ufs As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = theSession.ListingWindow
Const Layno As Integer = 41
For Each myFeature As Feature In workPart.Features
If TypeOf (myFeature) Is DatumCsys Then
'uncomment the following If block to skip internal features
'If myFeature.IsInternal Then
' Continue For
'End If
Dim csys_tag As Tag
Dim origin_tag As Tag
Dim daxes As Tag()
Dim dplanes As Tag()
ufs.Modl.AskDatumCsysComponents(myFeature.Tag, csys_tag, origin_tag, daxes, dplanes)
ufs.Obj.SetLayer(origin_tag, Layno)
ufs.Obj.SetLayer(csys_tag, Layno)
For Each thisObj As NXOpen.Tag In daxes
ufs.Obj.SetLayer(thisObj, Layno)
Next
For Each thisObj As NXOpen.Tag In dplanes
ufs.Obj.SetLayer(thisObj, Layno)
Next
End If
Next
End Sub
End Module
Searching the forums I found very helpful information. cowski posted some NX Open code that I was hoping him or someone else could help me with.. The Code is to completely move datum Csys (origin, 3 axes, 3 planes) to a new layer.
I cant figure out how to specify to only move the datum csys from a particular layer. Ex. "move all datum csys completely from layer 2 to layer 99" And not effect the Datum Csys on say layer 3 they stay where they are at.
Here is the code i found before:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Features
Imports NXOpen.Utilities
Imports NXOpen.UF
Module ChangeDatums
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim ufs As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = theSession.ListingWindow
Const Layno As Integer = 41
For Each myFeature As Feature In workPart.Features
If TypeOf (myFeature) Is DatumCsys Then
'uncomment the following If block to skip internal features
'If myFeature.IsInternal Then
' Continue For
'End If
Dim csys_tag As Tag
Dim origin_tag As Tag
Dim daxes As Tag()
Dim dplanes As Tag()
ufs.Modl.AskDatumCsysComponents(myFeature.Tag, csys_tag, origin_tag, daxes, dplanes)
ufs.Obj.SetLayer(origin_tag, Layno)
ufs.Obj.SetLayer(csys_tag, Layno)
For Each thisObj As NXOpen.Tag In daxes
ufs.Obj.SetLayer(thisObj, Layno)
Next
For Each thisObj As NXOpen.Tag In dplanes
ufs.Obj.SetLayer(thisObj, Layno)
Next
End If
Next
End Sub
End Module