From Eyeshot 2023, GEntity class and inherit classes have been abandoned in favor of a new architecture.
With Eyeshot 2022 we make a strong separation between geometric algorithms and object rendering. For this reason, we introduced a new hierarchy of objects under the namespace devDept.Geometry.Entities that can be used to perform geometric modeling without dealing with graphic attributes.
Most standard entities (hereafter, just entity) depend now on their geometric entities (hereafter, primitive). Entities still expose geometric methods and properties but only as wrappers to primitive's ones. Beware that If something is changed directly on the primitive, the related entity must be regenerated to be correctly rendered.
That said, now it's a good practice to work with the geometric kernel and create an entity only when needed for rendering, as shown in the below code:
GBrep box = GBrep.CreateBox(10, 10, 10);
GBrep cyl = GBrep.CreateCylinder(2, 14);
cyl.Translate(5, 5, -2);
GBrep diff = GBrep.Difference(box, cyl)[0];
Brep brep = new Brep(diff);
design1.Entities.Add(brep, Color.Beige);
The most relevant change affects the instance of “composite entities” such as CompositeCurve, Region, etc. that now are defined by a collection of primitives instead of entities.
v2021 | v2022 |
|
|
To switch between entities and primitives is possible to use the static utility methods under the Entity class such as Entitiy.GetPrimitiveFromEntity() or Entity.CreateEntityFromPrimitive().
Why are GEntity.BoxMin/BoxMax properties not available?
Entity.BoxMin/BoxMax properties were computed on entity tessellation vertices. Tessellation is something we want to keep on the UI side. Following this principle, you can generate tessellation vertices from the geometric kernel (using IGEntity.ComputeTessellation() method) but not keep tessellation or bounding box data into its entities.
As a side note, IGCurve implementor classes can use the GetTightBBox() method that returns the exact curve bounding box.
For a rough estimation of entity size, e.g. for tolerances estimation, the GEntity.GetCoarseSampling() method can be a valid alternative.
Comments
Please sign in to leave a comment.