[CONNECT C++] Units returned to datapoint function wrong

There is a third party MDL app that when loaded is changing the units returned to my datapoint function. It looks like the third party MDL app sets something that changes the units from UORs to Master Units. Either that or the UOR coordinates are being scaled by .01 For example:

Without third party MDL loaded: [51052240.139345,544303020.506575,0.000000]

With third party MDL loaded: [510522.401393,5443030.205065,0.000000]

The datapoint function is set using StateCallback::SetDataPointFunction(acceptPnt);

How do I reset what the third party did so that the units are returned in UORs instead of master units (or reset the scaling that it's doing).

Thanks in advance,

Loren.

Parents
  • Hi Loren,

    because I have not experienced such behavior in the past, I can guess only: Are you able to check whether 3rd party application do (not) set some ACS transformation? In StateFunc_DataPoint method description, it is mentioned It then transforms the point to the current coordinate system.

    I do not know whether these settings passes MDL tasks borders, but you can also try to call mdlCurrTrans_clear(), but it probably does not fix already passed point.

    But at least, it would be interesting, what mdlCurrTrans_getCount() returns when you function is called.

    With regards,

      Jan

  • Hi Jan,
    Yes the current transform does get set/modified by the third party MDL apps (terraScan/terraModeler) but I call mdlCurrTrans_identity() at the start of primitive command execution. This fixed some other commands that were effected but not a primitive command from my app (and it's only terraModel that revises the coordinates, the identity matrix fixed all issues with terraScan). I have also debug printed the matrix during my command to ensure that the identity matrix is active.

    Would mdlCurrTrans_clear() do anything different then setting the identity matrix? (easy to test so I'll try).

    I have also opened a ticket with TerraSolid as this behaviour reared it's head with a recent update where previous versions did not effect the coordinates but I'm not confident that they will get back to me with a solution. I'm thinking that they are using some different method with tModel such as hooking all datapoint functions or hardwiring their own trans matrix.

    Loren.

  • Update: mdlCurrTrans_clear() did not fix the issue - probably does the same thing as mdlCurrTrans_identity() 

Reply Children
  • What Command and Type of Tool (of yours) is active when seeing this behavior?
    Does your tool attempt to override or have any "AdjustPoint" methods and if so, utilize a project to ACS option/logic?
    Does your tool possibly implement the "Global" (pre/post) locate methods vs. non Global ones? e.g. SetGlobalPostLocateFunction vs SetPostLocateFunction

    FYI.

    mdlCurrTrans_identity - pushes an identity matrix on top of the stack
    mdlCurrTrans_getCount - returns the transform stack count
    mdlCurrTrans_clear - pops all transforms off the stack
     



  • Hi Robert,

    No, my tool does no coordinate adjustments and does not set any pre or post locate functions. It's a pretty complex tool and after starting the primitive uses the  StateCallback:: functions to revise the behaviour based on several factors/states:

    StateCallback::SetDataPointFunction(acceptCat);
    StateCallback::SetResetFunction(modifyCatenaryCmd);
    StateCallback::SetComplexDynamicsFunction(showCatenary);

    Also I have ensured that the identity matrix is active during my command.

    Good idea regarding the SetGlobalPostLocateFunctions, if the third party MDL app sets these that's probably why my command is getting modified coordinates. I'll try to set these to NULL and see if that fixes the issue.

    Thanks, Loren.

  • Alas, no joy setting LocateCallback::SetGlobalPostLocateFunction(NULL); SetGlobalPreLocateFunction(NULL);  - same issue

    Are there any similar hooks that may effect the coordinates returned to my primitive command?

  • Rob, Jan and Jon,

    Thanks for your help/suggestions on this, I have solved the issue. Turns out that the third party app must have set some sort of hook to push their own modified Current Transform onto the stack regardless of whether their own commands were active or not. Even though I pushed the identity matrix or cleared all the current transforms at the start of my command the third party app pushed their own back in sometime after my command was executed.

    Fix was to clear the current transforms later in my command, just before receiving datapoints

    Loren.

    Answer Verified By: Loren