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 > Sections > ISection2
ISection2 Interface

ISection2 Interface

GetFrameVisibleFlag
SetFrameVisible
Show
SetColor
Detach
RemoveAll
RemoveChild
Relocate
SaveAs

ISection2 interface has two methods, which control visibility of the local frame of the object (ShowLocalFrame property)

See also: Interface List


HRESULT GetFrameVisibleFlag(VARIANT_BOOL *pbVisible)

Parameters

pbVisible - [out, retval] reference to a Boolean variable, which will receive the current value of the frame visibility flag.


HRESULT SetFrameVisible(VARIANT_BOOL bVisible)

Parameters

bVisible - [in] new value for the frame visibility flag.


HRESULT Show(VARIANT_BOOL show, VARIANT_BOOL includeChildren, VARIANT_BOOL childrenOnly)

Parameters

show - [in] new value for the objects visibility property.

includeChildren - [in] True if all children and descendents of the object are to be included in the operation

childrenOnly - [in] If true the object implementing this interface will not be included in the operation. (useful only if includeChildren is true)

Remarks

The method allows changing visibility property for an object and its descendants in a single call.

HRESULT SetColor(float fRed, float fGreen, float fBlue

Parameters

fRed, fGreen, fBlue - [in] Components of the color.

Remarks

The method a quick shorcut for changing color of the object

HRESULT Detach()

Remarks

Detaches the object from its parent. The object will remain alive and can be used for background calculations, can be added to any model, etc. as long as the application holds at least one reference to it


HRESULT RemoveAll()

Remarks

Deletes all children and their descendants


HRESULT RemoveChild(IItem *item))

Remarks

Removes the item child, which can actually be a section, and all its descendants


HRESULT Relocate(IFrame* newLocationOrientation)

Remarks

Changes location and orientation of the object without moving children or parent.

The method only copies coordinates from newLocationOrientation without any changes and does not store or use it otherwise. So newLocationOrientation is a read-only (constant) parameter. As the result of that the local frame of the section will geometrically coinside with newLocationOrientation.

newLocationOrientation normally can be created with IDIObjGenerator.Create((int)EObjectType.eObjTypeFrame)

This method is equivalent to detaching this object from its parent and children from this object, copying newLocationOrientation to the local frame and reattaching the object to the parent and children to this object

Example: The code below expects a model with a cylinder as the first top level object and a cone as its child

VB.NET

Dim iMod As IModel = AxKernCADnet1.GetModel
Dim iSectCylinder As ISection = iMod.GetSection(0)
Dim iSectCone As ISection = iSectCylinder.GetChild(0)
Dim iSect2Cone As ISection2 = iSectCone Dim iGenerator As IDIObjGenerator = iMod

' Create a standalone frame. A frame defines location and orientation. By default it coinsides with the global axes
Dim iFrm As IFrame = iGenerator.Create(EObjectType.eObjTypeFrame)
'Query other IFrame* iterfaces here like IFrame3 = iFrm to get more functionality like rotation around local axes
iFrm.Rotate(10, 0, 0, 0, 0, 1, 0)
iFrm.SetOrigin(0.3, 0, 0)

iSect2Cone.Relocate(iFrm)

AxKernCADnet1.UpdateView()

C#

IModel iMod = axKernCADnet1.GetModel();
ISection iSectCylinder = iMod.GetSection(0);
ISection iSectCone = iSectCylinder.GetChild(0);
ISection2 iSect2Cone = (ISection2)iSectCone;

IDIObjGenerator iGenerator = (IDIObjGenerator)iMod;
IFrame iFrm = (IFrame)iGenerator.Create(EObjectType.eObjTypeFrame);
//iFrm created coinsiding with global axes
iFrm.Rotate(10, 0, 0, 0, 0, 1, 0);
iFrm.SetOrigin(0.3, 0, 0);

iSect2Cone.Relocate(iFrm);

axKernCADnet1.UpdateView();

HRESULT SaveAs(char* filePath, IDictionary_KC* options, VARIANT_BOOL* success)

Parameters

filePath- [in] full path. Can have any of the supported extensions

options- [in] Additional options. Can be null

success- [out,retval] The result code.

Remarks

The method allows saving individual objects.

In case filePath has a VRML extension (.wrl or .vrml):

If options is not null and contains string named "TextureImagePath" and its value is a valid file path, it is considered as location of the image for texture of the object (if the object has it). If this path is not specified the image will be saved next to the vrml file.

If the TextureImagePath is provided, it is considered relative to location of the vrml file. Path with ellipses like "..\Image\MyTextureImage.png"  is acceptable