Custom Grips on InstanceObject

Hi! I am trying to implement custom grips on a block with my custom user data following this sample.
I am trying to figure out the way to update geometry of the block after the grip has been transformed. In the example geometry is updated through NewGeometry() method. But I am confused how to do it for the Block. Essentially my goal is to replicate the behaviour of VisualARQ objects.
Is there any way I can update the geometry of the block in the NewGeometry() method, or am doing something totally wrong?

Hi @p.furtsev,

I believe VisualArq, written in C++, implements fully custom objects. That is the VisualArq stuff you seen on the screen isn’t a block instance.

That said, you should be able to register a custom grip handler for instance references. The NewGeometry method would just create a new InstanceReferenceGeometry object with an updated transformation matrix.

– Dale

Hello @dale! Thank you for the answer.

Because you can see VisualARQ objects in block manager I supposed they are blocks. Interesting to know that they are just “pretending” to be ones.

I actually tried to return InstanceReferenceGeometry in NewGeometry but I get “Unable to transform 1 object.” in the command line. For testing purpose I just create a rectangle from the bounding box of the block and use it for the SampleCsRectangleGrips. The only things I have modified in the sample are the NewGeometry method just to get a different transformation and added a field to know to which instance object grips belong:

protected override GeometryBase NewGeometry()
{
    UpdateGrips();
    if (GripsMoved && m_draw_rectangle)
    {
        var move = Transform.Translation(new Vector3d(0,0,100));
        var tr = m_object.InstanceXform * move; //m_object is the InstanceObject on which these grips are added
        var instRef = new InstanceReferenceGeometry(m_object.InstanceDefinition.Id, tr);
        return instRef;
    }
  
    return null;
}

Maybe there are details that I am missing out?