DG Kernel (ActiveX) Documentation


Skip Navigation Links.
Skip Navigation LinksHome Page > API Reference > Model > Entities > IEntity_DG Go to DGKC 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.

GetName
SetName
GetGeometryType
SetGeometryType
SetGeometryTypeEx
GetGeometry
AttachGeometry
GetLocation
GetLocationDetached
GetAppearance
SetColor
IsVisible
SetVisible
SetVisible1
IsTransient
SetTransient
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

string GetName()


void SetName(string name)


string GetGeometryType()

IGeometry_DG SetGeometryType(string type)

Valid options for the type parameter:

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

If the requested type is different from the current type, the method replaces geometry of the entity with the new one. Where possible, its internal shape is copied (transformed) to the new type

The method 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.


IGeometry_DG SetGeometryTypeEx(string type, IDictionary_DG context)

Changes geometry type. See the previous method 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_DGPtr iModel = m_dgkc.GetModel();
IStdShape_DGPtr iStdShape = iModel;
IObjectGenerator_DGPtr gen = iModel;
IEntity_DGPtr entity = iStdShape->Sphere(1);
iModel->AddEntity(entity);
 
IDictionary_DGPtr context; 
gen->Create("IDictionary_DG", (IUnknown**)&context); 
context->SetDouble("Deviation", 0.05);
 
entity->SetGeometryTypeEx("Mesh", context);

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)


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


bool IsVisible()


void SetVisible(bool visible)


void SetVisible1(bool visible, bool includeDescendents)


bool IsTransient()

Returns the flag, which determines whether the entity is excluded from saving to file system operations


void SetTransient(bool transient)

Determines whether the entity should be excluded from saving to file system operations


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 IEntity_DG.SetGeometryType()


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.


Box_DG 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.