DatumPlane
DatumPlane
(OP)
How do I get a handle on the DatumPlane that is in the workpart. I developed this code and having a problem debugging it.
CODE --> vb.net
Function GetDatumPlanes(ByVal in_part As Part) As DatumPlane()
Dim a_DatumPlane As Tag = NXOpen.Tag.Null
Dim type, subtype As Integer
Dim bList As ArrayList = New ArrayList
Do
theUFsession.Obj.CycleObjsInPart(in_part.Tag, _
UFConstants.UF_datum_plane_type, a_DatumPlane)
If Not a_DatumPlane.Equals(NXOpen.Tag.Null) Then
theUFsession.Obj.AskTypeAndSubtype(a_DatumPlane, type, subtype)
If subtype = UFConstants.UF_datum_object_subtype Then
bList.Add(Utilities.NXObjectManager.Get(a_DatumPlane))
End If
End If
Loop While Not a_DatumPlane.Equals(NXOpen.Tag.Null)
Return bList.ToArray(GetType(DatumPlane))
End Function 




RE: DatumPlane
CODE
Option Strict Off Imports System Imports System.Collections.Generic Imports NXOpen Imports NXOpen.UF Module Module1 Dim theSession As Session = Session.GetSession() Dim theUfSession As UFSession = UFSession.GetUFSession Sub Main() If IsNothing(theSession.Parts.BaseWork) Then 'active part required Return End If Dim workPart As Part = theSession.Parts.Work Dim lw As ListingWindow = theSession.ListingWindow lw.Open() Const undoMarkName As String = "report datum planes" Dim markId1 As Session.UndoMarkId markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName) Dim myPlanes As New List(Of DatumPlane) myPlanes = GetDatumPlanes(workPart) lw.WriteLine("number of datum planes: " & myPlanes.Count.ToString) Dim myPlanes2 As New List(Of DatumPlane) myPlanes2 = GetDatumPlanes2(workPart) lw.WriteLine("number of datum planes: " & myPlanes2.Count.ToString) lw.Close() End Sub Function GetDatumPlanes(ByVal thePart As Part) As List(Of DatumPlane) Dim theDatumPlanes As New List(Of DatumPlane) For Each temp As DisplayableObject In thePart.Datums If TypeOf (temp) Is DatumPlane Then theDatumPlanes.Add(temp) End If Next Return theDatumPlanes End Function Function GetDatumPlanes2(ByVal thePart As Part) As List(Of DatumPlane) Dim theDatumPlanes As New List(Of DatumPlane) Dim a_DatumPlane As Tag = NXOpen.Tag.Null Do theUfSession.Obj.CycleObjsInPart(thePart.Tag, UFConstants.UF_datum_plane_type, a_DatumPlane) If Not a_DatumPlane.Equals(NXOpen.Tag.Null) Then theDatumPlanes.Add(Utilities.NXObjectManager.Get(a_DatumPlane)) End If Loop While Not a_DatumPlane.Equals(NXOpen.Tag.Null) Return theDatumPlanes End Function Public Function GetUnloadOption(ByVal dummy As String) As Integer 'Unloads the image immediately after execution within NX GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately End Function End Modulewww.nxjournaling.com
RE: DatumPlane
RE: DatumPlane
www.nxjournaling.com