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 Models > Sections > Operations > Boolean Operations
Boolean Operations

Boolean Operations on Objects

Boolean operations on objects are: Subtraction, Intersection and Union. After a Boolean Operation the first object always has Mesh Section type

To perform a Boolean operations in 3D Debugger:

1. Make the first object current. In Current Object menu select the command.

2. Click on the second object in 3D View to select.

To perform Boolean subtract in Model Explorer of the component or 3D Debugger Make the first object current using Set Current button, Select the second object and in action menu of the explorer select Subtract. If the control key was held just before the command the operation will include children of both objects as if they were solids.

As objects can be easily grouped using the Join command of Model Explorer the above allows execution of Boolean operations on groups of objects. Use IBooolSectionEx.Execute3() to do this from a program.

Query IBoolSection or IBooolSectionEx interface form the relevant ISection to carry out Boolean operations programmatically. Note that if the original section was not a Mesh Section the interface becomes invalid and needs to be re-acquired before any further use.

Boolean operations with free form objects are very complicated. If you have encountered a problem report it to DInsight and try a workaround:

1. Change (preferably down) geometric resolution of both objects

2. Try to shift or rotate the second object slightly if the result does not depend on it. For example result of subtraction of a cylinder from any object will be the same if cylinder is rotated around its axis. If above is not possible try to shift the second object by very small amount (negligible for your application) in several directions. For example if difference in fourth digit does not matter for your application try shift by 1e-5. Precision of Boolean Operations in KernelCAD is 1e-10.

Planar Subtract operation

IBoolSection interface also allows performing subtraction of an infinite plane from any object. To perform the operation:

1. Create Plane object with the help of  IDIObjectGenerator.Create ( EObjectType.eObjTypePlane ). Actual interface type returned by the Create call is IAxis, which represents normal of the plane, so the returned IUnknown can be safely cast to IAxis or IAxis can be queried from the returned IUnknown. The IAxis interface represents normal of the plane. To modify or retrieve coordinates of the normal call IAxis.SetDirection/IAxis.GetDirection. To modify/retrieve location of the plane call IAxis.SetLocation/IAxis.GetLocation, which are members of the base class ILocation.. All coordinates are assumed to be global. See Planar Ops sample for an example
 

2. Query ISection from the IAxis obtained in the step 1.

3. Use ISection obtained in the step 2 as  parameter in IBoolSection.Subtract to perform the operation.

See also BoolOp Sample