CADability dotNET

Geometric Entities

What are geometric entities for?

Geometric entities are the main objects in the CADability database.

Usually many geometric entities are contained in a Model. If a model is displayed in a ModelView the geometric entities are displayed on the screen (in the CADControl). There are some families of geometric entities:

  • Curves (e.g. Line, BSpline, etc.)
  • Blocks (collections of geometric entities, hierarchical tree of objects)
  • BRep objects (e.g. Solid, Face, etc.)
  • Text
Geometric entities are serializable (via the .net ISerializable interface) both binary and as XML strings.

What do all geometric entities have in common?

From a programmer's point of view it is the IGeoObject

interface. Geometric entities may be
  • visualized (in a Model which is contained in a ModelView)
  • serialized (via the ISerializable interface)
  • selected with mouseclicks in various ways
  • modified by a ModOp
  • displayed in the control center, where their properties are editable

How do I define my own geometric entity?

There are several ways to define customized geometric entities:

1. Define a class that implements IGeoObject and ISerializable. This is certainly a huge task and in most cases not necessary.

2. Derive a class from IGeoObjectImpl. This is a standard implementation of IGeoObject but still leaves alot of work to do.

3. Derive a class from Block. Add some additional properties and create child entities according to these properties. Maybe override GetShowProperties to define it's appearance in the control center.

How do I connect additional information to Geometric Entities?

Use the UserData property. This property acts like a dictionary that lets you add any data to the geometric entity. If your data is serializable it will also be saved in the CADability database (cdb file). If your data implements the IShowProperty interface or is a simple datatype like int, double or string, it will be displayed in the control center (when the object is selected).