Submitted by Aniket Shastri on Thu, 06/27/2024 - 23:32
Forums:
Hello all, I have to get the Pminote from NoteCollection with the help of Foreach loop but I am getting an error as to get the PmiNote from NoteCollection.
I get an error to convert Note to PmiNote.
Could you help me to get or convert it to PmiNote.
NXOpen.Annotations.NoteCollection oPmiNote = oWorkPart.Notes;
foreach (NXOpen.Annotations.Note oNote in oPmiNote)
Next
Thank you.
Try This!
using System;
using NXOpen;
using NXOpen.Annotations;
public class NXJournal
{
private static NXOpen.Session theSession = NXOpen.Session.GetSession();
public static void Main(string[] args)
{
NXOpen.Part displayPart = theSession.Parts.Display;
foreach (BaseNote thisNote in displayPart.Notes)
{
NXOpen.Annotations.PmiNoteBuilder pmiNoteBuilder1;
pmiNoteBuilder1 = displayPart.Annotations.CreatePmiNoteBuilder(thisNote);
Echo(thisNote.Name);
string[] text1 = pmiNoteBuilder1.Text.GetEditorText();
foreach (string thisString in text1)
Echo(" " + thisString);
NXOpen.NXObject nXObject1;
nXObject1 = pmiNoteBuilder1.Commit();
pmiNoteBuilder1.Destroy();
}
}
public static void Echo(string output)
{
theSession.ListingWindow.Open();
theSession.ListingWindow.WriteLine(output);
theSession.LogFile.WriteLine(output);
}
public static int GetUnloadOption(string dummy)
{
return (int)NXOpen.Session.LibraryUnloadOption.Immediately;
}
}