Showing results for 
Search instead for 
Did you mean: 

Invoke NX" datum feature symbol" dialog

I want to invoke " datum feature symbol" dialog through nx programming.Is it possible?



Re: Invoke NX" datum feature symbol" dialog

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Have you tried recording a journal?

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP16/TC11.2
I'd rather be e-steamed than e-diseaseled

Re: Invoke NX" datum feature symbol" dialog

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

You can only open existing dialogs through a macro, but macros mostly only work within one MP or MR, depending on the dialog being changed or not.

In any other situation you will have to collect the needed information on your own and create the objects on your own.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.1, FBM, MRL 3.1.7 | TcUA 10.1 MP7 Patch 0 ( | TcVis 11.4
Development: C (ITK), .NET, Tcl/Tk Testing: NX12.0 | AWC 3.4 Preparing: NX12.0

Employees of the customers, together we are strong Smiley Wink
How to Get the Most from Your Signature in the Community
NX Customization - Best Practice Guide

Re: Invoke NX" datum feature symbol" dialog

Yes I have recorded a journal;

using System;
using NXOpen;

public class NXJournal
public static void Main(string[] args)
NXOpen.Session theSession = NXOpen.Session.GetSession();
NXOpen.Part workPart = theSession.Parts.Work;
NXOpen.Part displayPart = theSession.Parts.Display;
// ----------------------------------------------
// Menu: PMI->Datum Feature Symbol...
// ----------------------------------------------
NXOpen.Session.UndoMarkId markId1;
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start");

NXOpen.Annotations.Datum nullNXOpen_Annotations_Datum = null;
NXOpen.Annotations.PmiDatumFeatureSymbolBuilder pmiDatumFeatureSymbolBuilder1;
pmiDatumFeatureSymbolBuilder1 = workPart.Annotations.Datums.CreatePmiDatumFeatureSymbolBuilder(nullNXOpen_Annotations_Datum);

pmiDatumFeatureSymbolBuilder1.Letter = "A";


pmiDatumFeatureSymbolBuilder1.Origin.Anchor = NXOpen.Annotations.OriginBuilder.AlignmentPosition.MidCenter;

theSession.SetUndoMarkName(markId1, "Datum Feature Symbol Dialog");

pmiDatumFeatureSymbolBuilder1.Origin.Plane.PlaneMethod = NXOpen.Annotations.PlaneBuilder.PlaneMethodType.ModelView;


NXOpen.Annotations.LeaderData leaderData1;
leaderData1 = workPart.Annotations.CreateLeaderData();

leaderData1.StubSize = 5.0;

leaderData1.Arrowhead = NXOpen.Annotations.LeaderData.ArrowheadType.FilledArrow;

leaderData1.VerticalAttachment = NXOpen.Annotations.LeaderVerticalAttachment.Center;


leaderData1.TerminatorType = NXOpen.Annotations.LeaderData.LeaderType.Datum;

leaderData1.Arrowhead = NXOpen.Annotations.LeaderData.ArrowheadType.FilledDatum;

leaderData1.StubSide = NXOpen.Annotations.LeaderSide.Inferred;

leaderData1.StubSize = 35.966000000000001;




theSession.UndoToMark(markId1, null);

theSession.DeleteUndoMark(markId1, null);

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

public static int GetUnloadOption(string dummy) { return (int)NXOpen.Session.LibraryUnloadOption.Immediately; }

Re: Invoke NX" datum feature symbol" dialog

Siemens Phenom Siemens Phenom
Siemens Phenom


When you recorded the journal, it recorded the steps that you took within the dialog.  Journals do not record the action of launching the dialog.  Instead they record what happened after that.  That way you can use the recorded code to see what your custom code would need to look like to accomplish the same result.


NX Open does not provide methods to allow you to launch standard dialogs from the user interface.  If you could do that, then your program would have to relinquish control to the UI.

Re: Invoke NX" datum feature symbol" dialog


Hi I am trying to write a simple journal which lists all the datum feauture symbol in the drawing sheet.


But it is collecting only pmi datum symbol which is not needed to me.


Please help!!


Below is the code

Option Strict Off
Imports System
Imports NXOpen

Module Datumsymbol

    Sub Main()

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

        Dim myIdBuilder As Annotations.DraftingDatumFeatureSymbolBuilder

        If workPart.Annotations.Datums.ToArray.Length = 0 Then
            lw.WriteLine("No Datum symbols found in current work part")
        End If

        For Each tempID As Annotations.DraftingDatum In workPart.Annotations.Datums

            myIdBuilder = workPart.Annotations.Datums.CreateDraftingDatumFeatureSymbolBuilder(tempID)
            lw.WriteLine("origin: " & myIdBuilder.Origin.OriginPoint.ToString)
            lw.WriteLine("upper text: " & myIdBuilder.Letter.ToString)


    End Sub

End Module


Re: Invoke NX" datum feature symbol" dialog

Siemens Phenom Siemens Phenom
Siemens Phenom

Do you happen to have a simple part that contains some of these, that you could share?  That way we could test some code, and we would know that we were testing for the same entities you are trying to find.


Also, I should note that anytime you create a builder in NXOpen, you should be sure to Destroy() it once you are finished with it.  Failing to do that can generate confusing errors, like "Embedded object cannot be deleted in isolation".  The first time you get that error, it can be pretty perplexing.  Thanks!