I'm trying with below code to change the Datum reference text to none and Unit Basis toggle OFF, but getting compile errors:
Option Strict Off Imports System Imports NXOpen Imports NXOpen.UF Module Module1 Sub Main() Dim theSession As Session = Session.GetSession() Dim workPart As Part = theSession.Parts.Work Dim lw As ListingWindow = theSession.ListingWindow lw.Open() Dim myFCF For Each myFCF In workPart.Annotations.fcfs.ToArray() ' Change fcfs to another annotation name to loop thru all of them in part -> Dim x as string x = myFCF.JournalIdentifier Dim markId1 As NXOpen.Session.UndoMarkId = Nothing markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start") Dim fcf1 As NXOpen.Annotations.Fcf = CType(workPart.FindObject(x), NXOpen.Annotations.Fcf) Dim pmiFeatureControlFrameBuilder1 As NXOpen.Annotations.PmiFeatureControlFrameBuilder = Nothing Dim featureControlFrameDataBuilder1 As NXOpen.Annotations.FeatureControlFrameBuilder = Nothing pmiFeatureControlFrameBuilder1 = workPart.Annotations.CreatePmiFeatureControlFrameBuilder(fcf1) ''' Change characteristics pmiFeatureControlFrameBuilder1.Characteristic = NXOpen.Annotations.FeatureControlFrameBuilder.FcfCharacteristic.Flatness ''' Remove text featureControlFrameDataBuilder1.PrimaryDatumExtendedText = "" featureControlFrameDataBuilder1.SecondaryDatumExtendedText = "" featureControlFrameDataBuilder1.TertiaryDatumExtendedText = "" featureControlFrameDataBuilder1.UnitBasis = False ' Unit variation Dim nXObject1 As NXOpen.NXObject = Nothing ''' Commit changes nXObject1 = pmiFeatureControlFrameBuilder1.Commit() Next lw.Close() End Sub Public Function GetUnloadOption(ByVal dummy As String) As Integer 'Unloads the image when the NX session terminates GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination End Function End Module
Any help please?
When you say that you are getting compile errors, does this mean that the compiler is giving you error messages and is refusing to compile the code? If so, what error messages are you getting?
Don't forget to destroy the builder object after committing your change. Failure to do so can result in some strange run time behavior.
I did add below still errors.I think it has nothing do with existing errors.
Please find attached image for errors.
If you have an author license, you can compile your code to a dll or exe file (depending on your needs); doing so has several advantages. If you are running your code as a journal file, NX will take care of compiling your code in the background before running it. Either way, your code must be compiled before it is run.
If you are attempting to compile your code to dll or exe with a tool such as Visual Studio, there is probably an error in the project configuration (referencing old NX dll files?).
If you are receiving this error while using NX's built in journal playback tool, I'd guess something in the NX configuration is incorrect. Perhaps the NX environment variables are pointing to an older install of NX?
"Since this is .vb, it should not require any compilation tools/anything installed right?"
Note that the .net languages will need the correct version of the .net framework installed. This is a separate install from NX. I don't think the framework is the source of your errors, but wanted to add this info to more completely answer your question.
Dim featureControlFrameDataBuilder1 As NXOpen.Annotations.FeatureControlFrameBuilder
The error is giving all details:
error BC30456: 'PrimaryDatumExtendedText' is not a member of 'FeatureControlFrameBuilder'.
So you may simply check the class definition to see where the failing properties belong to:
Good catch, @Beetle.
The featureControlFrameDataBuilder1 variable declaration is inconsistent with its use later in the journal. Also note that the featureControlFrameDataBuilder1 variable is declared as "nothing" and is never created later in the code. You'll need to use the CreateDraftingFeatureControlFrameBuilder method to instantiate the builder object before using it.