Block Edit and Object table


I am trying to monitor the change in Object Table, to find out if any new object is added or any object is deleted. But whenever a user enters block edit mode, the object table changes (The objects inside the blocks are added to the table). I want to ignore the change in object table due to a user entering block edit mode. Is this possible? Is there any event that is called when a user enters Block Edit mode? Thanks.

(Dale Fugier) #2

Hi @Darryl_Menezes,

To be notified when Rhino command begin and end, implement event handlers for Command.BeginCommand and Command.OnEndCommand.

using Rhino.Commands;
Command.BeginCommand += OnBeginCommand;
Command.EndCommand += OnEndCommand;

/// <summary>
/// Called when a command begins
/// </summary>
public static void OnBeginCommand(object sender, CommandEventArgs e)
  // TODO...

/// <summary>
/// Called when a command ends
/// </summary>
public static void OnEndCommand(object sender, CommandEventArgs e)
  // TODO...

When entering block edit mode, the BlockEdit command will both begin and end.

When exiting block edit mode, the hidden BlockEditApplyInPlaceEditItemChanges command will both begin and end.

Check the CommandEventArgs parameter for the name of these commands begin and end. With this, you should be able to ignore objects added or modified during block editing.

– Dale




Hi @Dale,
Sorry for the late question. Is there any event to track when the ‘Block Edit dialog box’ is closed by clicking the ‘X’ on the form? Because I want to restrict certain operations during block edit mode and allow them only when the last run command is “BlockEditApplyInPlaceEditItemChanges”. But when the ‘X’ is clicked, the last run command is still “BlockEdit” even when the user is out of the block edit mode. Thanks.

(John Morse) #7

The BlockEdit command is currently in a plug-in and does not post any completion states to Rhino. If you are using a CRhinoEventWatcher to identify when the command is completing you might try looking at the provided result code and see if it is equal to cancel.