DG Kernel Documentation


Skip Navigation Links.
Skip Navigation LinksHome Page > DG Kernel Components > Properies, Methods, Events > Properies Search Documentation


Properties of DG Kernel Control

Properties:

ModelPath
ShowGlobalAxes
ShowLocalAxes
DIBackColor
RenderSolid
EmbeddedModel
TransparBackgrEnabled
See also: Methods, Events

ModelPath Property

Type: String
 
Remarks:
 
ModelPath string is the main property of the control. It contains the path of an existing model file or empty string. When the property is assigned a new value the control automatically loads the model and updates the 3D window. A message is displayed if the load fails. Use the SaveAs method to save the current model in a new location and change the ModelPath property at the same time.
ModelPath can be either relative or full path (with drive letter or starting with hash). There are two kinds of relative paths:
 
1) Standard (like Models\Cube.mdg), which is relative to the installation folder. The control reads the location of the installation folder from the registry. For an example KerCADne.ocx reads the installation directory from the "InstallDir" string of the "HKEY_LOCAL_MACHINE\SOFTWARE\DInsight\KerCADne\6.0" key. This value can be set in installation packages for distribution of the application developed with DG Kernel, when control is not installed but only registered on the target computer. It is not recommended to modify the key with DG Kernel installed.
 
2) Relative path with modifier prefix, which specified the root. Currently supported modifiers are:    

(a) <EXEPATH>. Path <EXEPATH>Models\Samples\Lines.mdg means that the lines,mdg is located in the Models\Samples subdirectory of the folder where the application's executable (.exe) file is located. Note that at design time control does not display any model when the Model Path has <EXEPATH> modifier. The <EXEPATH> modified paths are useful for distributing applications where location of the target directory is normally not known in advance.
   
(b) <OCXPATH>. Path <OCXPATH>Models\Std.mdg means that the Std,glm is located in the Models\ subdirectory of the folder where the control's executable (.ocx) file is located. 
 
The model path can be an empty string, in which case the DG Kernel component will not attempt to load any file on start of the application, the model will have no objects and 3D window will be empty. This option can be useful when the model is constructed dynamically using Dynamic Object Creation to avoid references to external files or other reasons. Note that a model file is valid even if the saved model is empty (has no objects).

ModelPath strings for Pro level components must have .mdg extension. DG Kernel Enterprise component can load and save files with other extensions. Supported formats are enumerated by the ECADFormat enumeration

When the control is being inserted for the first time into a form or dialog or created dynamically the default value of the property is taken from the Registry (see below). If the correspondent registry values are not present the ModelPathis set to empty string.

The default value of ModelPath is constructed by appending DefaultModel registry value from HKEY_LOCAL_MACHINE\SOFTWARE\DInsight\KernCAD\<version> key to InstallDir path string in the same key. For controls different from standard DG Kernel the "KernCAD" key name above should be replaced with specific ocx name. InstallDir and DefaultModel values can be changed (for controls only) to any suitable locations.


 
ShowGlobalAxes Property
 
Type: Boolean
 
Remarks:
 
If this property is set to true the global axes will appear in the control's window.

 
ShowLocalAxes Property
 
Type: Boolean
 
Remarks:
 
The component handles only runtime changes of this property. Unless there is only one object in the model, this property is ignored on initialization of the control during application start-up and in design mode (form editors). In these situations visibility of a local frame is controlled by the ShowLocalFrame value stored in the entity.

When the property is being set to false at runtime, all local frames will be hidden. When the property is being set  to true at runtime, ShowLocalFrame of the current entity will be set to true. If no entity is selected as current, but the model has a single top level entity, ShowLocalFrame of the entity will be set to true. No action is taken if there is more than one top level entity.


 
DIBackColor Property
 
Type: Long integer
 
Remarks:
 
This property determines background color of the control window. To modify the color in Development Environment open Properties dialog box (right-click > Properties or similar option in the IDE menu) and go to the Render page. Programmatically the property needs to be cast to COLORREF standard data type to use.

COLORREF is a DWORD (four bytes) size integral data. The first three bytes keep red, green and blue components of the color. The fourth byte is not currently used in DG Kernel. To obtain DG Kernel style floating point number, representing for an example, green component, divide value of the third byte by the 255 and cast to float or double type. Samples\VC\Include\Misc.h file contains two C++ macros, which perform the above conversion both ways.

Use utility from tools menu of 3D Debugger to convert between COLOREF and rgb(a) colors

The background can also have gradient colors. See details at Background.


 
RenderSolid Property
 
Type: Boolean
 
Remarks:
 
If this property is false the model will be displayed in wire frame. Otherwise it will be displayed as a solid object (Default).

 
EmbeddedModel Property
 
Type: Boolean
 
Default:  False
 
Remarks:
 
This property is not available in 64 bit edition. Contact us for more information
 
The EmbeddedModel property is a design-time only property. Is is supposed to be changed only in form designers or resource editors of a Development Environment. The property should not be modified at runtime. Use Property Pages Dialog or Properties Window to modify the property.
 
If this property is true, the model will be embedded into the executable file of the application. This eliminates the problem of locating or transmitting the model and makes sure the correct model is loaded by the component. Embedding model is particularly useful when model has significant value by itself or has restricted copyrights and is not intended to be accessible by the user.
 
If this property is false (default), the model is loaded during the application start up from location specified by ModelPath and the location is considered valid for persistence of the model, for example by the Save method

When this property is changed from false to true the model will be loaded from the location specified by ModelPath, after that ModelPath is not used by the component.

When this property is changed from true to false the user will be prompted to select the location where the previously embedded model will be saved to. After that ModelPath is considered as persistent location of the model.

To update or change an embedded model, set the property in Property Pages Dialog or Properties Window to false. Make sure ModelPath points to the new model and change the property back to true.

Object Array sample uses an embedded model.


TransparBackgrEnabled Property
Not supported in this version