Data Flow C# Sample
Overview
Implementation
Save / Load OperationsOnFileOpen() and OnFileSaveAs() handlers of DataFlowForm implement the load
and save operations.
The Boolean members of DataFlowForm keep the current options for the save / load
STL operations. VRML and GLM file formats do not require any additional
parameters for load/save operations.
The options can be modified by the DataFlowForm.OnOptions() handler of the Tools
> Options command. Only the Binary/ASCII STL option is used during saving all
other options are used during loading operation.
If the "Use Defaults For All Options" option, stored in m_bAllDefaults
variable, was selected, OnFileOpen() and OnFileSaveAs() handlers use
simple ModelPath property to persist the
model. Otherwise IModelEx.LoadEx() and
IModelEx.SaveEx() are used. The selected
options are transferred to the component via methods of
ISTLDataContext queried from
IModelEx with the
ISTLDataContext iSTLOptions = (ISTLDataContext)iModelEx;
line.
KernCADLib library
Solution of the sample consists of two projects: The DataFlow Windows Form
application and KernCADLib class library. Source code for KernCADLib project is
located in Samples\NET\C#\KernCADLib folder. Notice the KernCADnet refernce
added to the KernCADLib project via Project > Add Reference > COM Tab >
DG Kernel .NET Enterprise options of Microsoft Visual Studio. Notice also that
DataFlow project is depenedent on KernCADLib, which is set via Project > Project
Dependencies Visual Studio menu option.
KernCADLib project is added mostly to demonstrate how DG Kernel can be used
without any GUI window to perform common operations in a shared library. It
consist of a single ModelManager class, which loads objects from a
file and adds them to an existent model
Additional Operations
Loading and saving of STL directories is
performed by OnSTLDirectoryLoad() and OnSTLDirectorySave() handlers in similar
fashion. See comments in the source code for more details
File > Import Object menu option is handled by DataFlowForm.OnImportObjects(),
which calls ImportObjects() method of ModelManager class of KernCADLib library.
Notice also the using KernCADLib; directive at the top of the
DataFlowForm.sc file
|