By Adam Nagy
We are using several overrules and we found that MoveGripPointsAt is not being called continuously as the grip point is being dragged. It turned out to happen only when we have two overrules using MoveGripPointsAt but filtering for different entities. It seems that filtering does not work for this event and the last registered overrule's MoveGripPointsAt is being called instead of the one that should be called based on the filtering. However, filtering works fine with GetGripPoints.
Solution
MoveGripPointsAt does not honor filtering as that only works on database resident entities and the instance being used by MoveGripPointsAt is an in-memory shallow copy of the entity whose grip point is being dragged. On the other hand GetGripPoints works with database resident entities so filtering works fine with it.
The solution is to do the filtering yourself inside the MoveGripPointsAt function. Since you already add XData to the entities you want to filter on - and XData is copied with the entity even in case of a shallow copy like the one being used by MoveGripPointsAt - therefore you can use that.
public class TestingOverrule : GripOverrule
{
public const string kAppName = "TestProject";
public static TestingOverrule theOverrule =
new TestingOverrule();
public override void MoveGripPointsAt
(Entity entity,
GripDataCollection grips,
Vector3d offset,
MoveGripPointsFlags bitFlags)
{
using (ResultBuffer rb = entity.GetXDataForApplication(kAppName))
{
// If it does not have the XData, then just
// call base class and return
if (rb == null)
{
base.MoveGripPointsAt(entity, grips, offset, bitFlags);
return;
}
}
// ...
}
}