MEichWey
Industrial
- Apr 16, 2014
- 39
Hello,
How can I move a complete DatumCsys - 3 DatumPlanes, 3 DatumAxis, 1 Point and 1 CSys to a new Layer with a VisualBasic Script?
I have a Script for that, but it does not move the Point and the Csys of the DatumCsys to the new Layer.
Here is the Code I used:
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
Dim Layno As Integer
Layno = 41
Dim displayModification1 As DisplayModification
displayModification1 = theSession.DisplayManager.NewDisplayModification()
Dim objArray(0) As DisplayableObject
For Each ksobj As DisplayableObject In workPart.Datums
Dim ks_feat As NXOpen.Tag = NXOpen.Tag.Null
ufs.Modl.AskObjectFeat(ksobj.Tag, ks_feat)
If ks_feat <> NXOpen.Tag.Null Then
Dim datumfeat As NXOpen.Features.Feature = NXOpen.Utilities.NXObjectManager.Get(ks_feat)
If datumfeat.FeatureType.StartsWith("DATUM_CSYS") Then
objArray(0) = ksobj
workPart.Layers.MoveDisplayableObjects(Layno, objArray)
End If
End If
Next
End Sub
End Module
Can anyone help me with that problem??
With best Regards!
How can I move a complete DatumCsys - 3 DatumPlanes, 3 DatumAxis, 1 Point and 1 CSys to a new Layer with a VisualBasic Script?
I have a Script for that, but it does not move the Point and the Csys of the DatumCsys to the new Layer.
Here is the Code I used:
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
Dim Layno As Integer
Layno = 41
Dim displayModification1 As DisplayModification
displayModification1 = theSession.DisplayManager.NewDisplayModification()
Dim objArray(0) As DisplayableObject
For Each ksobj As DisplayableObject In workPart.Datums
Dim ks_feat As NXOpen.Tag = NXOpen.Tag.Null
ufs.Modl.AskObjectFeat(ksobj.Tag, ks_feat)
If ks_feat <> NXOpen.Tag.Null Then
Dim datumfeat As NXOpen.Features.Feature = NXOpen.Utilities.NXObjectManager.Get(ks_feat)
If datumfeat.FeatureType.StartsWith("DATUM_CSYS") Then
objArray(0) = ksobj
workPart.Layers.MoveDisplayableObjects(Layno, objArray)
End If
End If
Next
End Sub
End Module
Can anyone help me with that problem??
With best Regards!