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 > IConstraint
IConstraint Interface

IConstraint Interface

SetFreedom
GetFreedom
GetConstraint
Enable
IsEnabled

Every object in DInsight models have a constraint property, which can restrict movements of the object in different ways. IConstraint interface enables and disables constraints for  movements of the object it is implemented by. It also gives access to the geometry of the constraint. See remarks for SetFreedom and GetConstraint methods for more details.

IConstraint can be queried from the correspondent ISection interface. Note that this is a Pro level interface, which is not available in the standard KernelCAD or KernelCAD .NET.

See also Modal View Sample, Interface List.


HRESULT SetFreedom(int nMovementType, int nDims)

Parameters

nMovementType - [in] identifies the movement type. Valid values are: 1 for translation and 4 for rotation. See also remarks.

nDims - [in] New value for degree of freedom. See remarks.

Returns

DISP_E_PARAMNOTOPTIONAL if nMovementType or nDims is not one of the valid values.

S_OK in case of success.

Remarks:

This method will specify for movement  nMovementType ( translation or rotation ) degree of the freedom which will be allowed for movements of the object. 

Translation movements: 

Every object keeps its integer Degree of Freedom for Translations  and Translation Constraint Direction. Vector of Translation Constraint Direction can be accessed with GetConstraint() method of this interface. Meaning of Translation Constraint Direction depends on the current degree of freedom set with SetFreedom method.

Valid options for nDims in this case are: 

0 - no translations are allowed.
1 - translations are allowed only along the current Translation Constraint Direction.
2 - translations are allowed only in directions orthogonal to the Translation Constraint Direction.
3 - all translations are allowed. 
 
All other values are invalid for nDim in case of translations.

Rotation movements:

In addition to above properties every object keeps its Degree of Freedom for Rotations and Rotation Constraint Axis. 

Valid options for nDims in this case are: 

0 - no rotations are allowed.
1 - rotations are allowed only around the current Rotation Constraint Axis. 
2 - all rotations are allowed.

All other values are invalid for nDim in case of rotations.


HRESULT GetFreedom(int nMovementType, int *pnDims)

Parameters

nMovementType - [in] identifies the movement type. Valid values are: 1 for translation and 4 for rotation. See also remarks.

pnDims - [out] pointer  to the integer variable, which will receive the requested degree of freedom.

Return Values

S_OK in case of success.
 
Remarks:
 
Returns current degree of freedom for the requested movement type. See remarks for SetFreedom method.

HRESULT GetConstraint(int nMovementType, IAxis **ppIAxis)

Parameters

nMovementType - [in] identifies the movement type. Valid values are: 1 for translation and 4 for rotation. See also remarks.

IAxis **ppIAxis - [out] pointer to variable, which will receive pointer to IAxis interface implemented by the constraint of the requested type. See remarks. In case of translation only directional component is valid.

Return Values

S_OK in case of success.
Remarks:

This method gives access to geometry of the constraint. The result depends on the movement type and the current degree of freedom set for this type of movement. See also remarks for SetFreedom method.

Translation movements: 

When the current Degree of Freedom for Translations is 0 or 3 return from GetConstraint() is not valid. When the current Degree of Freedom for Translations is 1 or 2, directional component of the returned IAxis interface (Get/SetDirection methods) give access  to  Translation Constraint Direction. Location component of the IAxis is not valid.

Rotation movements:

When the current Degree of Freedom for Translations is 0 or 2 return from GetConstraint() is not valid. When the current Degree of Freedom for Translations is 1, returned IAxis interface is implemented by and hence gives access to Rotation Constraint Axis of the object.

See also IAxis interface

 


HRESULT Enable(bool bEnable)

Parameters

bEnable- [in] New value for the enabled flag.

Return Values

S_OK in case of success.

Remarks:
 
When the constraint is disabled it has no effect on the movements of the object. All constraints are disabled by default, but enabled during the operation which retrieves it from ISection

HRESULT IsEnabled(bool *pbEnabled)

Parameters

pbEnabled - [out] pointer to the Boolean variable, which will receive the current status of the enabled flag.

Return Values

S_OK in case of success.

Remarks:
 
Returns the current status of  of the enabled flag. When the constraint is disabled it has no effect on the movements of the object. All constraints are disabled by default, but enabled during the operation which retrieves it from ISection