RsTarget.ReferenceFrame and Undo


In my RS Add-in I am using using the Project.UndoContext to create an undo step that modifies and RsTarget's Transform, ReferenceFrame, and Attributes properties.  When the user chooses to undo the modification the Transform and Attributes revert back to their original state, but the ReferenceFrame remains at the newly modified value.  This same behavior can be observed using RsTarget.ShowReferenceFrame and the RS built in functionality for Translate Path, Rotate Path, etc. and using the undo mechanism.

In our application the ReferenceFrame is representing an important concept for us and ideally the undo step would consider it as well.  Is this a bug that can be fixed?  Or is this something we should work around by introducing our own ReferenceFrame Attribute?



  • Johannes WeimanJohannes Weiman ABB Sweden admin
    Hi Levi,
    I think there is a bug and ReferenceFrame is not backed up correctly.
    It should be possible to work around by setting any other property before setting the ReferenceFrame (except Transform because that actually changes the RsRobTarget).
    E.g. something like this
    target.ShowName = !target.ShowName; // Causes all target properties to be backed up
    target.ShowName = !target.ShowName; // change back..
    target.ReferenceFrame.Matrix = ...

  • Thanks so much for this suggestion! It is working well and will keep us moving forward.
Sign In or Register to comment.