DG Kernel Documentation


Skip Navigation Links.
Skip Navigation LinksHome Page > API Reference > General Geometry > General > IElement Search Documentation


IElement Interface

GetParamCount
GetParam
SetParam
GetNamedParam
SetNamedParam
GetParamName
GetParamId
GetElemClassName

IElement is the main interface, which does modifications of internal shape of objects in DInsight software. All primitive geometrical elements like 2D points, arc and lines of the Profile Curve for a Surface of Revolution  implement IElement interface. In case of a Generic 3D Object IElement is implemented by surface patches and their edges as well as by geometrical elements of Profiles. See also Elements

IElement controls set of parameters possessed y the element. Number of parameters and their symbolic names (See Elements) can be queried at runtime with GetParamCount and GetParamName.

IElement can be obtained from the correspondent IStrip with a call to GetElement method.

See also  IElem interfacePatch Tutorial, MiniCAD Sample, Parameters, Interface List


HRESULT GetParamCount(int *pnCount)

Parameters

pnCount - [out] pointer to the variable which will receive number of parameters in the element.

Return Values

S_OK in case of success.

DISP_E_PARAMNOTOPTIONAL - if pnCount is NULL.

Remarks

Call to get the number of parameters, which determine geometry of the element.

HRESULT GetParam( int id, double *pd)

Parameters

id - [in] zero-based index of the parameter.

pd - [out] pointer to a double variable that will receive value of the parameter. 

Return Values:

S_OK in case of success.
 
DISP_E_BADINDEX - if id is greater than or equal to the number of parameters.
 
Remarks
 
Returns value of the parameter id

All angles in the software are internally represented in radians, so when the parameter is an angle, the returned value will be in range (-PI, PI].


HRESULT SetParam( int id, double d)

Parameters:

id - [in] zero-based index of the parameter.

pd - [in] new value of the parameter. 

Return Values:

S_OK in case of success
 
DISP_E_BADINDEX - if id is greater than or equal to the number of parameters

DI_E_INVALIDGEOMETRY - if the modification was rejected because it makes geometry of the model invalid.

Remarks:
 
Call to set value of a parameter. After successful call to SetParam method and before any other modification of  the same parameter, there should be a call to UpdateSurface method of the DG Kernel control or call to Update method of the IModel interface. Return value DI_E_INVALIDGEOMETRY is declared in  file Samples\VC\DIerror.h of the installation directory. This return value means that some arc in the current strip would become invalid after the modification. Note that return S_OK means that only a simple validation succeeded. The geometry of the model may still be invalid and can be rejected later during the call to UpdateSurface() method of the control. In the later case all modifications since the previous call to UpdateSurface() will be discarded.

All angles in the software are internally represented in radians, so when the parameter is an angle, new value should be in range (-PI, PI] otherwise the methods returns DI_E_INVALIDGEOMETRY and the parameter will remain unchanged.


HRESULT GetNamedParam(char* szParamName, double *pd)

Parameters:

szParamName - [in] - pointer to a string containing the parameter name.

pd - [out] pointer to the double variable, which will receive the value of the parameter. 

Return Values:

S_OK in case of success

DISP_E_PARAMNOTOPTIONAL - if szParamName is NULL.

DISP_E_UNKNOWNNAME - In case there is no parameter with this name.

Remarks:

Objects implementing IElement keep names for each parameter. See Elements for parameter names. Parameter names of an object can be queried at runtime with  GetParamCount and GetParamName methods. Call GetNamedParam method to retrieve value of the parameter. 
 

 HRESULT SetNamedParam(char* szParamName, double d)

Parameters

szParamName - [in] - pointer to a string containing the parameter name.

d - [in] new value of the parameter.

Return Values

S_OK in case of success

DISP_E_PARAMNOTOPTIONAL - if szParamName is NULL.

DISP_E_UNKNOWNNAME - In case there is no parameter with this name.

Remarks:

Object implementing IElement keep names for each parameter. See Elements for parameter names. Parameter names of an object can be queried at runtime with  GetParamCount and GetParamName methods. Call SetNamedParam method to change value of the parameter. Between two calls for this method, which implemented by the same object (it was obtained from the same parent interface), there should be call for UpdateSurface method of DG Kernel control or call for Update method of IModel interface.


 HRESULT GetParamName(int id, char* szParamName)

Parameters

id - [in] zero-based index of the parameter.

szParamName - [out] Pointer to a string which will receive the name. The string has to be allocated by the caller. Maximal length of any parameter name is limited by eMaxParamName member of EDIConst enumeration. In this release eMaxParamName = 30. C/C++ declaration of EDIConst is available in DITypes.h (include DIInterface.h)

Return Values

S_OK in case of success

DISP_E_PARAMNOTOPTIONAL - if szParamName is NULL.

DISP_E_BADINDEX - if id is greater than or equal to the number of parameters
 
Remarks:
Objects implementing IElement keep names for each parameter. See Elements for parameter names.  Call this method to retrieve name of the parameter.
 

 
HRESULT GetParamId(char* szParamName, int *plId)

Parameters

szParamName - [in] pointer to a string containing the parameter name.

plId - [out] pointer to an integer variable, which will receive the id of the parameter

Returns

S_OK in case of success

DISP_E_PARAMNOTOPTIONAL. - if szParamName or plId is NULL or there is no parameter with this name.

Remarks:

Objects which implement IElement keep names for each parameter. See Elements for parameter names. Object's parameter names can be queried at runtime with  GetParamCount and GetParamName methods. Call GetNamedParam method to retrieve the value of the parameter.
 
 

 HRESULT GetElemClassName(char* szName)

Parameters

szName - [out] - pointer to a string which will receive the name. The string has to be allocated by the caller. Maximal length of any parameter name is limited by eMaxClassName member of EDIConst enumeration. In this release eMaxClassName = 50. C/C++ declaration of EDIConst is available in DITypes.h (include DIInterface.h)

Returns

S_OK.

DISP_E_PARAMNOTOPTIONAL - if szName is NULL.

Remarks

Objects implementing IElement keep name if its type. See Elements for available class names. Call this method to retrieve type name of the object at runtime.