DGKC Control Documentation


Skip Navigation Links.
Start page
Quick Start
Search Page
Installation
What is new
Licensing
Expand ModelsModels
Expand DG Kernel ControlDG Kernel Control
Collapse API ReferenceAPI Reference
Interface List
Vector Space
Expand General GeometryGeneral Geometry
Collapse ModelModel
Expand ViewView
Expand General ComputingGeneral Computing
Expand ViewsViews
Expand Samples and TutorialsSamples and Tutorials
Expand GraphicsGraphics
Expand Math ObjectsMath Objects
Expand DeprecatedDeprecated
Redistribution
Model Viewer
Support
Skip Navigation LinksHome Page > API Reference > Model > Entities > IEntity_DG Go to ActiveX docs Search Documentation


IEntity_DG Interface

Represents an entity

Typical methods of obtaning IEntity_DG: IModel_DG.GetEntityAt(); IEntity_DG.GetChildAt(); IObjectGenerator_DG.Create<Entity_DG>().

Implements also: IArray_DG (array of children), IMaterial_DG, ITexture_DG, IConstraint_DG, IMetrics_DG, IObject_DG, IUserData_DG, ISpinEffect_DG.

Properties

string Name
string GeometryType
bool Visible
bool Transient

Valid options for the GeometryType property:

BRep
Mesh
3DS
SOR
SegmentStrip
PointArray
Curve
Overlay
Label3D
Label3dManaged
Measurement
ViewPoint

See more details in Geometry topic.

On changing the geometry type, if the requested type is different from the current type, the software replaces geometry of the entity with the new one. Where possible, its internal shape is copied (transformed) to the new type. The handler returns the new geometry for convenience. There is no need to call AttachGeometry() with the returned object. Density of the resulting mesh in case of type = "Mesh" can be controlled. Details. The SetGeometryTypeEx method below can also be used to explicitly specify deviation used in the convertion.

Methods

GetGeometry
AttachGeometry
SetGeometryTypeEx
GetLocation
GetLocationDetached
GetAppearance
SetColor
SetVisible
GetChildCount
GetChildAt
GetEntity
GetLastChild
AddChild
Add
AddNewChild
AddNewChild1
AddChildBRepShape
AddNewChildBRepShape
AddNewChildBRepSolid
GetChildArray
GetEntities
GetEntityPath
RemoveAt
RemoveEntity
RemoveEntities
RemoveAll
Find
BuildChildToParentMap
GetBoundingBox
SaveAs
Copy
Clone
GetExtendedProperties
GetEnumerator

IGeometry_DG GetGeometry()


void AttachGeometry(IGeometry_DG geometry)

Changes or sets geometry of the entity. geometry can be created separately of obtained from another entity to share. Old geometry is released (and deleted is there were no other users for it)


IGeometry_DG SetGeometryTypeEx(string type, IDictionary_DG context)

Changes geometry type. See the GeometryType property above for valid options of the type parameter.

The context parameter is used in this version only during conversion of parametric (BRep,3DS,SOR) geometries to Mesh type.

If not null, context is checked for a double type item named "Deviation". The value determines precision of the approximation. It makes a difference only for curved surfaces. It is recommended experimenting with low deviation first (1/10 of the geometry size as returned by GetGeometry()>GetBoundingBox()>GetMaxDimension() is a good start.) as an excessively fine mesh can reduce performanace and increase file sizes dramatically.

Example:

IModel_DG iModel = m_dgkc.GetModel();
IStdShape_DG iStdShape = iModel.As<IStdShape_DG>();
IObjectGenerator_DG gen = iModel.As<IObjectGenerator_DG>();
IEntity_DG entity = iStdShape.Sphere(1);
iModel.AddEntity(entity);
 
IDictionary_DG context = gen.Create<IDictionary_DG>(); 
context.SetDouble("Deviation", 0.05);
 
entity.SetGeometryTypeEx("Mesh", context);

See also IEntityTest.SetGeometryTypeEx() method in Samples\NET\C#\Tests\InterfaceTests\IEntityTest.cs


IFrame_DG GetLocation()

Access to generic location, which includes orientation.


IFrame_DG GetLocationDetached()

A read-only version of GetLocation(). Modifications to the returned frame have no effect on the entity


IAppearance_DG GetAppearance()


void SetColor(float red, float green, float blue)

A simplified (shortcut) way to quickly change color of an entity. If the entity has material, values of ambient and diffuse components are set to the specified color


void SetVisible(bool visible, bool includeDescendents)


int GetChildCount()


IEntity_DG GetChildAt(int index)


IEntity_DG GetEntity(string path)

Accesses entities by their names. Allows retrieving entites on level deeper than the first. Similar to Windows file system paths, levels are separated by back slashes. path must be relative to this entity (the entity which implments this interface)

Examples:
MyTopBox
MyTopBox\ChildSphere\Cone
TopTorus\2
The second example is used in case when the third child has empty name string, in which case zero based indices are used. The search is case insencetive.


IEntity_DG GetLastChild()


void AddChild(IEntity_DG entity)


void Add(IEntityArray_DG entities, int insertAtOrNegative)


IEntity_DG AddNewChild()


IEntity_DG AddNewChild1(string type)

type specifies type of geometry. Valid values are listed at GeometryType property


IEntity_DG AddChildBRepShape(IBRepShape_DG shape)

Adds a new child entity with BRep type of geometry representing shape


IEntity_DG AddNewChildBRepShape(ShapeType_DG type)

Adds a new child entity with BRep type of geometry representing a new empty shape of the specified type


IEntity_DG AddNewChildBRepSolid()

Adds a new child entity with BRep type of geometry representing a new empty solid


IEntityArray_DG GetChildArray(bool includeDescendents)

if includeDescendents is true the returned array contains a flat array, which lists all descendents on all levels


IEntityArray_DG GetEntities(string path, bool includeDescendents)

if includeDescendents is true the returned array contains a flat array, which lists children of the entity at path and all its descendents on all levels


string GetEntityPath(IEntity_DG entity)

If entity is a descendent of this, returns path of entity relative to this. Otherwise returns an empty string.


void RemoveAt(int index)


bool RemoveEntity(IEntity_DG entity)

Removes an immediate child. Returns false if entity is not a child


void RemoveEntities(IEntityArray_DG entities)

If any entity in entities is a child of this it is removed from this


void RemoveAll(bool includingDescendantsFromParents)

Clears set of children of this. If includingDescendantsFromParents is true all descendents are removed (released) from their parents


int Find(IEntity_DG entity)

Returns 0-based index of an immediate child or -1


IMapUnkn_DG BuildChildToParentMap()

The returned map contains entities (map[IEntity_DG]) is an IEntity_DG) and is read-only in this release. map[iEntity] is parent of iEntity in hierarchy of descendents of this entity.
There is no GetParent() method as entities can be shared between models.


PairIntDg GetBoundingBox(bool includeDescendants)


bool SaveAs(string filePath, bool includeChildren)

The path can have any supported extension. Returns false in case of errors.


void Copy(IEntity_DG entity)


IEntity_DG Clone()


IDictionary_DG GetExtendedProperties()


IEnumerator GetEnumerator()

The returned IEnumerator interface type is part of Micorsoft .NET System.Collections namespace. This instance enumerates IEntity_DG of children of this entity.