KernelCAD Documentation

DInsight Home
Skip Navigation Links.
Start page
Quick Start
Installation
Overview of the software
What is new
Collapse KernelCAD ModelsKernelCAD Models
Collapse KernelCAD ComponentsKernelCAD Components
KernelCAD Control
KernelCAD .NET Control
Methods and Properties
Menu
Model Explorer
Birds Eye View
Programming
Direct User Access
Direct Operations
Interface Queries
Printing Support
Data Types
Modes of KernelCAD Control
DIObjectGenerator class
Properties
FlatObjectArray Poperty
Context
64 bit development
Dual Mode
Initialisation Context
Overlay Editor
Memory Management
Input validation
Collapse Advanced functionalityAdvanced functionality
Collapse InterfacesInterfaces
Alphabetical list
I3DGrid
I3DBugger
I3Dpt
IAxiBase
IAxis
IBoolSection
IBoolSectionEx
IBoundary
IColor
IConstraint
IData
IDiffSurface_KC
IDIFont
IDraw
IDrawUtil
IDraw2
IElem
IElement
IKCLine
ILightSource
ILocation
ILocationEx
IMaterial
IMetrics
IMetrics2
IModel
IModel2
IModelEx
IPatch
IKCPathCollisionDetector
IProfiles
IPropertyArray
IPropertyArray2
IStdShape
IStrip
ISurface
IText
ITexture
ITransform
IUnknown
Collapse Open Cascade TechnologyOpen Cascade Technology
Collapse DataData
Collapse MovementMovement
Collapse FramesFrames
Collapse Oriented ObjectsOriented Objects
Collapse SectionsSections
Collapse GeneralGeneral
Collapse Topological InterfacesTopological Interfaces
Collapse Viewing InterfacesViewing Interfaces
Collapse Lines And CurvesLines And Curves
Collapse Symmetry InterfacesSymmetry Interfaces
Collapse Clipping plane interfacesClipping plane interfaces
Collapse AlgorithmsAlgorithms
Collapse 2D Geometry2D Geometry
Collapse Programming Samples and TutorialsProgramming Samples and Tutorials
Collapse OverviewOverview
Collapse DeploymentDeployment
Collapse .NET Samples.NET Samples
Collapse C++ SamplesC++ Samples
Collapse Visual Basic SamplesVisual Basic Samples
Collapse Delphi SamplesDelphi Samples
Collapse 3D Debugger3D Debugger
Collapse DeploymentDeployment
Licensing
Model Viewer
Open C++ Source
Technical Support
Skip Navigation LinksHome Page > KernelCAD Components > Interfaces > IElem
IFrameEx Interface

IElem Interface

GetParamCount
GetParam
SetParam
GetNamedParam
SetNamedParam
GetParamName
GetParamId
GetElemClassName

 See also: IElement .

IElem is a slightly enhanced version of IElement interface. The only difference is that SetParam and SetNamedParam methods have additional parameter, which acts as the return value for higher level development environments like Visual Basic and .NET environments. This return value notifies the caller if the new value was accepted, rejected or did not have any effect on the model.

If IElem is implemented, it can be queried from the correspondent IElement interface. Note that some simple objects (IElement implemented by an axial point) always accept its modification, and hence do not implement IElem interface.

See also Parameters, Patch Tutorial, MiniCAD Sample, 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 val, int* result)

Parameters:

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

val - [in] new value of the parameter. 

result - [out, retval] - Result of the modification. Values are enumerated in EModifResult. See remarks for details.

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 would make geometry of the model invalid.

Remarks:
 
Call this method 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 KernelCAD control or call to Update method of the IModel interface.
 
Possible values of result are listed in EModifResult enumeration. If the returned result is -1 it means that some arc in the current strip would become invalid after the modification so the modification has been rejected. If result is equal to 0 val coincides with the current value of the parameter so there where no changes. If result is equal to 1 it means that the new value has been accepted and the parameter has been modified.
 
Note that success return code 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 EModifResult.eModifResInvalid (=-1) 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 IElem 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 val, int* result)

Parameters

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

val - [in] new value of the parameter.

result - [out, retval] - Result of the modification. Values are enumerated in EModifResult. See remarks for details.

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 IElem keep names for each parameter. See Elements for parameter names of 2D elements. Parameter names of an object can be queried at runtime with  GetParamCount and GetParamName methods. This method is a shortcut for sequence of GetParamId and SetParam calls.


 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 IElem keep names for each parameter. See Elements for parameter names of 2D elements.  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 IElem 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 IElem keep name if its type. See Elements for available class names. Call this method to retrieve type name of the object at runtime.