Submitted by nitem on Sat, 10/14/2017 - 02:54
Forums:
Hello there,
I am new to this forum. Nice work here and I need help. In NX drawing, the cross-sectional appearance name is "THIN". I want to change the appearance of all sections within the page to "NORMAL". The letters I want to change are next to arrows in cross-section. Do you have a journel for this, or can you help me to create one?
help me please
help me please
metin önder
re: section line labels
Try out the code below. When run in a part, it should make all the section line labels normal width. It makes use of a class that I wrote some time ago that helps to find the labels given a section view.
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF
Module line_label_width
Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = theSession.ListingWindow
Dim workPart As Part = theSession.Parts.Work
Sub Main()
If IsNothing(theSession.Parts.BaseWork) Then
'active part required
Return
End If
lw.Open()
Const undoMarkName As String = "find section line labels"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)
Dim sectionLineLabels As New List(Of Annotations.Annotation)
For Each temp As Drawings.DraftingView In workPart.DraftingViews
If TypeOf (temp) Is Drawings.SectionView Then
Dim myLabels As New NXJ_findSectionLineLabels(temp)
'lw.WriteLine("view: " & temp.Name)
'lw.WriteLine("parent view: " & myLabels.SectionViewParent.Name)
'lw.WriteLine("section line tag: " & myLabels.SectionLine.Tag.ToString)
'lw.WriteLine("label1 tag: " & myLabels.SectionLineLabel1.Tag)
'lw.WriteLine("label1 value: " & EvaluateText(myLabels.SectionLineLabel1))
'myLabels.SectionLineLabel1.Highlight()
'theSession.Parts.Display.DrawingSheets.CurrentDrawingSheet.View.UpdateDisplay()
'MsgBox("label1 tag: " & myLabels.SectionLineLabel1.Tag)
'myLabels.SectionLineLabel1.Unhighlight()
'theSession.Parts.Display.DrawingSheets.CurrentDrawingSheet.View.UpdateDisplay()
'lw.WriteLine("label2 tag: " & myLabels.SectionLineLabel2.Tag)
'lw.WriteLine("label2 value: " & EvaluateText(myLabels.SectionLineLabel2))
'lw.WriteLine("")
If Not IsNothing(myLabels.SectionLineLabel1) Then
MakeLabelNormalWidth(myLabels.SectionLineLabel1)
End If
If Not IsNothing(myLabels.SectionLineLabel2) Then
MakeLabelNormalWidth(myLabels.SectionLineLabel2)
End If
End If
'lw.WriteLine("")
Next
lw.Close()
End Sub
Sub MakeLabelNormalWidth(ByVal theAnnotation As Annotations.Annotation)
Dim editSettingsBuilder1 As Annotations.EditSettingsBuilder
editSettingsBuilder1 = workPart.SettingsManager.CreateAnnotationEditSettingsBuilder({theAnnotation})
Dim editsettingsbuilders1(0) As Drafting.BaseEditSettingsBuilder
editsettingsbuilders1(0) = editSettingsBuilder1
workPart.SettingsManager.ProcessForMutipleObjectsSettings(editsettingsbuilders1)
editSettingsBuilder1.AnnotationStyle.LetteringStyle.GeneralTextLineWidth = Annotations.LineWidth.Normal
Dim nXObject1 As NXObject
nXObject1 = editSettingsBuilder1.Commit()
editSettingsBuilder1.Destroy()
End Sub
Function EvaluateText(ByVal someNote As Annotations.Note) 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
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 Module
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Public Class NXJ_findSectionLineLabels
#Region "Private variables"
Private _theSession As Session = Session.GetSession
Private _theUfSession As UFSession = UFSession.GetUFSession()
Private lg As LogFile = _theSession.LogFile
Private _annotationMap As New Dictionary(Of Tag, Annotations.Note)
Private _sectionLineSegmentCurveTags As New List(Of Tag)
#End Region
#Region "Properties"
Private _theSectionLine As Drawings.SectionLine = Nothing
Public ReadOnly Property SectionLine() As Drawings.SectionLine
Get
Return _theSectionLine
End Get
End Property
Private _theSectionView As Drawings.SectionView = Nothing
Public ReadOnly Property SectionView() As Drawings.SectionView
Get
Return _theSectionView
End Get
End Property
Private _sectionLineLabel1 As Annotations.Note = Nothing
Public ReadOnly Property SectionLineLabel1() As Annotations.Note
Get
Return _sectionLineLabel1
End Get
End Property
Private _sectionLineLabel2 As Annotations.Note = Nothing
Public ReadOnly Property SectionLineLabel2() As Annotations.Note
Get
Return _sectionLineLabel2
End Get
End Property
Private _sectionViewParent As Drawings.DraftingView = Nothing
Public ReadOnly Property SectionViewParent() As Drawings.DraftingView
Get
Return _sectionViewParent
End Get
End Property
#End Region
#Region "Public methods"
Public Sub New(ByVal someSectionView As Drawings.SectionView)
_theSectionView = someSectionView
_theSectionLine = GetSectionLine(_theSectionView)
Me.GetSectionLineLabels()
End Sub
Public Sub New(ByVal someSectionLine As Drawings.SectionLine)
_theSectionLine = someSectionLine
_theSectionView = GetSectionView(someSectionLine)
Me.GetSectionLineLabels()
End Sub
#End Region
#Region "Private methods"
Private Sub GetSectionLineLabels()
Me.CreateAnnotationMap()
_sectionLineSegmentCurveTags = SectionLineSegmentCurveTags(_theSectionLine.Tag)
If Not _sectionLineSegmentCurveTags.Count = 2 Then
Exit Sub
End If
If _annotationMap.ContainsKey(_sectionLineSegmentCurveTags.Item(0)) Then
_sectionLineLabel2 = _annotationMap.Item(_sectionLineSegmentCurveTags.Item(0))
End If
If _annotationMap.ContainsKey(_sectionLineSegmentCurveTags.Item(1)) Then
_sectionLineLabel1 = _annotationMap.Item(_sectionLineSegmentCurveTags.Item(1))
End If
End Sub
Private Sub CreateAnnotationMap()
For Each temp As Annotations.Note In _theSession.Parts.Display.Notes
If temp.HasAssociativeOrigin Then
Dim pt As Point3d
Dim originData As Annotations.Annotation.AssociativeOriginData
originData = temp.GetAssociativeOrigin(pt)
lg.WriteLine(" note associativity type: " & originData.OriginType.ToString)
If originData.OriginType = Annotations.AssociativeOriginType.RelativeToGeometry Then
Dim geoPt As Point = originData.PointOnGeometry
Dim smartParent As TaggedObject
smartParent = GetSmartParent(geoPt, 0)
If Not IsNothing(smartParent) Then
_annotationMap.Add(smartParent.Tag, temp)
End If
End If
End If
Next
End Sub
Private Function GetSmartParent(ByRef theSmartObject As NXObject, ByVal indent As Integer) As TaggedObject
Dim numParents As Integer
Dim theParentTags() As Tag = Nothing
Dim isSmart As Boolean = False
Try
_theUfSession.So.IsSo(theSmartObject.Tag, isSmart)
If isSmart Then
_theUfSession.So.AskParents(theSmartObject.Tag, UFConstants.UF_SO_ASK_ALL_PARENTS, numParents, theParentTags)
lg.WriteLine(New String(" "c, indent) & "number of parents: " & numParents.ToString)
For Each tempTag As Tag In theParentTags
Dim objParent As TaggedObject = Utilities.NXObjectManager.Get(tempTag)
Return objParent
'lg.WriteLine(New String(" "c, indent) & "parent type: " & objParent.GetType.ToString)
'lg.WriteLine(New String(" "c, indent) & "parent tag: " & objParent.Tag.ToString)
Next
lg.WriteLine("")
End If
Return Nothing
Catch ex As NXException
lg.WriteLine("error: " & ex.ErrorCode)
lg.WriteLine(" " & ex.Message)
Return Nothing
End Try
End Function
Private Function GetSectionLine(ByVal sxView As Drawings.SectionView) As Drawings.SectionLine
Dim sectionLineTag As Tag = Tag.Null
_theUfSession.Draw.AskSxlineOfSxview(sxView.Tag, sectionLineTag)
Dim theSectionLine As Drawings.SectionLine
theSectionLine = Utilities.NXObjectManager.Get(sectionLineTag)
Return theSectionLine
End Function
Private Function GetSectionView(ByVal sxLine As Drawings.SectionLine) As Drawings.SectionView
For Each temp As Drawings.DraftingView In _theSession.Parts.Display.DraftingViews
If TypeOf (temp) Is Drawings.SectionView Then
Dim tempLine As Drawings.SectionLine
tempLine = GetSectionLine(temp)
If tempLine.Tag = sxLine.Tag Then
Return temp
End If
End If
Next
Return Nothing
End Function
Private Function SectionLineSegmentCurveTags(ByVal sectionLineTag As Tag) As List(Of Tag)
Dim sectionLineType As UFDraw.SxlineType
_theUfSession.Draw.AskSxlineType(sectionLineTag, sectionLineType)
Dim stepDir(2) As Double
Dim arrowDir(2) As Double
Dim parentViewTag As Tag = Tag.Null
Dim numSxViews As Integer
Dim sxViewTags() As Tag = Nothing
Dim numSegments As Integer
Dim segmentTags() As Tag = Nothing
Dim status As UFDraw.SxlineStatus
Dim rotationPtObj As UFDrf.Object = Nothing
Dim numLeg1Segments As Integer
Dim cutPlaneLeg As UFDraw.SxlineLeg
Dim returnTags As New List(Of Tag)
Select Case sectionLineType
Case Is = UFDraw.SxlineType.SimpleSxline
_theUfSession.Draw.AskSimpleSxline(sectionLineTag, stepDir, arrowDir, parentViewTag, numSxViews, sxViewTags, numSegments, segmentTags, status)
Case Is = UFDraw.SxlineType.SteppedSxline
_theUfSession.Draw.AskSteppedSxline(sectionLineTag, stepDir, arrowDir, parentViewTag, numSxViews, sxViewTags, numSegments, segmentTags, status)
Case Is = UFDraw.SxlineType.RevolvedSxline
_theUfSession.Draw.AskRevolvedSxline(sectionLineTag, stepDir, arrowDir, parentViewTag, rotationPtObj, numSxViews, sxViewTags, numSegments, numLeg1Segments, cutPlaneLeg, segmentTags, status)
Case Is = UFDraw.SxlineType.HalfSxline
_theUfSession.Draw.AskHalfSxline(sectionLineTag, stepDir, arrowDir, parentViewTag, numSxViews, sxViewTags, numSegments, segmentTags, status)
Case Is = UFDraw.SxlineType.UnfoldedSxline
_theUfSession.Draw.AskUnfoldedSxline(sectionLineTag, stepDir, arrowDir, parentViewTag, numSxViews, sxViewTags, numSegments, segmentTags, status)
Case Is = UFDraw.SxlineType.FoldedSxline
Return Nothing
Case Is = UFDraw.SxlineType.Breakline
'the view with the break is the section view itself
Return Nothing
End Select
'find the parent view
If Not parentViewTag = Tag.Null Then
_sectionViewParent = Utilities.NXObjectManager.Get(parentViewTag)
End If
'get the underlying curve tag from the segment
For Each temp As Tag In segmentTags
Dim segInfo As UFDraw.SxsegInfo
Dim curveTag As Tag = Tag.Null
Dim obj() As UFDrf.Object = Nothing
_theUfSession.Draw.AskSxlineSxseg(temp, segInfo, curveTag, obj)
If segInfo.sxseg_type = UFDraw.SxsegType.SxsegArrow Then
'labels are associated to the arrow segments
returnTags.Add(curveTag)
End If
Next
Return returnTags
End Function
#End Region
End Class
Hello there,
Hello there,
First of all thank you for your help. I have to say ahead of time I am using NX 8.0. The macro you are sending gives the following error. Could you help me with the topic?
Dim editSettingsBuilder1 As Annotations.EditSettingsBuilder
metin önder
re: edit settings builder
It seems the Annotations.EditSettingsBuilder is only available in NX 9 or later. The code below does not use the .EditSettingsBuilder. I do not have NX 8 installed to test with, but it did work on NX 8.5.
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF
Module line_label_width_85
Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = theSession.ListingWindow
Dim workPart As Part = theSession.Parts.Work
Sub Main()
If IsNothing(theSession.Parts.BaseWork) Then
'active part required
Return
End If
lw.Open()
Const undoMarkName As String = "find section line labels"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)
Dim sectionLineLabels As New List(Of Annotations.Annotation)
For Each temp As Drawings.DraftingView In workPart.DraftingViews
If TypeOf (temp) Is Drawings.SectionView Then
Dim myLabels As New NXJ_findSectionLineLabels(temp)
'lw.WriteLine("view: " & temp.Name)
'lw.WriteLine("parent view: " & myLabels.SectionViewParent.Name)
'lw.WriteLine("section line tag: " & myLabels.SectionLine.Tag.ToString)
'lw.WriteLine("label1 tag: " & myLabels.SectionLineLabel1.Tag)
'lw.WriteLine("label1 value: " & EvaluateText(myLabels.SectionLineLabel1))
'myLabels.SectionLineLabel1.Highlight()
'theSession.Parts.Display.DrawingSheets.CurrentDrawingSheet.View.UpdateDisplay()
'MsgBox("label1 tag: " & myLabels.SectionLineLabel1.Tag)
'myLabels.SectionLineLabel1.Unhighlight()
'theSession.Parts.Display.DrawingSheets.CurrentDrawingSheet.View.UpdateDisplay()
'lw.WriteLine("label2 tag: " & myLabels.SectionLineLabel2.Tag)
'lw.WriteLine("label2 value: " & EvaluateText(myLabels.SectionLineLabel2))
'lw.WriteLine("")
If Not IsNothing(myLabels.SectionLineLabel1) Then
MakeLabelNormalWidth(myLabels.SectionLineLabel1)
End If
If Not IsNothing(myLabels.SectionLineLabel2) Then
MakeLabelNormalWidth(myLabels.SectionLineLabel2)
End If
End If
'lw.WriteLine("")
Next
lw.Close()
End Sub
Sub MakeLabelNormalWidth(ByVal theAnnotation As Annotations.Annotation)
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Edit Object Preferences")
Dim letteringPreferences1 As Annotations.LetteringPreferences
letteringPreferences1 = theAnnotation.GetLetteringPreferences()
Dim generalText1 As Annotations.Lettering
generalText1.Size = letteringPreferences1.GetGeneralText.Size
generalText1.CharacterSpaceFactor = letteringPreferences1.GetGeneralText.CharacterSpaceFactor
generalText1.AspectRatio = letteringPreferences1.GetGeneralText.AspectRatio
generalText1.LineSpaceFactor = letteringPreferences1.GetGeneralText.LineSpaceFactor
generalText1.Cfw.Color = letteringPreferences1.GetGeneralText.Cfw.Color
generalText1.Cfw.Font = letteringPreferences1.GetGeneralText.Cfw.Font
generalText1.Cfw.Width = Annotations.LineWidth.Normal
generalText1.Italic = letteringPreferences1.GetGeneralText.Italic
letteringPreferences1.SetGeneralText(generalText1)
theAnnotation.SetLetteringPreferences(letteringPreferences1)
letteringPreferences1.Dispose()
Dim nErrs1 As Integer
nErrs1 = theSession.UpdateManager.DoUpdate(markId1)
End Sub
Function EvaluateText(ByVal someNote As Annotations.Note) 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
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 Module
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Public Class NXJ_findSectionLineLabels
#Region "Private variables"
Private _theSession As Session = Session.GetSession
Private _theUfSession As UFSession = UFSession.GetUFSession()
Private lg As LogFile = _theSession.LogFile
Private _annotationMap As New Dictionary(Of Tag, Annotations.Note)
Private _sectionLineSegmentCurveTags As New List(Of Tag)
#End Region
#Region "Properties"
Private _theSectionLine As Drawings.SectionLine = Nothing
Public ReadOnly Property SectionLine() As Drawings.SectionLine
Get
Return _theSectionLine
End Get
End Property
Private _theSectionView As Drawings.SectionView = Nothing
Public ReadOnly Property SectionView() As Drawings.SectionView
Get
Return _theSectionView
End Get
End Property
Private _sectionLineLabel1 As Annotations.Note = Nothing
Public ReadOnly Property SectionLineLabel1() As Annotations.Note
Get
Return _sectionLineLabel1
End Get
End Property
Private _sectionLineLabel2 As Annotations.Note = Nothing
Public ReadOnly Property SectionLineLabel2() As Annotations.Note
Get
Return _sectionLineLabel2
End Get
End Property
Private _sectionViewParent As Drawings.DraftingView = Nothing
Public ReadOnly Property SectionViewParent() As Drawings.DraftingView
Get
Return _sectionViewParent
End Get
End Property
#End Region
#Region "Public methods"
Public Sub New(ByVal someSectionView As Drawings.SectionView)
_theSectionView = someSectionView
_theSectionLine = GetSectionLine(_theSectionView)
Me.GetSectionLineLabels()
End Sub
Public Sub New(ByVal someSectionLine As Drawings.SectionLine)
_theSectionLine = someSectionLine
_theSectionView = GetSectionView(someSectionLine)
Me.GetSectionLineLabels()
End Sub
#End Region
#Region "Private methods"
Private Sub GetSectionLineLabels()
Me.CreateAnnotationMap()
_sectionLineSegmentCurveTags = SectionLineSegmentCurveTags(_theSectionLine.Tag)
If Not _sectionLineSegmentCurveTags.Count = 2 Then
Exit Sub
End If
If _annotationMap.ContainsKey(_sectionLineSegmentCurveTags.Item(0)) Then
_sectionLineLabel2 = _annotationMap.Item(_sectionLineSegmentCurveTags.Item(0))
End If
If _annotationMap.ContainsKey(_sectionLineSegmentCurveTags.Item(1)) Then
_sectionLineLabel1 = _annotationMap.Item(_sectionLineSegmentCurveTags.Item(1))
End If
End Sub
Private Sub CreateAnnotationMap()
For Each temp As Annotations.Note In _theSession.Parts.Display.Notes
If temp.HasAssociativeOrigin Then
Dim pt As Point3d
Dim originData As Annotations.Annotation.AssociativeOriginData
originData = temp.GetAssociativeOrigin(pt)
lg.WriteLine(" note associativity type: " & originData.OriginType.ToString)
If originData.OriginType = Annotations.AssociativeOriginType.RelativeToGeometry Then
Dim geoPt As Point = originData.PointOnGeometry
Dim smartParent As TaggedObject
smartParent = GetSmartParent(geoPt, 0)
If Not IsNothing(smartParent) Then
_annotationMap.Add(smartParent.Tag, temp)
End If
End If
End If
Next
End Sub
Private Function GetSmartParent(ByRef theSmartObject As NXObject, ByVal indent As Integer) As TaggedObject
Dim numParents As Integer
Dim theParentTags() As Tag = Nothing
Dim isSmart As Boolean = False
Try
_theUfSession.So.IsSo(theSmartObject.Tag, isSmart)
If isSmart Then
_theUfSession.So.AskParents(theSmartObject.Tag, UFConstants.UF_SO_ASK_ALL_PARENTS, numParents, theParentTags)
lg.WriteLine(New String(" "c, indent) & "number of parents: " & numParents.ToString)
For Each tempTag As Tag In theParentTags
Dim objParent As TaggedObject = Utilities.NXObjectManager.Get(tempTag)
Return objParent
'lg.WriteLine(New String(" "c, indent) & "parent type: " & objParent.GetType.ToString)
'lg.WriteLine(New String(" "c, indent) & "parent tag: " & objParent.Tag.ToString)
Next
lg.WriteLine("")
End If
Return Nothing
Catch ex As NXException
lg.WriteLine("error: " & ex.ErrorCode)
lg.WriteLine(" " & ex.Message)
Return Nothing
End Try
End Function
Private Function GetSectionLine(ByVal sxView As Drawings.SectionView) As Drawings.SectionLine
Dim sectionLineTag As Tag = Tag.Null
_theUfSession.Draw.AskSxlineOfSxview(sxView.Tag, sectionLineTag)
Dim theSectionLine As Drawings.SectionLine
theSectionLine = Utilities.NXObjectManager.Get(sectionLineTag)
Return theSectionLine
End Function
Private Function GetSectionView(ByVal sxLine As Drawings.SectionLine) As Drawings.SectionView
For Each temp As Drawings.DraftingView In _theSession.Parts.Display.DraftingViews
If TypeOf (temp) Is Drawings.SectionView Then
Dim tempLine As Drawings.SectionLine
tempLine = GetSectionLine(temp)
If tempLine.Tag = sxLine.Tag Then
Return temp
End If
End If
Next
Return Nothing
End Function
Private Function SectionLineSegmentCurveTags(ByVal sectionLineTag As Tag) As List(Of Tag)
Dim sectionLineType As UFDraw.SxlineType
_theUfSession.Draw.AskSxlineType(sectionLineTag, sectionLineType)
Dim stepDir(2) As Double
Dim arrowDir(2) As Double
Dim parentViewTag As Tag = Tag.Null
Dim numSxViews As Integer
Dim sxViewTags() As Tag = Nothing
Dim numSegments As Integer
Dim segmentTags() As Tag = Nothing
Dim status As UFDraw.SxlineStatus
Dim rotationPtObj As UFDrf.Object = Nothing
Dim numLeg1Segments As Integer
Dim cutPlaneLeg As UFDraw.SxlineLeg
Dim returnTags As New List(Of Tag)
Select Case sectionLineType
Case Is = UFDraw.SxlineType.SimpleSxline
_theUfSession.Draw.AskSimpleSxline(sectionLineTag, stepDir, arrowDir, parentViewTag, numSxViews, sxViewTags, numSegments, segmentTags, status)
Case Is = UFDraw.SxlineType.SteppedSxline
_theUfSession.Draw.AskSteppedSxline(sectionLineTag, stepDir, arrowDir, parentViewTag, numSxViews, sxViewTags, numSegments, segmentTags, status)
Case Is = UFDraw.SxlineType.RevolvedSxline
_theUfSession.Draw.AskRevolvedSxline(sectionLineTag, stepDir, arrowDir, parentViewTag, rotationPtObj, numSxViews, sxViewTags, numSegments, numLeg1Segments, cutPlaneLeg, segmentTags, status)
Case Is = UFDraw.SxlineType.HalfSxline
_theUfSession.Draw.AskHalfSxline(sectionLineTag, stepDir, arrowDir, parentViewTag, numSxViews, sxViewTags, numSegments, segmentTags, status)
Case Is = UFDraw.SxlineType.UnfoldedSxline
_theUfSession.Draw.AskUnfoldedSxline(sectionLineTag, stepDir, arrowDir, parentViewTag, numSxViews, sxViewTags, numSegments, segmentTags, status)
Case Is = UFDraw.SxlineType.FoldedSxline
Return Nothing
Case Is = UFDraw.SxlineType.Breakline
'the view with the break is the section view itself
Return Nothing
End Select
'find the parent view
If Not parentViewTag = Tag.Null Then
_sectionViewParent = Utilities.NXObjectManager.Get(parentViewTag)
End If
'get the underlying curve tag from the segment
For Each temp As Tag In segmentTags
Dim segInfo As UFDraw.SxsegInfo
Dim curveTag As Tag = Tag.Null
Dim obj() As UFDrf.Object = Nothing
_theUfSession.Draw.AskSxlineSxseg(temp, segInfo, curveTag, obj)
If segInfo.sxseg_type = UFDraw.SxsegType.SxsegArrow Then
'labels are associated to the arrow segments
returnTags.Add(curveTag)
End If
Next
Return returnTags
End Function
#End Region
End Class
thank you. it will be very
thank you. it will be very useful. Is there a way to find Datums locations on the drawing page
metin önder
re: datums on drawing
What type of datums are you looking for? Can you give an example of what you want to do?
drawing datum
Hello there,
I put it on the drawing page on the drawing sheet. Datum Feature I want to find out what grid is in the grid by reading the letters and numbers on the page and automatically print a cell in tabular note.
metin önder
Hello there,
Hello there,
I put it on the drawing page on the drawing page. I want to find out what grid is in the grid by reading the letters and digits of the Datum Feature Symbols on the page and automatically print a cell in tabular note.
metin önder
re: zone of datum
I'm going to assume that we are talking about GD&T datums; if I'm wrong, please clarify.
The code in the following thread:
http://nxjournaling.com/comment/1458#comment-1458
will report the drawing sheet zone of a given dimension object. The code could be modified to accept other annotation objects (such as datums).
Zone Of Datum
Hello there,
I used this page more macros before, but NX8.0 gave an error. "Three" is not a member of 'NXOpen.Annotations.LineWidth'
I could not solve it, so I asked for help. The first macros of the page works without errors, but it does not give anything as a result. I can not comment anymore in this topic.
metin önder
Additional questions,
Additional questions,
drawing page, I can find detail-cross-section appearance names and bold, but I do not select the notes in the page when I encounter a problem but when the leader is added to the notes, it looks like a note label and is doing macro onuda bold. can I help you in this matter by making the cross-section look letters bold? Here's the code I'm using.
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports System.Windows.Forms
Imports NXOpen.Annotations
Imports NXOpen.Utilities
Imports System.Collections.Generic
' NX Font Update
' Journal created by Alto on 20-05-2015
Module NXJournal
Dim ufs As UFSession = UFSession.GetUFSession()
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Sub Main()
Dim fontIndex1 As Integer
fontIndex1 = workPart.Fonts.AddFont("latin_extended")
'Update Note Dimension
For Each note1 As Annotations.Note In workPart.Notes
Next
'Update Special Notes of BE
For Each note2 As Annotations.Note In workPart.Notes
Dim Text1(0) As String
Text1 = note2.GetText
If Text1(0) = "" Then
ElseIf Text1(0).Contains("SX_SEG") Then
Dim lineAndArrowPreferences7 As Annotations.LineAndArrowPreferences
lineAndArrowPreferences7 = note2.GetLineAndArrowPreferences()
Dim letteringPreferences7 As Annotations.LetteringPreferences
letteringPreferences7 = note2.GetLetteringPreferences()
Dim generalText2 As Annotations.Lettering
generalText2.Size = 10
generalText2.CharacterSpaceFactor = 1.0
generalText2.AspectRatio = 1.0
generalText2.LineSpaceFactor = 1.0
generalText2.Cfw.Color = 80
generalText2.Cfw.Font = fontIndex1
generalText2.Cfw.Width = Annotations.LineWidth.Normal
letteringPreferences7.SetGeneralText(generalText2)
note2.SetLetteringPreferences(letteringPreferences7)
note2.RedisplayObject()
End If
Next
'Update Label Font for all the Labels not letter size factor
Dim NULL_TAG As NXOpen.Tag = NXOpen.Tag.Null
Dim obj As NXOpen.Tag = NULL_TAG
Do
obj = ask_next_drf_entity(obj)
If obj = NULL_TAG Then
GoTo end1
End If
' Check whether returned Tag is UF_draft_label_subtype
Dim type As Integer = Nothing
Dim subtype As Integer = Nothing
ufs.Obj.AskTypeAndSubtype(obj, type, subtype)
Dim nxobj As NXObject = NXObjectManager.Get(obj)
If nxobj.GetType().ToString() <> "NXOpen.Annotations.Label" Then
Continue Do
ElseIf nxobj.GetType().ToString() <> "NXOpen.Annotations.Labelonparent" Then
Dim Label1 As Annotations.Label = nxobj
Dim letteringPreferences7 As Annotations.LetteringPreferences
letteringPreferences7 = Label1.GetLetteringPreferences()
Dim generalText5 As Annotations.Lettering
generalText5.Size = 5
generalText5.CharacterSpaceFactor = 1.0
generalText5.AspectRatio = 1.0
generalText5.LineSpaceFactor = 1.0
generalText5.Cfw.Color = 80
generalText5.Cfw.Font = fontIndex1
generalText5.Cfw.Width = Annotations.LineWidth.Normal
letteringPreferences7.SetGeneralText(generalText5)
Label1.SetLetteringPreferences(letteringPreferences7)
letteringPreferences7.Dispose()
Label1.RedisplayObject()
Continue Do
End If
Loop Until obj = NULL_TAG
End1:
End Sub
Function FindTabularNotes(ByRef theTabNotes As List(Of Tag)) As Integer
Dim tmpTabNote As NXOpen.Tag = NXOpen.Tag.Null
Dim type As Integer
Dim subtype As Integer
Do
ufs.Obj.CycleObjsInPart(workPart.Tag, UFConstants.UF_tabular_note_type, tmpTabNote)
If tmpTabNote = NXOpen.Tag.Null Then
Continue Do
End If
If tmpTabNote <> NXOpen.Tag.Null Then
ufs.Obj.AskTypeAndSubtype(tmpTabNote, type, subtype)
If subtype = UFConstants.UF_tabular_note_subtype Then
theTabNotes.Add(tmpTabNote)
End If
End If
Loop Until tmpTabNote = NXOpen.Tag.Null
Return theTabNotes.Count
End Function
Public Function ask_next_drf_entity(ByRef obj As NXOpen.Tag) As NXOpen.Tag
Dim part As NXOpen.Tag = workPart.Tag
ufs.Obj.CycleObjsInPart(part, UFConstants.UF_drafting_entity_type, obj)
Return obj
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 Module
metin önder
Please help for GD & T symbol.
Hello there,
I am using NX 8.0. I want to find the Datum Feature symbols (A - B - C), the GD & T symbol on the drawing page, and write a cell on the tabular note. I'm waiting for emergency help, help me out of the loop.
emergency hel
additional question,
Do we have the final appearance name (AA - AB - AC - AD) on the drawing page and print it on a cell in a tabular note?
help me
hello
My english is not very good. For this reason, if you can upload files to the page I would like to prepare a pdf and mark it on it. If you have Yada mail address, I can send that adrese. please show me a way to solve this problem urgently
metin önder
re: help me
I maintain this site in my spare time; if you have an urgent need, I suggest that you contact your reseller or GTAC for quick resolution.
help me
Hello there,
Can we find Datum feature symbols on the Drawing page and get annotation style properties? character size 10, I need a journale to change the font normally. can you help me?
re: datum feature symbols
You should be able to find all the datum feature symbols in the .Gdts collection. Once you have a reference to a datum feature symbol, you can adjust the appearance as needed.
for each temp as Annotations.DraftingDatum in workPart.Annotations.Gdts
'update appearance
next
Datum Feature Symbols
Hello,
Thank you for your help. I do not know what line to add to the code you sent me because I am new to journal. can you organize and send the software in a way that will be used to me as a recital?