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

Looking for help/advice regarding how to access parasolid objects

Code follows:
public static unsafe void DiagnTags(NXOpen.UF.UFSession ufsess, Body body)
    // This call to AskKernelVersion(..) works ok
    NXOpen.UF.UFPs.KernelVersion psver = new NXOpen.UF.UFPs.KernelVersion();
    ufsess.Ps.AskKernelVersion(ref psver);
    GGG.Writev("", psver.build_number, psver.major_revision, psver.minor_revision, psver.year);

    Tag tagPS;
    PK.ENTITY_t pkent;
    PK.CLASS_t pkcls;
    foreach (Face faceIter in body.GetFaces())
        ufsess.Ps.AskPsTagOfObject(faceIter.Tag, out tagPS);

        pkent = new PKENTITY((int)tagPS);
        PK.ERROR.code_t pkstatus = PK.ENTITY.ask_class(pkent, &pkcls);
        GGG.Write(pkstatus.ToString()); // pkstatus returns as modeller_not_started

The immediate problem is that my call to PK.ENTITY.ask_class(..) and many other methods fails returning modeller_not_started.


I have a parasolid development license, but perhaps there is something I must do to tell NX that I have that license.  Also the part that owns the body is sess.Parts.Work.


In an earlier effort that I cannot duplicate, I was getting past this call but value returned by ask_class indicated that the returned objects were not faces.  Once I get past the modeller_not_started issue, I will post that issue.


This posting relates to 2 other postings:
    "Trouble reading EDGE names"
    "Having difficulty reading parasolid attributes via NXOPEN."


Re: Looking for help/advice regarding how to access parasolid objects

Here is some code that I have used in the past:


      /// <summary>Get the Parasolid tag from this NX.Face</summary>
      internal NXOpen.Tag PsTag
            NXOpen.Tag psTag;
            Globals.UFSession.Ps.AskPsTagOfObject(this.NXOpenTag, out psTag);
            return psTag;

      /// <summary>Get the Parasolid face from this NX.Face</summary>
      internal PK.FACE_t PsFace
            PK.FACE_t psFace = (PK.FACE_t)(int)this.PsTag;
            return psFace;


I was calling the Parasolid .NET library, so I have


using PK = PLMComponents.Parasolid.PK_.Unsafe;

at the top of my C# file.



The code uses SNAP stuff (NX.Face, Globals.UFSession, etc) but the correspondence with NX/Open stuff should be obvious.


Re: Looking for help/advice regarding how to access parasolid objects

The code I posted is also C# and equivalant to the code you offerred. 


Both approaches return a parasolid tag that looks like it might be valid. 


My troubles start after that point, when I try to do something with the parasolid tag.


In the code shown in the original posting I call 

pkstatus = PK.ENTITY.ask_class(pkent, &pkcls);

At the moment pkstatus returns as: modeller_not_started

and pkcls is @null.

Accepted by topic author bobk
‎07-06-2016 04:28 PM

Re: Looking for help/advice regarding how to access parasolid objects

I found the problem/solution

The pskernel.dll file should not have been copied to the startup folder with pskernel_net.dll.  Once I removed pskernel.dll the error (modeller_not_started) ceased and the class-type returned seems correct now.


When developing a free-standing parasolid application one always copies the 2 files together, but for integrating with NX we must use the one linked to NX.  The one I was using wasn't even the right version.