Cancel
Showing results for 
Search instead for 
Did you mean: 

Change Datum text and unit basis value for PMI FCF

Siemens Phenom Siemens Phenom
Siemens Phenom

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?

 

Regards,

Samadhan

Regards,
Samadhan

GTAC | NX Help: NX1102 | NX1202 | NX1847
Please mark post as an "Accepted Solution", if it answers your question/is more helpful!
9 REPLIES 9

Re: Change Datum text and unit basis value for PMI FCF

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

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.

https://community.plm.automation.siemens.com/t5/NX-Programming-Customization-Forum/Change-characteri...

Re: Change Datum text and unit basis value for PMI FCF

Siemens Phenom Siemens Phenom
Siemens Phenom

I did add below still errors.I think it has nothing do with existing errors.

 

pmiFeatureControlFrameBuilder1.Destroy

Please find attached image for errors.CompileErrors.JPG

 

-Samadhan

Regards,
Samadhan

GTAC | NX Help: NX1102 | NX1202 | NX1847
Please mark post as an "Accepted Solution", if it answers your question/is more helpful!

Re: Change Datum text and unit basis value for PMI FCF

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

What version of NX are you using and is your project referencing the correct version of the NX dll files?

 

 

Re: Change Datum text and unit basis value for PMI FCF

Siemens Phenom Siemens Phenom
Siemens Phenom

Using NX1202.

How can I ensure if all needed .dll setup is done?

Regards,
Samadhan

GTAC | NX Help: NX1102 | NX1202 | NX1847
Please mark post as an "Accepted Solution", if it answers your question/is more helpful!

Re: Change Datum text and unit basis value for PMI FCF

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

What tool are you using to compile the code?

Do you have any other versions of NX installed other than NX 12?

Re: Change Datum text and unit basis value for PMI FCF

Siemens Phenom Siemens Phenom
Siemens Phenom

Since this is .vb, it should not require any compilation tools/anything installed right?

Regards,
Samadhan

GTAC | NX Help: NX1102 | NX1202 | NX1847
Please mark post as an "Accepted Solution", if it answers your question/is more helpful!

Re: Change Datum text and unit basis value for PMI FCF

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

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?

 

 edit:

"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.

Highlighted

Re: Change Datum text and unit basis value for PMI FCF

Siemens Genius Siemens Genius
Siemens Genius

@SamadhanGaikwad wrote:

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:

 

FeatureControlFrameBuilder

vs.

FeatureControlFrameDataBuilder

 

Re: Change Datum text and unit basis value for PMI FCF

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

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.