Methods of DG Kernel Control
- GetModel
- AttachModel
- Save
- SaveAs
- UpdateSurface
- GetView
- RequestClientDraw
- RequestEvent
- UpdateView
See also: Properties, Events
LPUNKNOWN GetModel()
Return Values
A reference to IUnknown interface (Object in .NET) implemented by the current model l, either the constructed automatically default, or one attached via the AttachModel() method below. Cast/query to IModel_DG to access the model.
See also Interface List
void AttachModel(IModel_DG model)
Replaces the current (commonly the default) model in the control with a new one. Provides a way for sharing models between two or more components, thus enabling multi-view functionality. If model is null, the current model is released (detached from the control and deleted, if it was the last reference).
BOOL Save()
Returns
TRUE in case of success.
Remarks
Call to save the model to the file it was loaded from. Ignored if there was no load operation since the application start
BOOL SaveAs(BSTR strFilePath)
Parameters
strFilePath - Full path of the file to save to.
Type of return will be interpreted differently by different environments to
suite its type system.
Returns
TRUE in case of success.
Remarks
Call to save the model to a new file. The
ModelPath
property will be changed to strFilePath.
Normally the Development
Environment used to insert the DG Kernel Control into an application project
will create a wrapper class or use a different way to represent the property
like the Object Browser in Visual Basic, where BSTR object will be replaced
with a type more suitable for the Environment you are using.
strFilePath can have extension for any supported format. If strFilePath
has no extension it is interpreted as an STL directory path. The new STL
directory tree will be created and objects of the model will be saved as
separate .stl files in the directory. See "STL Tree" topic for more details.
BOOL UpdateSurface()
Returns
TRUE in case of success.
Remarks
The method recalculates the surface of the objects after any changes to parameters of the model.
Starting with v6.0 in most situation this is done automatically when a modification has been detected. In some situations, low level attributes have no way of notifying the model and the view about a modification, in which case this method should be called from the application code. This documentation often describes cases when this is needed.
It is recommended adding this call only when a modification is not reflected in the view even after an UpdateView() or IView_DG.Update().
UpdateSurface() is costly in terms of computational load, so it is recommended
to check first that the automated updates do not work, and, if required, call it once per logically complete sequence of user input.
This method is equivalent to the deprecated IModel.Update()
method of IModel
interface with the addition that UpdateSurface() redraws the
control's window automatically.
See MiniCAD sample
LPUNKNOWN GetView()
Returns
Pointer to IUnknown (Object in .NET) interface implemented by view of the control. Cast/query to IView_DG.
See also
Interface List
void RequestClientDraw(boolean request)
Parameters
request - [in] true if ClientDraw event needs to be raised
and false otherwise.
Remarks
As invoking ClientDraw
event involves some performance cost, this event is not raised by default.
This method has to be called to enable or disable the event.
Notice: Starting with v6.0 drawing object calls inside ClientDraw handler has been deprecated and are ignored
void RequestEvent(int event, boolean request)
Parameters
event - [in] id of the event to be requested. Valid values are
listed in EDIEvent enumeration.
request - [in] true if the event needs to be raised and false otherwise.
Remarks
Some events (such as MouseHover event) involve additional computational load and are not enabled by default.
LPUNKNOWN UpdateView()
Remarks
Forces redrawing the window of the control. Redrawing is often executed internally in response to user input like mouse view manipulation.
|