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 > General > IGlobalAPI_KC
IGlobalAPI_KC Interface

IGlobalAPI_KC Interface

LockInitialisationContext
LaunchExplorer
GetReferenceCount
AddRefUnsafe
ReleaseUnsafe

Implements collection of global methods of KernelCAD software, independent of any particular control instance.

When a KernelCAD window was already created query this interface from IView or IModel, otherwise use the method below.

IGlobalAPI_KC is implemented (can be queried from) by KcApiComProxy object which can be created via COM, independently of any controls or views, including command line applications. KcApiComProxy object can be instantiated in COM-enabled development environments by using either its Class ID or Program ID (see below).  

In .NET environment DIObjGenerator can be created using standard new operator as (C# example):

       KernCADnet.KcApiComProxyClass kcApi = new KernCADnet.KcApiComProxyClass();
       IGlobalAPI_KC iApi = (IGlobalAPI_KC)kcApi;

Actual name of the wrapper class might be different in different versions of the development environment. Refer to Object Browser in the project after adding a reference to the KernelCADnet component (See Patch Tutorial).

In C++ the KcApiComProxy can be instantiated by using its Class ID and call to CoGetClassObject() COM function.

In native Visual Basic an instance of the class can be created using the Program ID and CreateObject() API as follows:

            Dim iGlobApi As IGlobalAPI_KC

            Set iGlobApi = CreateObject("KERNELCAD.KCAPI.1")

KcApiComProxy implements a single IGlobalAPI_KC interface, which can be obtained via call to CreateInstance() COM API in C/C++ or a cast in other languages.

Class IDs

.NET:

Class ID:

// {1BAD07C5-A93E-4b10-8AE7-B3215A5F6917}
static const GUID CLSID_KcApiComProxy = 
{ 0x1bad07c5, 0xa93e, 0x4b10, { 0x8a, 0xe7, 0xb3, 0x21, 0x5a, 0x5f, 0x69, 0x17 } };

Program ID:  

KERNELCAD_NET.KCAPI.1

Native:

Class ID:

// {DA3EF301-E066-42EE-BCF4-4EAFCB41DCB5}
static const GUID CLSID_KcApiComProxy = 
{ 0xda3ef301, 0xe066, 0x42ee, { 0xbc, 0xf4, 0x4e, 0xaf, 0xcb, 0x41, 0xdc, 0xb5 } };

Program ID:  

KERNELCAD.KCAPI.1

See also IControlInitialisationContext_KC


HRESULT LockInitialisationContext(IControlInitialisationContext_KC** context)

Parameters

context-[out] the returned context

Remarks:

The method acquires exclusive access to the Component Initialisation Context. Call context.ReleaseContext() when it is no longer needed to allow access to it by other threads. If the context cannot be accessed in 5 seconds the method returns null


HRESULT LaunchExplorer(IModel* model, IView* view)

Opens Model Explorer window for the model


HRESULT GetReferenceCount(IUnknown* anInterface, [out, retval] int* count)

Returns the current reference count for the object, which implements interface anInterface. See lso Memory Management


HRESULT AddRefUnsafe(IUnknown* anInterface, [out, retval] int* count)

Increments the reference count for the object, which implements interface anInterface and returns the incremented value. Warning: This method should only be used in exceptional situations as a temporary workaround. See lso Memory Management


HRESULT ReleaseUnsafe(IUnknown* anInterface, [out, retval] int* count)

Decrements the reference count for the, object which implements interface anInterface and returns the new value. When the retuned value is 0 the object has been deleted and the interface must not be used. Warning: This method should only be used in exceptional situations as a temporary workaround. See lso Memory Management