Hi Guys,
Here is my code for deleting the element.
mdlElement_read(&MsElm,MASTERFILE,*FilePos);mdlElement_undoableDelete(&MsElm,*FilePos,TRUE);
Working Fine, deleting the specified File Position.
If user undo the process by clicking Ctrl + Z or Edit -> Undo deleted element must not display(Element must be deleted Permanently).
Unknown said:mdlElement_undoableDelete
The name contains a clue: if you delete an element using that function it will be undoable.
MicroStation's editing tools all fill the Edit|Undo and Edit|Redo command buffers. It's what a user expects. Why do you want to change that idiom?
Take a look at the Compress command in MicroStation help: Compressing a DGN file reduces its size and clears the undo buffer.
The MDL equivalent is mdlSystem_compressDgnFile. Proceed with caution.
Regards, Jon Summers LA Solutions
Hi Jon,
I don't want to compress the entire Dgn file.
I just want to remove the specified element permanently from the file.
Is this possible ?
Unknown said:I just want to remove the specified element permanently from the file
Experiment with mdlUndo_setActive. Proceed with caution.
Try this:
mdlElement_read(&MsElm,MASTERFILE,*FilePos);mdlElement_undoableDelete(&MsElm,*FilePos,TRUE);mdlUndo_setActive(TRUE);
Problem is, that deleted elements are held in the DgnCache, and their ElementRefs remain valid, until the cache is closed or compressed. Also Undo perhaps saves all changes, so it is not as easy task. However, suggested code would probably work, but it clears complete undo buffer, so no changes are undoable after that.
You may also try to experiment with temporarily blocking Undo operation while leaving everything else as is.
/*------------------------------------+| Name: blockUndoCallback CALLBACK |+------------------------------------*/Private void blockUndoCallback(MSElementDescr *newEdP, /* => */MSElementDescr *oldEdP, /* => */ChangeTrackInfo *infoP, /* => */boolean *cantBeUndoneP /* <> */) { *cantBeUndoneP = TRUE; }/*-----------------------------------+| Name: disableUndo |+-----------------------------------*/Public void disableUndo (void) { mdlChangeTrack_setFunction ( CHANGE_TRACK_FUNC_Changed, blockUndoCallback ); }
Cheers,
/Chris Z.
could I ask Why? Is there some external data that needs to be synchronized? If so then look at the ChangeTrack API to see if that can help you.
Regards,
mark anderson [Bentley]
Visit me at https://communities.bentley.com/communities/other_communities/bentley_innovation/default.aspx
mdlElement_read(&MsElm,MASTERFILE,*FilePos);
mdlElement_undoableDelete(&MsElm,*FilePos,TRUE);
mdlSystem_compressDgnFile(); // Won't this stop the undo?