Geometric kernel/UI separation in Eyeshot 2022

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
Line ln1 = new Line(Plane.YZ, 50, 90, 50, 0);
Line ln2 = new Line(Plane.YZ, 50, 0, 0, 0);
Line ln3 = new Line(Plane.YZ, 0, 0, 0, 90);

Arc arc = new Arc(Plane.YZ, new Point2D(25, 60), 30, 0, Math.PI);

Point3D[] ps = Curve.Intersection(arc, ln1);
ln1.TrimBy(ps[0], true);
arc.TrimBy(ps[0], true);

ps = Curve.Intersection(arc, ln3);
ln3.TrimBy(ps[0], false);
arc.TrimBy(ps[0], false);

CompositeCurve cc1 = new CompositeCurve(ln1, arc, ln2, ln3);
GLine ln1 = new GLine(Plane.YZ, 50, 90, 50, 0);
GLine ln2 = new GLine(Plane.YZ, 50, 0, 0, 0);
GLine ln3 = new GLine(Plane.YZ, 0, 0, 0, 90);

GArc arc = new GArc(Plane.YZ, new Point2D(25, 60), 30, 0, Math.PI);

Point3D[] ps = GCurve.Intersection(arc, ln1);
ln1.TrimBy(ps[0], true);
arc.TrimBy(ps[0], true);

ps = GCurve.Intersection(arc, ln3);
ln3.TrimBy(ps[0], false);
arc.TrimBy(ps[0], false);

CompositeCurve cc1 = new CompositeCurve(ln1, arc, ln2, ln3);

These are two articles that show how to model using the geometric kernel:  Practice Drawings 125, Hook

To switch between entities and primitive is possible to use the static utility methods under the Entity class such as Entitiy.GetPrimitiveFromEntity() or Entity.CreateEntityFromPrimitive().

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.