70002802 A new property for vdShape to exclude the sub entities from the selection stack

Article 70002802
Type Wish
Product Engine
Date Added 12/10/2025 12:00:00 AM
Fixed 11.5.03 (12/10/2025 12:00:00 AM)
Submitted by Gianmaria Cavion

Summary

A new property for vdShape to exclude the sub entities from the selection stack

Solution

In version 11.5.3 a new virtual property UseSubEntitiesInSelectionStack of vdShape object was added
Gets if Sub Entities from FillShapeEntities(ref vdEntities) are returned in the selection
Default value is true.
Override this property in your custom object that inherit from vdShape and set it to false in order to exclude them from the selection,
For example if you want to override the getOsnapPoints of vdShape and do not include subentities osnaps

Example:
Create a vdShape with UseSubEntitiesInSelectionStack override to false

public class MyShape : vdShape
{
    public override void FillShapeEntities(ref vdEntities entities)
    {
        //add a cirle to sub entities of the shape relative to object Ecs
        vdCircle circle = new vdCircle(Document, new gPoint(), 5);
        entities.AddItem(circle);
    }
    //do not add the sub entities to selection stack
    public override bool UseSubEntitiesInSelectionStack => false;
    public override bool getOsnapPoints(Matrix object2viewcs, OsnapMode mode, gPoint pickPoi, gPoint LastPoi, int SegCount, OsnapPoints osnaps)
    {
        //only the osnap INS is return no other osnaps of the sub-entities
        //if you set the UseSubEntitiesInSelectionStack to true -or- not override the method, then the sub-entities osnaps are also return
        if (mode == OsnapMode.INS)
        {
            gPoint ins = new gPoint();
            osnaps.AddItem(new OsnapPoint(ins, mode, object2viewcs, ECSMatrix, OsnapPoint.PointCoordSystem.ECS, this, osnaps.RenderingObject as IvdRenderViewProperties));
            return true;
        }
        return false;
    }
}
public void Test()
{
    MyShape myshape = new MyShape();
    myshape.SetUnRegisterDocument(doc);
    myshape.setDocumentDefaults();
    myshape.Origin = new gPoint(1, 1);
    doc.Model.Entities.AddItem(myshape);
    doc.Redraw(true);
}

Send comments on this topic.