Drafting: Diameter Custom Prefix

Dear fellow NX-ers

I tried to make a button that when clicked acts like the 'diametral annotation' but instead of the 'O' (diameter sign) gives me a (letter) M, as prefix.

I tried the favorites, but couldnt get it working.

When trying to record a journal in which i set up this annotation, it fails to show me the annotation dialog box

Can anyone help or point in the good direction?

Kind regards,


' NX 9.0.3.4
' Journal created by WVelle on Wed Apr 13 16:33:32 2016 Romance (zomertijd)
'
Option Strict Off
Imports System
Imports NXOpen

Module NXJournal
Sub Main (ByVal args() As String)

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work

Dim displayPart As Part = theSession.Parts.Display

' ----------------------------------------------
' Menu: Insert->Dimension->Rapid...
' ----------------------------------------------
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")

Dim nullAnnotations_Dimension As Annotations.Dimension = Nothing

Dim rapidDimensionBuilder1 As Annotations.RapidDimensionBuilder
rapidDimensionBuilder1 = workPart.Dimensions.CreateRapidDimensionBuilder(nullAnnotations_Dimension)

rapidDimensionBuilder1.Origin.SetInferRelativeToGeometry(True)

rapidDimensionBuilder1.Origin.Anchor = Annotations.OriginBuilder.AlignmentPosition.MidCenter

rapidDimensionBuilder1.Measurement.Method = Annotations.DimensionMeasurementBuilder.MeasurementMethod.Diametral

theSession.SetUndoMarkName(markId1, "Rapid Dimension Dialog")

rapidDimensionBuilder1.Origin.Plane.PlaneMethod = Annotations.PlaneBuilder.PlaneMethodType.XyPlane

rapidDimensionBuilder1.Origin.SetInferRelativeToGeometry(True)

Dim dimensionlinearunits1 As Annotations.DimensionUnit
dimensionlinearunits1 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits2 As Annotations.DimensionUnit
dimensionlinearunits2 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits3 As Annotations.DimensionUnit
dimensionlinearunits3 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits4 As Annotations.DimensionUnit
dimensionlinearunits4 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits5 As Annotations.DimensionUnit
dimensionlinearunits5 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits6 As Annotations.DimensionUnit
dimensionlinearunits6 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits7 As Annotations.DimensionUnit
dimensionlinearunits7 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits8 As Annotations.DimensionUnit
dimensionlinearunits8 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits9 As Annotations.DimensionUnit
dimensionlinearunits9 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits10 As Annotations.DimensionUnit
dimensionlinearunits10 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits11 As Annotations.DimensionUnit
dimensionlinearunits11 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

rapidDimensionBuilder1.Origin.SetInferRelativeToGeometry(True)

rapidDimensionBuilder1.Origin.SetInferRelativeToGeometry(True)

Dim nullDirection As Direction = Nothing

rapidDimensionBuilder1.Measurement.Direction = nullDirection

Dim nullView As View = Nothing

rapidDimensionBuilder1.Measurement.DirectionView = nullView

rapidDimensionBuilder1.Style.DimensionStyle.NarrowDisplayType = Annotations.NarrowDisplayOption.None

Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Start")

Dim dimensionlinearunits12 As Annotations.DimensionUnit
dimensionlinearunits12 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits13 As Annotations.DimensionUnit
dimensionlinearunits13 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits14 As Annotations.DimensionUnit
dimensionlinearunits14 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits15 As Annotations.DimensionUnit
dimensionlinearunits15 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits16 As Annotations.DimensionUnit
dimensionlinearunits16 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits17 As Annotations.DimensionUnit
dimensionlinearunits17 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits18 As Annotations.DimensionUnit
dimensionlinearunits18 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits19 As Annotations.DimensionUnit
dimensionlinearunits19 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits20 As Annotations.DimensionUnit
dimensionlinearunits20 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits21 As Annotations.DimensionUnit
dimensionlinearunits21 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits22 As Annotations.DimensionUnit
dimensionlinearunits22 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits23 As Annotations.DimensionUnit
dimensionlinearunits23 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

theSession.SetUndoMarkName(markId2, "Settings Dialog")

theSession.SetUndoMarkVisibility(markId2, Nothing, Session.MarkVisibility.Visible)

Dim dimensionlinearunits24 As Annotations.DimensionUnit
dimensionlinearunits24 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits25 As Annotations.DimensionUnit
dimensionlinearunits25 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits26 As Annotations.DimensionUnit
dimensionlinearunits26 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits27 As Annotations.DimensionUnit
dimensionlinearunits27 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits28 As Annotations.DimensionUnit
dimensionlinearunits28 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits29 As Annotations.DimensionUnit
dimensionlinearunits29 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits30 As Annotations.DimensionUnit
dimensionlinearunits30 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits31 As Annotations.DimensionUnit
dimensionlinearunits31 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits32 As Annotations.DimensionUnit
dimensionlinearunits32 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits33 As Annotations.DimensionUnit
dimensionlinearunits33 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits34 As Annotations.DimensionUnit
dimensionlinearunits34 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits35 As Annotations.DimensionUnit
dimensionlinearunits35 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

' ----------------------------------------------
' Dialog Begin Settings
' ----------------------------------------------
Dim markId3 As Session.UndoMarkId
markId3 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Settings")

theSession.DeleteUndoMark(markId3, Nothing)

Dim markId4 As Session.UndoMarkId
markId4 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Settings")

rapidDimensionBuilder1.Style.RadialStyle.DiameterSymbolType = Annotations.DiameterSymbol.UserDefined

theSession.SetUndoMarkName(markId4, "Settings - Diameter Symbol")

theSession.SetUndoMarkVisibility(markId4, Nothing, Session.MarkVisibility.Visible)

theSession.SetUndoMarkVisibility(markId2, Nothing, Session.MarkVisibility.Invisible)

Dim markId5 As Session.UndoMarkId
markId5 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Settings")

theSession.DeleteUndoMark(markId5, Nothing)

Dim markId6 As Session.UndoMarkId
markId6 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Settings")

rapidDimensionBuilder1.Style.RadialStyle.DiameterSymbol = "M"

theSession.SetUndoMarkName(markId6, "Settings - Symbol to Use")

theSession.SetUndoMarkVisibility(markId6, Nothing, Session.MarkVisibility.Visible)

theSession.SetUndoMarkVisibility(markId2, Nothing, Session.MarkVisibility.Invisible)

Dim markId7 As Session.UndoMarkId
markId7 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Settings")

Dim markId8 As Session.UndoMarkId
markId8 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Settings")

theSession.DeleteUndoMark(markId8, Nothing)

theSession.SetUndoMarkName(markId2, "Settings")

theSession.DeleteUndoMark(markId7, Nothing)

theSession.SetUndoMarkVisibility(markId2, Nothing, Session.MarkVisibility.Visible)

theSession.DeleteUndoMark(markId6, Nothing)

theSession.DeleteUndoMark(markId4, Nothing)

theSession.DeleteUndoMark(markId2, Nothing)

Dim dimensionlinearunits36 As Annotations.DimensionUnit
dimensionlinearunits36 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits37 As Annotations.DimensionUnit
dimensionlinearunits37 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits38 As Annotations.DimensionUnit
dimensionlinearunits38 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits39 As Annotations.DimensionUnit
dimensionlinearunits39 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits40 As Annotations.DimensionUnit
dimensionlinearunits40 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits41 As Annotations.DimensionUnit
dimensionlinearunits41 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits42 As Annotations.DimensionUnit
dimensionlinearunits42 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits43 As Annotations.DimensionUnit
dimensionlinearunits43 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits44 As Annotations.DimensionUnit
dimensionlinearunits44 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

Dim dimensionlinearunits45 As Annotations.DimensionUnit
dimensionlinearunits45 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits

' ----------------------------------------------
' Menu: Tools->Journal->Insert->User Pause
' ----------------------------------------------
Dim theUI As UI = UI.GetUI()

theUI.JournalPause()

' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------

End Sub
End Module

A journal is intended to automate a process from start to finish. As of this writing, it is not possible for a journal to open a standard NX command and set some preferences for the user, leaving the dialog open and allowing the user to finish the command.

For alternatives, you may want to look into the NX "macro" functionality. It is basically just a keystroke recorder. It may be able to start a standard NX command and do what you need. Otherwise, you may be able to use the UI styler to create a custom dialog box that would be completely under the control of the code that you write. This would allow you to create your own interface for your code. However, this method seems like overkill for this particular task.