How to delete TriForma Dependency Linkage

Hi All,

I got a file from my customer which they are using Bentley Building product to design. I want to edit the geometry but I can't because these geometries are attached a TriForma Dependency Linkage which prevent me to edit them.  I know TFREMOVE command in Bentley building product can do this but I haven't these products. So I want to remove these linkages by my program. I coded the following program but it can't do this.

MSElementDescrP edP = NULL;
mdlElmdscr_read (&edP, elemAddr[i], ACTIVEMODEL, FALSE, NULL);
if (SUCCESS == mdlDependency_getLinkage (NULL, 0, &edP->el, 48640, 0))
{
   int status2;
   mdlElement_memcpy (&el, &edP->el);
   status2 = mdlDependency_deleteLinkage (&el, 48640, 0); // returning 1 indicates success
   status2 = mdlElmdscr_replaceElement (&edP, &el);
   status2 = mdlElmdscr_rewrite (edP, NULL, elemAddr[i]);
}
mdlElmdscr_freeAll (&edP);
 I noticed that the Required app=1 in this Linkage. Does it mean I can't delete it without TriForma application loaded ?

Attached DGN is a test dgn which only includes on solid with TriForma dependency linkage.

Any help are appreicated !

Xue

SolidWithTFLinkage.dgn
Parents
  • If the mdlDependency_deleteLinkage doesn't work, than because no app is registered for that specific AppId. So if you like to ruin the data by killing a foreign linkage you might even register as THE app that is responsible for this type of linkage. See mdlDependency_registerCallback, and don't forget to remove, and to test if there is still another application registered for this AppId.

    It might be valid to remove those stuff on a copy of the data or if theres really no need for them, but take care that noone needs to reuse them later. You might even change those elements, when registered, but than the stored informations might differ from what the element really is, so removing the linkage is the better way if you plan any changes.

    HTH Michael

    You might even try with mdlDependency_setIgnoreMissingCallback(TRUE) to temporary ignore that an app is required, but this change will influence any dependencies in the current session.



    Answer Verified By: xue.yulian 

  • Michael Stark said:
    You might even register as the app that is responsible for this type of linkage

    Impersonating another application!  Wow!  With ideas like that you are a candidate for recruitment to the secret service  8-)

     
    Regards, Jon Summers
    LA Solutions

  • Unknown said:
    you are a candidate for recruitment to the secret service 

    You think they are interested in recruiting a former inhabitant of a socialist country ? ;-)

    Hopefully the words 'ruin the data' would have shown my intention. But from technical point of view the impersonation has its advantages, as you receive any 'touched' foreign element, instead of needing to scan for all of them. This way you might keep informations, when you haven't changed the element. (same for the ignore... method)

    Michael



  • Michael Stark said:
    You think they are interested in a former inhabitant of a socialist country?

    That hasn't stopped Angela Merkel!

     
    Regards, Jon Summers
    LA Solutions

Reply Children
No Data