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 > Input validation
Input validation

User input validation for Arc/Line splines

Programmatically geometry of an 3DS object is modified via call to SetParam() or SetNamedParam() mathods of IElement. Quite often the new value of the parameter makes geometry of the model invalid. For example when radius of an arc is too small to connect its ends.  In this case above methods return without changing anything in the geometry. In C++ this situation can be detected from the returned HRESULT, which will be equal to DI_E_INVALIDGEOMETRY (defined in <Install dir>\Samples\VC\IncludeDIInterface.h). Higher level development environments like Visual Basic and .NET can use IElem interface instead.

IElem interface is analogous to IElement. The only difference is that SetParam and SetNamedParam methods have additional parameter, which acts as the return value for  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.

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. Normally you would make all requested modifications for the user input (one modification per parameter) and call UpdateSurface methods to recalculates the surface and display the result for viewing in 3D. 
 
Note that successful return from SetParam and SetNamedParam 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.

See also Parameters, Interface List