Have you ever needed to get the label or arc representing the detail view border from the parent view? Unfortunately, the detail view builder does not give you immediate access to these objects related to the detail view. Fortunately, they are not too difficult to track down. The following class will take either the detail view itself or the arc from the parent representing the view boundary and return the following information:
- DetailViewName - the name of the detail view
- ParentView - the view the detail view is taken from
- CenterPoint - the center point of the circular boundary (in the parent view)
- BoundingPoint1 - the first bounding point of the detail view; for circular detail views, this is the same as the center point
- BoundingPoint2 - the second bounding point of the detail view; for circular detail views, this is a point on the circumference
- BorderArc - this is the arc object on the parent view that represents the detail view border
- LabelOnParent - the label associated to the border arc, if one is created
WARNING: in its current form, this code only works on circular detail views.
This class was inspired by code on GTAC (nx_api6015, written by Frank Berger). When the detail view is created, NX associates the arc and label to the detail view; we can use some "smart object" methods to find and interrogate these relations. The code asks for the drafting view's smart object children to find the label. Unfortunately, the associativity with the border arc is more difficult to find. To find the border arc, given the detail view, we first look through all the arcs in the current work part (which should be your drawing) looking for those that have a drafting view as one of the smart parents. Since a view might be a parent view to multiple detail views, we need a way to check if this particular arc matches the information for the detail view. If/when an arc is found that is associated to a drafting view, we compare its center point to bounding point 1 of the detail view; if the coordinates match, we have found the border arc.
Class code
The code below cannot be run by itself, it needs other code to instantiate it and call its methods. If you do not have an author license, you can copy and paste this class code into your journal (an example will follow). Your journal code will make use of this class code, the class code should not be changed unless you find a bug or want to add new features.
'NXJournaling.com
'February 19, 2019
'This class helps get objects related to a detail view (circular view border and label on parent) that the detail view builder does not provide access to.
'Use the "New" method and pass in either the detail view itself OR the border arc (the arc drawn on the parent view representing the detail view border).
'The class will gather info and provide it through the following read only properties:
' DetailViewName the name of the detail view
' ParentView the view the detail view is taken from
' CenterPoint the center point of the circular boundary (in parent view)
' BoundingPoint1 the first bounding point defining the detail view boundary (same as center point for circular detail views)
' BoundingPoint2 the second bounding point defining the detail view boundary (for circular detail views this point is on the circumference of the defining arc)
' BorderArc the border arc on the parent view (returns Nothing if the label on parent type is set to "none")
' LabelOnParent the label on the border arc, returns nothing if there is no label on the parent (label on parent display option: none, circle, boundary)
'Update January 28, 2020
'Add code to return the label on parent, given the detail view
'March 31, 2021
'If the .LabelOnParent type is set to "none", return "nothing" for the label
'Required imports
'Imports System
'Imports System.Collections.Generic
'Imports NXOpen
'Imports NXOpen.UF
Public Class NXJ_DetailViewInfo
#Region "Private variables"
Private _theSession As Session = Session.GetSession
Private _theUfSession As UFSession = UFSession.GetUFSession()
Private lg As LogFile = _theSession.LogFile
Private lw As ListingWindow = _theSession.ListingWindow
Private _theDetailView As Drawings.DetailView
#End Region
Private _detailViewName As String = ""
Public ReadOnly Property DetailViewName() As String
Get
Return _detailViewName
End Get
End Property
Private _parentView As Drawings.DraftingView
Public ReadOnly Property ParentView() As Drawings.DraftingView
Get
Return _parentView
End Get
End Property
Private _centerPt As Point3d = Nothing
Public ReadOnly Property CenterPoint() As Point3d
Get
Return _centerPt
End Get
End Property
Private _boundPt1 As Point3d = Nothing
Public ReadOnly Property BoundingPoint1() As Point3d
Get
Return _boundPt1
End Get
End Property
Private _boundPt2 As Point3d = Nothing
Public ReadOnly Property BoundingPoint2() As Point3d
Get
Return _boundPt2
End Get
End Property
Private _borderArc As Arc = Nothing
Public ReadOnly Property BorderArc() As Arc
Get
Return _borderArc
End Get
End Property
Private _labelOnParent As Annotations.Label = Nothing
Public ReadOnly Property LabelOnParent() As Annotations.Label
Get
Return _labelOnParent
End Get
End Property
Public Sub New(ByVal theDetailView As Drawings.DetailView)
lg.WriteLine("Sub New, given detail view")
_theDetailView = theDetailView
_detailViewName = theDetailView.Name
'given the view, return the border arc
Me.GetViewBounds(theDetailView)
'The border arc (of a circular detail view) will be an arc where one of the smart object parents
'will be the parent view of the detail view and the arc center will match _centerPt (within modeling tolerance).
_borderArc = Me.FindBorderArc()
Me.GetLabelOnParent()
End Sub
Public Sub New(ByVal theBorderArc As Arc)
lg.WriteLine("Sub New, given the detail border arc")
_borderArc = theBorderArc
'given the border arc, return the detail view
Dim theDetailView As Drawings.DetailView = Me.FindDetailView(_borderArc)
If IsNothing(theDetailView) Then
_detailViewName = ""
Else
_detailViewName = theDetailView.Name
_theDetailView = theDetailView
Me.GetViewBounds(theDetailView)
Me.GetLabelOnParent()
End If
End Sub
Private Sub GetViewBounds(ByVal theDetailView As Drawings.DetailView)
lg.WriteLine("GetViewBounds")
Dim detailViewBuilder1 As Drawings.DetailViewBuilder = _theSession.Parts.Work.DraftingViews.CreateDetailViewBuilder(theDetailView)
'lw.WriteLine("label on parent: " & detailViewBuilder1.LabelOnParent.ToString)
lg.WriteLine("parent view: " & detailViewBuilder1.Parent.View.Value.Name)
lg.WriteLine("boundary point 1: " & detailViewBuilder1.BoundaryPoint1.Coordinates.ToString)
'lw.WriteLine("boundary point 2: " & detailViewBuilder1.BoundaryPoint2.Coordinates.ToString)
_boundPt1 = detailViewBuilder1.BoundaryPoint1.Coordinates
_boundPt2 = detailViewBuilder1.BoundaryPoint2.Coordinates
If detailViewBuilder1.Type = Drawings.DetailViewBuilder.Types.Circular Then
_centerPt = detailViewBuilder1.BoundaryPoint1.Coordinates
End If
_parentView = detailViewBuilder1.Parent.View.Value
detailViewBuilder1.Destroy()
lg.WriteLine("Exiting GetViewBounds")
lg.WriteLine("")
End Sub
Private Function FindBorderArc() As Arc
lg.WriteLine("FindBorderArc")
'TO DO: make sure arc is not view dependent
' the "view boundary" arc around the actual detail view is view dependent in the detail view,
' this is NOT the border arc we are looking for (the arc on the parent view that represents what the detail view shows).
For Each tempArc As Arc In _theSession.Parts.Work.Arcs
Dim arcParents As New List(Of NXObject)
GetSmartParents(tempArc, arcParents)
For Each tempParent As NXObject In arcParents
If TypeOf (tempParent) Is Drawings.DraftingView Then
lg.WriteLine("FindBorderArc: tempParent.Name: " & tempParent.Name)
lg.WriteLine("FindBorderArc: _parentView.Name: " & _parentView.Name)
lg.WriteLine("FindBorderArc: tempParent.Tag: " & tempParent.Tag.ToString)
lg.WriteLine("FindBorderArc: _parentView.Tag: " & _parentView.Tag.ToString)
If tempParent.Name <> _parentView.Name Then
lg.WriteLine("tempParent.Name <> _parentView.Name")
'this is not the arc we are looking for
'move along...
Continue For
End If
'if we get here, the view names match
'so far, so good
lg.WriteLine("view names match, checking points")
If Point3dEqual(tempArc.CenterPoint, _centerPt) Then
lg.WriteLine("points match, returning tempArc")
'parent views match and center points match
'this is it
'_borderArc = tempArc
Return tempArc
Else
lg.WriteLine("points do not match, check next parent")
End If
End If
Next
'lw.WriteLine("")
Next
'no more arcs, no matches found
lg.WriteLine("border arc = nothing")
'_borderArc = Nothing
Return Nothing
lg.WriteLine("Exiting FindBorderArc")
lg.WriteLine("")
End Function
Private Sub GetSmartParents(ByRef theSmartObject As NXObject, ByRef theParentList As List(Of NXObject))
Dim numParents As Integer
Dim theParentTags() As Tag = Nothing
Dim isSmart As Boolean = False
Try
_theUfSession.So.IsSo(theSmartObject.Tag, isSmart)
If isSmart Then
'lw.WriteLine("object is smart: " & theSmartObject.Tag.ToString)
_theUfSession.So.AskParents(theSmartObject.Tag, UFConstants.UF_SO_ASK_ALL_PARENTS, numParents, theParentTags)
For Each tempTag As Tag In theParentTags
Dim objParent As NXObject = Utilities.NXObjectManager.Get(tempTag)
'lw.WriteLine("adding " & objParent.GetType.ToString & " to parent list")
theParentList.Add(objParent)
GetSmartParents(objParent, theParentList)
Next
Else
'lw.WriteLine("object not smart: " & theSmartObject.Tag.ToString)
End If
Catch ex As NXException
'lw.WriteLine("error: " & ex.ErrorCode)
'lw.WriteLine(" " & ex.Message)
End Try
End Sub
Private Function Point3dEqual(ByVal pt1 As Point3d, ByVal pt2 As Point3d) As Boolean
If IsNothing(pt1) OrElse IsNothing(pt2) Then
Return False
End If
Dim modelingTolerance As Double
_theUfSession.Modl.AskDistanceTolerance(modelingTolerance)
lg.WriteLine("modeling distance tolerance: " & modelingTolerance.ToString)
If Math.Abs(pt1.X - pt2.X) > modelingTolerance Then
lg.WriteLine("X distance exceeds modeling tolerance")
Return False
End If
If Math.Abs(pt1.Y - pt2.Y) > modelingTolerance Then
lg.WriteLine("Y distance exceeds modeling tolerance")
Return False
End If
If Math.Abs(pt1.Z - pt2.Z) > modelingTolerance Then
lg.WriteLine("Z distance exceeds modeling tolerance")
Return False
End If
lg.WriteLine("points equal withing modeling distance tolerance")
Return True
End Function
Private Function FindDetailView(ByVal theBorderArc As Arc) As Drawings.DetailView
For Each tempView As Drawings.DraftingView In _theSession.Parts.Work.DraftingViews
If Not TypeOf (tempView) Is Drawings.DetailView Then
'only process detail views
Continue For
End If
Me.GetViewBounds(tempView)
Dim tempBorderArc As Arc
tempBorderArc = Me.FindBorderArc
If IsNothing(tempBorderArc) Then
Continue For
End If
If theBorderArc.Equals(tempBorderArc) Then
Return tempView
End If
Next
Return Nothing
End Function
Private Sub GetLabelOnParent()
'Get label on parent from detail view
'nx_api6015
Dim myChildList As New List(Of NXObject)
Dim numChildren As Integer
Dim childTags() As Tag = Nothing
_theUfSession.So.AskChildren(_theDetailView.Tag, UFConstants.UF_SO_ASK_ALL_CHILDREN, numChildren, childTags)
For Each tempTag As Tag In childTags
Dim someObj As NXObject = Utilities.NXObjectManager.Get(tempTag)
myChildList.Add(someObj)
Next
For Each obj As NXObject In myChildList
'lw.WriteLine("object: " & obj.GetType.ToString)
If TypeOf (obj) Is Annotations.Label Then
_labelOnParent = obj
End If
Next
End Sub
End Class
Example of using the class code
The code below shows how to call the class code and make use of the values it returns. In this case, the journal looks for every detail view in the current work part, displays the label text and origin, and changes the border arcs to color 149 (pale crimson in the default palette). To use the class, instantiate an instance with the "New" keyword and pass in either a detail view or the border arc. The NXJ_DetailViewInfo code will run automatically (no other method calls are necessary) and it will expose the information as properties of the NXJ_DetailViewInfo object.
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF
Module test2
Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession
Dim lw As ListingWindow = theSession.ListingWindow
Sub Main()
lw.Open()
Dim markId1 As NXOpen.Session.UndoMarkId = Nothing
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Edit Object Display")
Dim detailViewBorderArcs As New List(Of Arc)
'find border arc given a detail view
For Each tempView As Drawings.DraftingView In theSession.Parts.Work.DrawingSheets.CurrentDrawingSheet.SheetDraftingViews
If TypeOf (tempView) Is Drawings.DetailView Then
Dim myViewInfo As New NXJ_DetailViewInfo(tempView)
detailViewBorderArcs.Add(myViewInfo.BorderArc)
If IsNothing(myViewInfo.LabelOnParent) Then
lw.WriteLine("no label on parent view")
Else
lw.WriteLine("label on parent text: " & EvaluateText(myViewInfo.LabelOnParent))
lw.WriteLine("label origin: " & myViewInfo.LabelOnParent.AnnotationOrigin.ToString)
End If
End If
Next
If detailViewBorderArcs.Count > 0 Then
Dim displayModification1 As NXOpen.DisplayModification = Nothing
displayModification1 = theSession.DisplayManager.NewDisplayModification()
displayModification1.ApplyToAllFaces = True
displayModification1.ApplyToOwningParts = False
displayModification1.NewColor = 149
displayModification1.Apply(detailViewBorderArcs.ToArray)
Dim nErrs1 As Integer = Nothing
nErrs1 = theSession.UpdateManager.DoUpdate(markId1)
displayModification1.Dispose()
End If
lw.Close()
End Sub
Function EvaluateText(ByVal someNote As Annotations.NoteBase) As String
Dim aT As Annotations.AssociativeText = theSession.Parts.Work.Annotations.CreateAssociativeText()
Dim cData As Annotations.ComponentData = theSession.Parts.Work.Annotations.CreateComponentData(someNote)
For Each tC As Annotations.TextComponent In cData.GetTextComponents
Return aT.GetEvaluatedText(someNote, tC.GetText(0))
Next
Return Nothing
End Function
End Module
Full example
If you do not have an author license, all the code above needs to reside in a single file. I suggest creating a new, blank text file, copy & paste the journal code, then create a few blank lines, and copy & paste the class code. The final result can be run as a journal.
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF
Module test2
Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession
Dim lw As ListingWindow = theSession.ListingWindow
Sub Main()
lw.Open()
Dim markId1 As NXOpen.Session.UndoMarkId = Nothing
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Edit Object Display")
Dim detailViewBorderArcs As New List(Of Arc)
'find border arc given a detail view
For Each tempView As Drawings.DraftingView In theSession.Parts.Work.DrawingSheets.CurrentDrawingSheet.SheetDraftingViews
If TypeOf (tempView) Is Drawings.DetailView Then
Dim myViewInfo As New NXJ_DetailViewInfo(tempView)
detailViewBorderArcs.Add(myViewInfo.BorderArc)
If IsNothing(myViewInfo.LabelOnParent) Then
lw.WriteLine("no label on parent view")
Else
lw.WriteLine("label on parent text: " & EvaluateText(myViewInfo.LabelOnParent))
lw.WriteLine("label origin: " & myViewInfo.LabelOnParent.AnnotationOrigin.ToString)
End If
End If
Next
If detailViewBorderArcs.Count > 0 Then
Dim displayModification1 As NXOpen.DisplayModification = Nothing
displayModification1 = theSession.DisplayManager.NewDisplayModification()
displayModification1.ApplyToAllFaces = True
displayModification1.ApplyToOwningParts = False
displayModification1.NewColor = 149
displayModification1.Apply(detailViewBorderArcs.ToArray)
Dim nErrs1 As Integer = Nothing
nErrs1 = theSession.UpdateManager.DoUpdate(markId1)
displayModification1.Dispose()
End If
lw.Close()
End Sub
Function EvaluateText(ByVal someNote As Annotations.NoteBase) As String
Dim aT As Annotations.AssociativeText = theSession.Parts.Work.Annotations.CreateAssociativeText()
Dim cData As Annotations.ComponentData = theSession.Parts.Work.Annotations.CreateComponentData(someNote)
For Each tC As Annotations.TextComponent In cData.GetTextComponents
Return aT.GetEvaluatedText(someNote, tC.GetText(0))
Next
Return Nothing
End Function
End Module
'NXJournaling.com
'February 19, 2019
'This class helps get objects related to a detail view (circular view border and label on parent) that the detail view builder does not provide access to.
'Use the "New" method and pass in either the detail view itself OR the border arc (the arc drawn on the parent view representing the detail view border).
'The class will gather info and provide it through the following read only properties:
' DetailViewName the name of the detail view
' ParentView the view the detail view is taken from
' CenterPoint the center point of the circular boundary (in parent view)
' BoundingPoint1 the first bounding point defining the detail view boundary (same as center point for circular detail views)
' BoundingPoint2 the second bounding point defining the detail view boundary (for circular detail views this point is on the circumference of the defining arc)
' BorderArc the border arc on the parent view (returns Nothing if the label on parent type is set to "none")
' LabelOnParent the label on the border arc, returns nothing if there is no label on the parent (label on parent display option: none, circle, boundary)
'Update January 28, 2020
'Add code to return the label on parent, given the detail view
'March 31, 2021
'If the .LabelOnParent type is set to "none", return "nothing" for the label
'Required imports
'Imports System
'Imports System.Collections.Generic
'Imports NXOpen
'Imports NXOpen.UF
Public Class NXJ_DetailViewInfo
#Region "Private variables"
Private _theSession As Session = Session.GetSession
Private _theUfSession As UFSession = UFSession.GetUFSession()
Private lg As LogFile = _theSession.LogFile
Private lw As ListingWindow = _theSession.ListingWindow
Private _theDetailView As Drawings.DetailView
#End Region
Private _detailViewName As String = ""
Public ReadOnly Property DetailViewName() As String
Get
Return _detailViewName
End Get
End Property
Private _parentView As Drawings.DraftingView
Public ReadOnly Property ParentView() As Drawings.DraftingView
Get
Return _parentView
End Get
End Property
Private _centerPt As Point3d = Nothing
Public ReadOnly Property CenterPoint() As Point3d
Get
Return _centerPt
End Get
End Property
Private _boundPt1 As Point3d = Nothing
Public ReadOnly Property BoundingPoint1() As Point3d
Get
Return _boundPt1
End Get
End Property
Private _boundPt2 As Point3d = Nothing
Public ReadOnly Property BoundingPoint2() As Point3d
Get
Return _boundPt2
End Get
End Property
Private _borderArc As Arc = Nothing
Public ReadOnly Property BorderArc() As Arc
Get
Return _borderArc
End Get
End Property
Private _labelOnParent As Annotations.Label = Nothing
Public ReadOnly Property LabelOnParent() As Annotations.Label
Get
Return _labelOnParent
End Get
End Property
Public Sub New(ByVal theDetailView As Drawings.DetailView)
lg.WriteLine("Sub New, given detail view")
_theDetailView = theDetailView
_detailViewName = theDetailView.Name
'given the view, return the border arc
Me.GetViewBounds(theDetailView)
'The border arc (of a circular detail view) will be an arc where one of the smart object parents
'will be the parent view of the detail view and the arc center will match _centerPt (within modeling tolerance).
_borderArc = Me.FindBorderArc()
Me.GetLabelOnParent()
End Sub
Public Sub New(ByVal theBorderArc As Arc)
lg.WriteLine("Sub New, given the detail border arc")
_borderArc = theBorderArc
'given the border arc, return the detail view
Dim theDetailView As Drawings.DetailView = Me.FindDetailView(_borderArc)
If IsNothing(theDetailView) Then
_detailViewName = ""
Else
_detailViewName = theDetailView.Name
_theDetailView = theDetailView
Me.GetViewBounds(theDetailView)
Me.GetLabelOnParent()
End If
End Sub
Private Sub GetViewBounds(ByVal theDetailView As Drawings.DetailView)
lg.WriteLine("GetViewBounds")
Dim detailViewBuilder1 As Drawings.DetailViewBuilder = _theSession.Parts.Work.DraftingViews.CreateDetailViewBuilder(theDetailView)
'lw.WriteLine("label on parent: " & detailViewBuilder1.LabelOnParent.ToString)
lg.WriteLine("parent view: " & detailViewBuilder1.Parent.View.Value.Name)
lg.WriteLine("boundary point 1: " & detailViewBuilder1.BoundaryPoint1.Coordinates.ToString)
'lw.WriteLine("boundary point 2: " & detailViewBuilder1.BoundaryPoint2.Coordinates.ToString)
_boundPt1 = detailViewBuilder1.BoundaryPoint1.Coordinates
_boundPt2 = detailViewBuilder1.BoundaryPoint2.Coordinates
If detailViewBuilder1.Type = Drawings.DetailViewBuilder.Types.Circular Then
_centerPt = detailViewBuilder1.BoundaryPoint1.Coordinates
End If
_parentView = detailViewBuilder1.Parent.View.Value
detailViewBuilder1.Destroy()
lg.WriteLine("Exiting GetViewBounds")
lg.WriteLine("")
End Sub
Private Function FindBorderArc() As Arc
lg.WriteLine("FindBorderArc")
'TO DO: make sure arc is not view dependent
' the "view boundary" arc around the actual detail view is view dependent in the detail view,
' this is NOT the border arc we are looking for (the arc on the parent view that represents what the detail view shows).
For Each tempArc As Arc In _theSession.Parts.Work.Arcs
Dim arcParents As New List(Of NXObject)
GetSmartParents(tempArc, arcParents)
For Each tempParent As NXObject In arcParents
If TypeOf (tempParent) Is Drawings.DraftingView Then
lg.WriteLine("FindBorderArc: tempParent.Name: " & tempParent.Name)
lg.WriteLine("FindBorderArc: _parentView.Name: " & _parentView.Name)
lg.WriteLine("FindBorderArc: tempParent.Tag: " & tempParent.Tag.ToString)
lg.WriteLine("FindBorderArc: _parentView.Tag: " & _parentView.Tag.ToString)
If tempParent.Name <> _parentView.Name Then
lg.WriteLine("tempParent.Name <> _parentView.Name")
'this is not the arc we are looking for
'move along...
Continue For
End If
'if we get here, the view names match
'so far, so good
lg.WriteLine("view names match, checking points")
If Point3dEqual(tempArc.CenterPoint, _centerPt) Then
lg.WriteLine("points match, returning tempArc")
'parent views match and center points match
'this is it
'_borderArc = tempArc
Return tempArc
Else
lg.WriteLine("points do not match, check next parent")
End If
End If
Next
'lw.WriteLine("")
Next
'no more arcs, no matches found
lg.WriteLine("border arc = nothing")
'_borderArc = Nothing
Return Nothing
lg.WriteLine("Exiting FindBorderArc")
lg.WriteLine("")
End Function
Private Sub GetSmartParents(ByRef theSmartObject As NXObject, ByRef theParentList As List(Of NXObject))
Dim numParents As Integer
Dim theParentTags() As Tag = Nothing
Dim isSmart As Boolean = False
Try
_theUfSession.So.IsSo(theSmartObject.Tag, isSmart)
If isSmart Then
'lw.WriteLine("object is smart: " & theSmartObject.Tag.ToString)
_theUfSession.So.AskParents(theSmartObject.Tag, UFConstants.UF_SO_ASK_ALL_PARENTS, numParents, theParentTags)
For Each tempTag As Tag In theParentTags
Dim objParent As NXObject = Utilities.NXObjectManager.Get(tempTag)
'lw.WriteLine("adding " & objParent.GetType.ToString & " to parent list")
theParentList.Add(objParent)
GetSmartParents(objParent, theParentList)
Next
Else
'lw.WriteLine("object not smart: " & theSmartObject.Tag.ToString)
End If
Catch ex As NXException
'lw.WriteLine("error: " & ex.ErrorCode)
'lw.WriteLine(" " & ex.Message)
End Try
End Sub
Private Function Point3dEqual(ByVal pt1 As Point3d, ByVal pt2 As Point3d) As Boolean
If IsNothing(pt1) OrElse IsNothing(pt2) Then
Return False
End If
Dim modelingTolerance As Double
_theUfSession.Modl.AskDistanceTolerance(modelingTolerance)
lg.WriteLine("modeling distance tolerance: " & modelingTolerance.ToString)
If Math.Abs(pt1.X - pt2.X) > modelingTolerance Then
lg.WriteLine("X distance exceeds modeling tolerance")
Return False
End If
If Math.Abs(pt1.Y - pt2.Y) > modelingTolerance Then
lg.WriteLine("Y distance exceeds modeling tolerance")
Return False
End If
If Math.Abs(pt1.Z - pt2.Z) > modelingTolerance Then
lg.WriteLine("Z distance exceeds modeling tolerance")
Return False
End If
lg.WriteLine("points equal withing modeling distance tolerance")
Return True
End Function
Private Function FindDetailView(ByVal theBorderArc As Arc) As Drawings.DetailView
For Each tempView As Drawings.DraftingView In _theSession.Parts.Work.DraftingViews
If Not TypeOf (tempView) Is Drawings.DetailView Then
'only process detail views
Continue For
End If
Me.GetViewBounds(tempView)
Dim tempBorderArc As Arc
tempBorderArc = Me.FindBorderArc
If IsNothing(tempBorderArc) Then
Continue For
End If
If theBorderArc.Equals(tempBorderArc) Then
Return tempView
End If
Next
Return Nothing
End Function
Private Sub GetLabelOnParent()
'Get label on parent from detail view
'nx_api6015
Dim myChildList As New List(Of NXObject)
Dim numChildren As Integer
Dim childTags() As Tag = Nothing
_theUfSession.So.AskChildren(_theDetailView.Tag, UFConstants.UF_SO_ASK_ALL_CHILDREN, numChildren, childTags)
For Each tempTag As Tag In childTags
Dim someObj As NXObject = Utilities.NXObjectManager.Get(tempTag)
myChildList.Add(someObj)
Next
For Each obj As NXObject In myChildList
'lw.WriteLine("object: " & obj.GetType.ToString)
If TypeOf (obj) Is Annotations.Label Then
_labelOnParent = obj
End If
Next
End Sub
End Class