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 > IBoolSectionEx
IBoolSectionEx Inteface

IBoolSectionEx Interface

IBoolSectionEx interface is an enhanced version of IBoolSection, which returns information about the intersection curve of the two objects.

See also Cross View sample and BoolOp Sample


HRESULT Execute( EBooleanOperation operation, ISection* object, VARIANT_BOOL createIntersLine, IArray** edges )

Parameters

operation - [in] member of EBooleanOperation enumeration indicating the operation to perform

object - [in] reference to the second object for the operation. (The first object is the section which implements this IBoolSectionEx interface)

createIntersLine - [in] If true a set of Line Strip objects representing intersection line will be created and added as child of the first section (the section where this interface was queried form). See remarks for more details

edges - [out, retval] Array of isolated intersection loops. Each element has type IArray, elements in the later array have type IVertex. See remarks

Remarks

Performs operation indicated by operation on the section where this IBoolSectionEx was queried from and object. This method also allows performing subtraction of a programmatically defined plane from the object. See details in Planar Subtract.

If createIntersLine parameter is true a new empty object will be created and added as new child of the first section. The object will act as a group (container for its children). The objects will have one or more child objects of Line Strip type one per linked piece of intersection. For example, subtraction of a long and thin cylinder from a sphere will have two closed isolated intersection loops. In that case the newly added object will have two children one per each intersection loop. Coordinates of points in the lines and other information can be obtained via ISectionPointSet and ISectionLineStrip queried form the relevant child. See BoolOp Sample for an example.

The returned edges array contains information abut the isolated linked intersection loops. Each loop is an array (IArray) of IVertex elements, which can be used to obtain coordinates and normals to the surface at the intersection points.  See Cross View sample for an example. This calculation is not performed and NULL will be returned if createIntersLine is false.

IVertex obtained above contains all normals to the resulting surface. The most frequent case when two surfaces are smooth around the intersection curve the vertex contains two normals on the left (side of surface of the first object, where this interface was queried form) and right hand side of the intersection curve. Often there are several normals on each side, for example when intersection curve crosses an edge of either surface. In some cases (planar subtract or case when the second object is not a closed surface and edges do not intersect) the intersection curve becomes an edge of the resulting surface, so the vertex can have only single normal, the one which belongs to the first surface.

To find out which normals in the vertex belong to which side of the curve query IUserData from the IVertex and call IUserData.GetData. The returned cnt number is count of normals which belong to the first surface (normals on the left). Normals 0 to cnt-1 in the vertex belong to the first surface, the rest belong to the second surface.


HRESULT STDMETHODCALLTYPE Execute2( ISection* object, EBoolOpContext* context )

Parameters

object - [in] reference to the second object for the operation. (The first object is the section which implements this IBoolSectionEx interface)

context - [in, out] - additional input and output parameters for the operation. See remarks

Remarks

Performs operation indicated by context.operation on the section where this IBoolSectionEx was queried from and object. This method also allows performing subtraction of a programmatically defined plane from the object. See details in Planar Subtract.

If context.execute is false, only intersection loops are calculated and the Boolean operation is not executed, which significantly improves performance.

If context.intersectionLine is true a new empty object will be created and added as new child of the first section. The object will act as a group (container for its children). The objects will have one or more child objects of Line Strip type one per linked piece of intersection. For example, subtraction of a long and thin cylinder from a sphere will have two closed isolated intersection loops. In that case the newly added object will have two children one per each intersection loop. Coordinates of points in the lines and other information can be obtained via ISectionPointSet and ISectionLineStrip queried form the relevant child. See BoolOp Sample for an example.

If context.needEdges is true context.edges will contain information abut the calculated intersection curve. This calculation is not performed context.intersectionLine is false. The curve consists of the isolated linked intersection loops. Each loop is an array (IArray) of IVertex elements, which can be used to obtain coordinates and normals to the surface at the intersection points. See remarks for the previous method for more details. See Cross View sample for an example.

context.edges array must be created by the caller. To create the array call Create or Create2 method of IDIObjectGenerator interface with parameter eType set to eObjTypeArray member of EObjectType enumeration. Query IArray  from the returned IUnknown interface. After call to this Execute2() method the array will contain elements which in turn are arrays too. More exactly arrays of vertices.

If separateComponents is true and the first object becomes divided into several isolated pieces, the pieces will become separate objects. The initial first object will be replaced with one if the pieces. The other pieces will be added as new children of the first object. Selection of pieces for the parent and children is random.

Note: All elements of the context structure must be initialized before the call. Details


HRESULT STDMETHODCALLTYPE CreateExtendedContext( IDictionary_KC** contextExt)

Parameters

contextExt - [out, retval] The created and returned context

Remarks

Creates a context with extra options for the Execute3 method below. All parameters have the default values


HRESULT Execute3( EBooleanOperation operation, ISection** object, IDictionary_KC* contextExt)

Parameters

operation - [in] member of EBooleanOperation enumeration indicating the operation to perform

object - [in] reference to the second object for the operation. (The first object is the section which implements this IBoolSectionEx interface)

contextExt - [in] A null reference or a context created by the CreateExtendedContext() method above, which contains additional options for the operation. See remarks

Remarks

Performs operation specified by operation on the section where this IBoolSectionEx was queried from and object. The significant difference with the Execute2 method is that the InclideChildren* properties below, allow boolean operations on groups of objects

contextExt has the following parameters:

Name Type Description Default Value
OperationID Integer Valie must coinside with one of EBooleanOperation enumeration. Overrides value specified by operation EBooleanOperation.eBoolOpSubtract
CreateLine Boolean If true intersection line of the two surfaces will be added to the model. See comments for the  createIntersLine parameter above for details false
IntersectionLineOnly Boolean If true only intersection line is calculated false
ReturnIntersection Boolean Same as context.needEdges parameter above false
SeparateComponents Boolean Same as separateComponents parameter above false
EdgeArray Variant IArray created by the caller. See comments for the context.edges parameter above null
IncludeChildrenThis Boolean If true children and all other descendants of the first (this) object will be included in the operation false
IncludeChildrenOther Boolean If true children and all other descendants of object will be included in the operation false


HRESULT Clip(IObjectOriented* objectClipper, VARIANT_BOOL needTopLinkedComponentOnly)

Parameters

objectClipper - [in] The object to be clipped with
needTopLinkedComponentOnly - [in] See remarks

Remarks

Clips the object, which implements this interface with objectClipper

needTopLinkedComponentOnly has effect only when objectClipper has natural diection of its internal area. In the initial implementation this is used for the case of an infinite prizm build on a polygon in x and y axes, so z axis defines a positive direction

After the operation the resulting surface is often split into isolated pieces (A sphere clipped with a thin infinite triangular prizm around the center). When the pieces have non-overlapping distinct ranges they are arranged along z axis

In this situation if needTopLinkedComponentOnly is true only the one with max z will be the result of the operation. Otherwise all components will be merged into the final object


HRESULT Clip2(IObjectOriented* objectClipper, IListT** listISection)

Parameters

objectClipper - [in] The object to be clipped with
listISection - [in] See remarks

Remarks

Calculates the result of cliping this object (the object, which implements this interface) with objectClipper

Does not modify this object. listISection contains linked pieces of the result. See also the previous method