Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

Problem on journal with NX 11

[ Edited ]

Hi,

on NX 10 the journal works, but on NX 11 no.

Attached the code.

Master_shhet_error.png

Thank you...

Using NX 11 / RuleDesigner PDM

9 REPLIES

Re: Problem on journal with NX 11

It looks like the line it's failing on is:

theUFSession.Drf.AskHatchFillPreferences(myHatchPref)

But the underlying C function it calls states that the parameter is input/output, so I would suggest that you have to define myHatchPref before passing it in.

Why it worked before but does not now, I have no idea. I can only guess that Siemens 'fixed it' at NX11. It probably shouldn't have worked before.

Graham Inchley Snr R&D Engineer (Systems Development), Sandvik Coromant
Lenovo ThinkPad W540, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX8.5.3.3 MP11 64bit Testing: NX9.0.2.5

Re: Problem on journal with NX 11

Thank you @Inch,

how myHatchPref must defined, I'm not a programmer.

Thank you...

Using NX 11 / RuleDesigner PDM

Re: Problem on journal with NX 11

I don't use VB, so this is a bit of a guess, but try changing the line:

Dim myHatchPref As UFDrf.HatchFillPreferences

to

Dim myHatchPref As New UFDrf.HatchFillPreferences

Note the addition of the word New

Graham Inchley Snr R&D Engineer (Systems Development), Sandvik Coromant
Lenovo ThinkPad W540, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX8.5.3.3 MP11 64bit Testing: NX9.0.2.5

Re: Problem on journal with NX 11

Hi @Inch,

substituted but doesn't work.

Thank you...

Using NX 11 / RuleDesigner PDM

Re: Problem on journal with NX 11

Was it the same error or something different?
Graham Inchley Snr R&D Engineer (Systems Development), Sandvik Coromant
Lenovo ThinkPad W540, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX8.5.3.3 MP11 64bit Testing: NX9.0.2.5

Re: Problem on journal with NX 11

Identical

Thank you...

Using NX 11 / RuleDesigner PDM

Re: Problem on journal with NX 11

I'm stumped then, sorry.
Graham Inchley Snr R&D Engineer (Systems Development), Sandvik Coromant
Lenovo ThinkPad W540, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX8.5.3.3 MP11 64bit Testing: NX9.0.2.5

Re: Problem on journal with NX 11

I'd suggest contacting GTAC as this looks like it may be a bug introduced into the NX 11 API.

 

For a fix to your problem, you could use a drafting settings builder object rather than the call to .AskHatchFillPreferences.

 

Dim preferencesBuilder1 As NXOpen.Drafting.PreferencesBuilder = Nothing
preferencesBuilder1 = workPart.SettingsManager.CreatePreferencesBuilder()

preferencesBuilder1.AnnotationStyle.HatchStyle.Color = workPart.Colors.Find("Medium Azure Blue")

Dim nXObject1 As NXOpen.NXObject = Nothing
nXObject1 = preferencesBuilder1.Commit()

preferencesBuilder1.Destroy()
Solution
Solution
Accepted by topic author cubalibre00
2 weeks ago

Re: Problem on journal with NX 11

 

I was able to run your code at least as far as the previous error by assigning dummy values to each of the structure elements that get passed into the AskHatchFIllPreferences method, like this:

 

    Sub HatchPrefBlue()

        'this will set the hatch color preference
        'but "dialog memory" may prevent new hatch objects from inheriting this color

        Dim myHatchPref As New UFDrf.HatchFillPreferences

        myHatchPref.area_fill_angle = 45
        myHatchPref.area_fill_material = UFDrf.AreaFillMaterial.SolidFill
        myHatchPref.area_fill_scale = 1
        myHatchPref.color = 211
        myHatchPref.hatch_angle = 45
        myHatchPref.hatch_distance = 2.5
        myHatchPref.hatch_file = "dummy string"
        myHatchPref.hatch_material = "Wood"
        myHatchPref.hatch_tolerance = 0.02
        myHatchPref.width = UFDrf.LineWidth.ThicknessFive

        'get current preferences
        theUFSession.Drf.AskHatchFillPreferences(myHatchPref)

        Echo("Back from asking for the hatch fill prefs....")

 

Of course after that it failed, because I don't have the parts it was looking for, but please try the above and see if it fixes your issue.  I found I could comment out the myHatchPref... = statements and reproduce your error message, so I hope this helps!