Submitted by haipal111 on Fri, 11/22/2024 - 01:18
Forums:
The code below can change the font of all objects to #kanji (font number 5). However, I want to check what the current font of those objects is?
Thank in advance!
for note in displayPart.Notes:
editViewLabelSettingsBuilder1 = workPart.SettingsManager.CreateDrawingEditViewLabelSettingsBuilder(note)
editsettingsbuilders1 = [NXOpen.Drafting.BaseEditSettingsBuilder.Null] * 1
editsettingsbuilders1[0] = editViewLabelSettingsBuilder1
workPart.SettingsManager.ProcessForMultipleObjectsSettings(editsettingsbuilders1)
editViewLabelSettingsBuilder1.AnnotationStyle.LetteringStyle.GeneralTextFont = 5 # kanji
editViewLabelSettingsBuilder1.Commit()
re: get font name
Use the edit settings builder to check the current font number of the desired note. Something like: myFontNum = editViewLabelSettingsBuilder1.AnnotationStyle.LetteringStyle.GeneralTextFont
This will give you an integer value that is used in the part's font table. You can then check for the name of the font mapped to that number in the current work part. Something like: theFontName = workpart.Fonts.GetFontName(myFontNum)