API Reference
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Properties | List of all members
DB.Api.Environment Class Reference

Class to handle the Sketch operating environment. The class incorporates methods to set and retrieve the active Sketch command to enable control over the various Sketch operations including drawing model elements, copying, moving, rotating elements, view control, etc. The class also incorporates model navigation methods (changing levels of model decomposition) as well as methods to return API and software versions as well as the various folders used. More...

Classes

class  CfdOps
 Class to handle the CFD application operating environment. The class incorporates methods to control CFD processes such as calculations (standard CFD and CFD+), meshing (CFD+) and event handling. More...
 
class  DocumentFileOps
 Class to handle project file processes. More...
 
class  DrawingBitmapOps
 Class to handle drawing bitmap file processes. Drawing bitmaps can be loaded into Sketch as BMP files to enable building object outlines to be traced. More...
 
class  DxfFileOps
 Class to handle DXF drawing file processes. DXF files can be loaded into Sketch to enable building object outlines to be traced. The DXF objects are imported as line strings allowing the various keypoint snaps to me made to the line segments. More...
 
class  Events
 Class to handle Sketch events. More...
 
class  Factory
 Class to handle various Sketch object creation processes. More...
 
class  GbXmlFileOps
 Class to handle gbXML model file operations. DB can import and export gbXML model files. Refer to GbXmlFile class for import method. More...
 
class  HvacOps
 Class to handle detailed HVAC operations. More...
 
class  ModelOps
 Class to handle various model operations. More...
 
class  RendererOps
 Class to handle rendering operations. More...
 

Public Member Functions

bool Initialise (Sketch skModule, VersionInfo dbVersion, string pluginsFolder, string scriptsFolder, string energyPlusFolder)
 Initialises the Sketch operating environment.
 
void ActivateProtractor (bool toggle)
 Used to activate/deactivate the Sketch drawing protractor. When activated, a graphical protractor is displayed on the Edit screen which can be used to place lines at specific angles to previous lines in a line stream when drawing objects such as block perimeters.
 
bool BeginEditMode ()
 Deprecated.
 
void CancelProcess ()
 Used to cancel any current Sketch command process and/or the command itself. For example, when the DRAWBLOCK command is active, this method can be called repeatedly to sequentially undo the line stream of the block perimeter and when the last point is undone the next call to this method will cancel the command altogether.
 
void CopySelectedObjects ()
 Deprecated.
 
void DeleteSelectedObjects ()
 This method will delete all selected objects on the Edit screen.
 
bool EndEditMode ()
 Deprecated.
 
void EndPartitionStream ()
 This method can be used to terminate a partition stream at building block level. When drawing building block partitions, the partitions are placed in the form of a line stream which can be terminated by pressing the ENTER key or by calling this method.
 
CommandObject GetCommandObject (Command command)
 This method returns a CommandObject for the supplied Command (refer to Command class for available commands). The CommandObject can be used to determine if the supplied command is active and/or enabled. A command can only be enabled for specific Sketch states. For example the DRAWWINDOW command is only enabled at the zone surface level of decomposition.
 
bool GotoBuilding (int buildingIdx)
 Used to navigate to a building level of model decomposition. The supplied index is the index of the building required. NOTE - this method is largely superseded by the GoToModelObject method which enables navigation to any model level/object.
 
bool GotoComponentBlock (int buildingIdx, int blockIdx)
 Used to navigate to a building component block level of model decomposition. The supplied building index is the index of the building in which the component block is located and the supplied component block index is the index of the component block to be navigated to. NOTE - this method is largely superseded by the GoToModelObject method which enables navigation to any model level/object.
 
bool GotoBuildingBlock (int buildingIdx, int blockIdx)
 Used to navigate to a building block level of model decomposition. The supplied building index is the index of the building in which the building block is located and the supplied building block index is the index of the building block to be navigated to. NOTE - this method is largely superseded by the GoToModelObject method which enables navigation to any model level/object.
 
bool GotoSite ()
 Used to navigate to the site level of model decomposition. NOTE - this method is largely superseded by the GoToModelObject method which enables navigation to any model level/object.
 
bool GotoSurface (int buildingIdx, int blockIdx, int zoneIdx, int surfaceIdx)
 Used to navigate to a zone surface level of model decomposition. The supplied building index is the index of the building in which the zone is located, the supplied building block index is the index of the building block in which the zone is located, the zone index is the index of the zone to which the zone surface belongs and the surface index is the index of the surface to be navigated to. NOTE - this method is largely superseded by the GoToModelObject method which enables navigation to any model level/object.
 
bool GotoZone (int buildingIdx, int perimBlockIdx, int zoneIdx)
 Used to navigate to a zone level of model decomposition. The supplied building index is the index of the building in which the zone is located, the supplied building block index is the index of the building block in which the zone is located and the zone index is the index of the zone to navigate to. NOTE - this method is largely superseded by the GoToModelObject method which enables navigation to any model level/object.
 
bool GotoModelObject (ModelObjectType type, DecompositionLevel level, ModelIndices indices)
 Used to navigate to any valid model object at any level of model decomposition. The supplied ModelObjectType oject is used to specify the required object type to navigate to at the required level of model decomposition and the supplied DecompositionLevelHelp object is used to specify the required level of model decomposition (refer to the ModelObjectType class for the various level object types and the DecompositionLevel class for the various decomposition levels). The supplied ModelIndices object specifies the indices of the various objects (building index, building block index, etc.) that are required for the navigation (refer to the ModelIndices class for the available object indices).
 
bool ImportProject (string path, ProjectMode projectMode)
 Imports a DB model from another .DSB file using the path provided. The supplied ProjectMode specifies whether the model is to be imported into the current model or as a bookmark building associated with the currently active building. If the model is imported into the current model, it is automatically translated to prevent any block interesctions.
 
bool InitialiseAssemblyInstance (int assemblyInstanceIdx)
 When placing an instance of an assembly (PLACEASSEMBLY command), this method must be called after any changes are made to the assembly instance drawing options (via the Drawing Options data panel on the edit screen) in order for the changes to take effect. The index of the assembly is supplied to the method.
 
void UndoOperation ()
 Used to undo the last Sketch process. This method does not apply to changes to attributes made via the UI.
 
void RedoOperation ()
 Used to redo the last Sketch process undone via a call to the Undo method.
 
void RemoveAllMeasureLines ()
 Deprecated.
 
void RemoveAllConstructionLines ()
 Removes all construction lines from the current building.
 
void RemoveAllOutlines ()
 Removes all outline blocks from the current building.
 
bool ResetCommand ()
 Cancels the current command and resets the command to the default SELECTITEM command.
 
void RestorePreviousView ()
 Used to restore a previous view. All edit screen view settings (zoom, rotation, etc.) are stored prior to a view command and subsequent to the command, can be restored using this method.
 
bool SaveImageToFile (string path)
 Saves the current edit screen to a Bitmap file.
 
void SetProgramOptionsRecordHandle (int handle)
 Used to pass the 'ProgramOptionTemplates' table record handle for the DB 'Program Options' to Sketch. The 'Program Options' record handle is used by Sketch to obtain the correct record from the 'ProgramOptionTemplates' table for data such as type of units in current use.
 
bool SetSystemColour (ColouredObject obj, byte r, byte g, byte b)
 Used to specify colours as RGB values for the display of various objects on the edit screen.
 
void ShowNorthIndicator (bool value)
 Boolean value to specify whether or not the North indicator is to be displayed on the edit screen.
 
bool TransferBuildingObjects (int srcBuildingIdx, int dstBuildingIdx)
 Transfers model objects from the source building to the destination building.
 
bool UndoLastPoint ()
 Undoes the last line segment for processes that involve line streams, e.g. placing partitions, drawing the perimeters of blocks, etc.
 
void UpdateAssemblyInstanceSettings ()
 Deprecated.
 
void UpdateProgramOptions ()
 Synchronises the DB program options with Sketch (units, display options, EnergyPlus version, etc.). Note that the SetProgramOptionsRecordHandle method must be called prior to calling this method to ensure that Sketch accesses the correct Program Options record in the ProgramOptionTemplates table.
 
void ZoneCurrentBlock ()
 This method is used to re-zone the current building block. Normally, the current building block will be re-zoned automatically after drawing partitions, internal voids, etc. however if the 'automatic zoning' option is switched off through the DB Model Options, this method must be called to force a re-zoning of the block.
 
void Dispose ()
 
- Public Member Functions inherited from DB.Api.Contracts.IEnvironment
bool Initialise (SKETCHLib.Sketch skModule, VersionInfo dbVersion, string pluginsFolder, string scriptsFolder, string energyPlusFolder)
 
void Dispose ()
 

Protected Member Functions

virtual void Dispose (bool disposing)
 

Properties

VersionInfo DesignBuilderVersion [get]
 Returns DB version.
 
VersionInfo ApiVersion [get]
 Returns API version.
 
RendererOps RendererOperations [get]
 Returns the rendering operations object.
 
ModelOps ModelOperations [get]
 Returns the model operations object.
 
Events GlobalEvents [get]
 Returns the global events object.
 
Factory FactoryOperations [get]
 Returns the model factory operations object.
 
GbXmlFileOps GbXmlFileOperations [get]
 Returns the GBXML file operations object.

 
HvacOps HvacOperations [get]
 Returns the detailed HVAC operations object.

 
DxfFileOps DxfFileOperations [get]
 Returns the DXF file operations object.
 
DrawingBitmapOps DrawingBitmapOperations [get]
 Returns the drawing bitmap operations object.
 
DocumentFileOps DocumentFileOperations [get]
 Returns the Sketch data file operations object.
 
CfdOps CfdOperations [get]
 Returns the CFD operations object.
 
ApplicationMode ApplicationMode [get, set]
 Sets and/or retrieves the Sketch application screen (model edit, visualisation, CFD, etc.).
 
AssemblyLibrary AssemblyLibrary [get]
 Creates an empty assembly library object (refer to AssemblyLibrary interface class).
 
ApplicationComponents ApplicationComponents [get]
 Creates an empty application components object (refer to ApplicationComponents interface class).
 
ApplicationTemplates ApplicationTemplates [get]
 Creates an empty application templates object (refer to ApplicationTemplates interface class).
 
BooleanBlockType BooleanBlockType [get]
 Checks which type of blocks are currently selected in Sketch and returns the associated type.
 
Command CurrentCommand [get, set]
 Sets and/or retrieves the current Sketch command. See the Command interface class for the list of available commands.
 
string PluginsFolder [get]
 Returns the name of the DB plug-ins folder.
 
string ScriptsFolder [get]
 Returns the name of the DB scripts folder.
 
string EnergyPlusFolder [get]
 Returns the name of the DB EnergyPlus folder.
 
string EnergyPlusInputIdfPath [get]
 Returns the path name for the EnergyPlus input file (IN.IDF).
 
string EnergyPlusInputIddPath [get]
 Returns the path name for the EnergyPlus data dictionary file (ENERGY+.IDD).
 
string DsbFilePath [get, set]
 Sets and/or retrieves the DB data file (.DSB) path.
 
double ClipperTolerance [set]
 Sets the tolerance used by the Sketch polygon clipper (advanced use only).
 
int CurrentAssemblyInstanceIndex [get]
 When the current model level of decomposition is at or below the assembly instance level, this method returns the index of the assembly instance otherwise the method will return -1.
 
int CurrentBuildingIndex [get]
 When the current model level of decomposition is at or below building level, this method returns the index of the building otherwise the method will return -1.
 
int CurrentComponentBlockIndex [get]
 When the current model level of decomposition is at or below component block level, this method returns the index of the component block otherwise the method will return -1.
 
int CurrentBuildingBlockIndex [get]
 When the current model level of decomposition is at or below building block level, this method returns the index of the building block otherwise the method will return -1.
 
int CurrentPlaneIndex [get]
 When the current model level of decomposition is at plane level, this method returns the index of the plane otherwise the method will return -1.
 
int CurrentSurfaceIndex [get]
 When the current model level of decomposition is at or below surface level, this method returns the index of the surface otherwise the method will return -1.
 
int CurrentOpeningIndex [get]
 When the current model level of decomposition is at opening level, this method returns the index of the opening otherwise the method will return -1.
 
int CurrentZoneIndex [get]
 When the current model level of decomposition is at or below zone level, this method returns the index of the zone otherwise the method will return -1.
 
ModelIndices CurrentIndices [get]
 Returns a ModelIndices object which incorporates all current model object indices.
 
Type CurrentObjectType [get]
 Returns the type of model object at which the current level of decomposition is set.
 
DataObject DataObject [get]
 Returns an empty DataObject object.
 
DecompositionLevel DecompositionLevel [get]
 Returns the current level of decomposition as an enumerated type (refer to DecompositionLevel interface class for the various levels).
 
bool IsProtractorActive [get]
 Returns a boolean value which indicates whether the Sketch drawing protractor is currently active.
 
Collections.Errors Errors [get]
 Returns an Errors object which is used to obtain error messages from Sketch following an error event (see Errors collection class for available methods).
 
int GroundTextureId [set]
 Sets the ground texture ID which is used for ground display on the visualisation screen.
 
string LibraryFilePath [set]
 Sets the Sketch library file path which points to the location of texture files used by Sketch for rendering model surfaces on the visualisation screen.
 
bool RevitFlag [set]
 Used to inform Sketch whether or not the Sketch control is within the Revit plug-in (as distinct from DB).
 
Site Site [get]
 Returns the site level object.
 
double SolarAltitude [set]
 Used to set the solar altitude angle which is used for lighting and shadow display on the visualisation screen.
 
double SolarAzimuth [set]
 Used to set the solar azimuth angle which is used for lighting and shadow display on the visualisation screen.
 
string TemporaryFilePath [set]
 Deprecated.
 
ViewType View [set]
 Deprecated. Replaced by SetEditMode.
 
Collections.Warnings Warnings [get]
 Returns a Warnings object which is used to obtain warning messages from Sketch following a warning event (refer to Warnings collection class for available methods).
 
bool IsActiveProject [get]
 Returns TRUE if a model is currently loaded into Sketch otherwise FALSE.
 
int ConstructionLinesCount [get]
 Returns the number of construction lines in the current model.
 
int MeasureLinesCount [get]
 Deprecated.
 
ViewType ViewType [get]
 Returns the index of the active application (Edit, HVAC, CFD, etc.).
 
bool IsOpeningSelectedAtBuildingLevel [get]
 Returns TRUE if an opening is currently selected at building level otherwise FALSE.
 
bool IsObjectSelectedAtBuildingLevel [get]
 Returns TRUE if a model object (building block, component block, assembly instance) is selected at building level otherwise FALSE.
 
bool IsFloatingPartitionInCurrentBlock [get]
 Returns TRUE if a disconnected (floating) partition exists at building block level otherwise FALSE. A partition is considered 'floating' if it's not connected at both ends.
 
- Properties inherited from DB.Api.Contracts.IEnvironment
string DsbFilePath [get, set]
 

Detailed Description

Class to handle the Sketch operating environment. The class incorporates methods to set and retrieve the active Sketch command to enable control over the various Sketch operations including drawing model elements, copying, moving, rotating elements, view control, etc. The class also incorporates model navigation methods (changing levels of model decomposition) as well as methods to return API and software versions as well as the various folders used.

Member Function Documentation

◆ ActivateProtractor()

void DB.Api.Environment.ActivateProtractor ( bool  toggle)

Used to activate/deactivate the Sketch drawing protractor. When activated, a graphical protractor is displayed on the Edit screen which can be used to place lines at specific angles to previous lines in a line stream when drawing objects such as block perimeters.

Parameters
toggleBoolean value to specify whether the protractor is to be activated or deactivated.

◆ BeginEditMode()

bool DB.Api.Environment.BeginEditMode ( )

Deprecated.

Returns

◆ Dispose()

void DB.Api.Environment.Dispose ( )

◆ EndEditMode()

bool DB.Api.Environment.EndEditMode ( )

Deprecated.

Returns

◆ GetCommandObject()

CommandObject DB.Api.Environment.GetCommandObject ( Command  command)

This method returns a CommandObject for the supplied Command (refer to Command class for available commands). The CommandObject can be used to determine if the supplied command is active and/or enabled. A command can only be enabled for specific Sketch states. For example the DRAWWINDOW command is only enabled at the zone surface level of decomposition.

Parameters
commandCommand object for which the active/enabled state is required.
Returns

◆ GotoBuilding()

bool DB.Api.Environment.GotoBuilding ( int  buildingIdx)

Used to navigate to a building level of model decomposition. The supplied index is the index of the building required. NOTE - this method is largely superseded by the GoToModelObject method which enables navigation to any model level/object.

Parameters
buildingIdxIndex of building to navigate to.
Returns
TRUE if the building index is valid and the navigation is completed successfully otherwise FALSE

◆ GotoBuildingBlock()

bool DB.Api.Environment.GotoBuildingBlock ( int  buildingIdx,
int  blockIdx 
)

Used to navigate to a building block level of model decomposition. The supplied building index is the index of the building in which the building block is located and the supplied building block index is the index of the building block to be navigated to. NOTE - this method is largely superseded by the GoToModelObject method which enables navigation to any model level/object.

Parameters
buildingIdxIndex of building in which the required building block is located.
blockIdxIndex of the building block to navigate to.
Returns
TRUE if the building/building block indices are valid and the navigation is completed successfully otherwise FALSE

◆ GotoComponentBlock()

bool DB.Api.Environment.GotoComponentBlock ( int  buildingIdx,
int  blockIdx 
)

Used to navigate to a building component block level of model decomposition. The supplied building index is the index of the building in which the component block is located and the supplied component block index is the index of the component block to be navigated to. NOTE - this method is largely superseded by the GoToModelObject method which enables navigation to any model level/object.

Parameters
buildingIdxIndex of building in which the required component block is located.
blockIdxIndex of the componet block to navigate to.
Returns
TRUE if the building/component block indices are valid and the navigation is completed successfully otherwise FALSE

◆ GotoModelObject()

bool DB.Api.Environment.GotoModelObject ( ModelObjectType  type,
DecompositionLevel  level,
ModelIndices  indices 
)

Used to navigate to any valid model object at any level of model decomposition. The supplied ModelObjectType oject is used to specify the required object type to navigate to at the required level of model decomposition and the supplied DecompositionLevelHelp object is used to specify the required level of model decomposition (refer to the ModelObjectType class for the various level object types and the DecompositionLevel class for the various decomposition levels). The supplied ModelIndices object specifies the indices of the various objects (building index, building block index, etc.) that are required for the navigation (refer to the ModelIndices class for the available object indices).

Parameters
typeModelObjectType specifying the type of level object to be navigated to.
levelDecompositionLevel object specifying the required level of decomposition.
indicesModelIndices object specifying all object indices required for the navigation (building index, building block index, etc.).
Returns
TRUE if the navigation is completed successfully otherwise FALSE.

◆ GotoSite()

bool DB.Api.Environment.GotoSite ( )

Used to navigate to the site level of model decomposition. NOTE - this method is largely superseded by the GoToModelObject method which enables navigation to any model level/object.

Returns
TRUE if the navigation is completed successfully otherwise FALSE

◆ GotoSurface()

bool DB.Api.Environment.GotoSurface ( int  buildingIdx,
int  blockIdx,
int  zoneIdx,
int  surfaceIdx 
)

Used to navigate to a zone surface level of model decomposition. The supplied building index is the index of the building in which the zone is located, the supplied building block index is the index of the building block in which the zone is located, the zone index is the index of the zone to which the zone surface belongs and the surface index is the index of the surface to be navigated to. NOTE - this method is largely superseded by the GoToModelObject method which enables navigation to any model level/object.

Parameters
buildingIdxIndex of building in which the required zone surface is located.
blockIdxIndex of building block in which the required zone surface is located.
zoneIdxIndex of the zone to which the required surface belongs.
surfaceIdxIndex of the zone surface to be navigated to.
Returns
TRUE if the building/building block/zone/surface indices are valid and the navigation is completed successfully otherwise FALSE

◆ GotoZone()

bool DB.Api.Environment.GotoZone ( int  buildingIdx,
int  perimBlockIdx,
int  zoneIdx 
)

Used to navigate to a zone level of model decomposition. The supplied building index is the index of the building in which the zone is located, the supplied building block index is the index of the building block in which the zone is located and the zone index is the index of the zone to navigate to. NOTE - this method is largely superseded by the GoToModelObject method which enables navigation to any model level/object.

Parameters
buildingIdxIndex of building in which the required zone is located.
blockIdxIndex of building block in which the required zone is located.
zoneIdxIndex of the zone to navigate to.
Returns
TRUE if the building/building block/zone indices are valid and the navigation is completed successfully otherwise FALSE

◆ ImportProject()

bool DB.Api.Environment.ImportProject ( string  path,
ProjectMode  projectMode 
)

Imports a DB model from another .DSB file using the path provided. The supplied ProjectMode specifies whether the model is to be imported into the current model or as a bookmark building associated with the currently active building. If the model is imported into the current model, it is automatically translated to prevent any block interesctions.

Parameters
pathFull path name of the .DSB file from which the model is to be imported.
projectModeProjectMode specifying whether the model is to be imported as a bookmark of the current building or directly into the current model itself.
Returns

◆ Initialise()

bool DB.Api.Environment.Initialise ( Sketch  skModule,
VersionInfo  dbVersion,
string  pluginsFolder,
string  scriptsFolder,
string  energyPlusFolder 
)

Initialises the Sketch operating environment.

Parameters
skModuleSketch module.
dbVersionVersion of DB
pluginsFolderFolder used for DB plug-ins.
scriptsFolderFolder used for DB scripts.
energyPlusFolderFolder used for EnergyPlus files.
Returns

◆ InitialiseAssemblyInstance()

bool DB.Api.Environment.InitialiseAssemblyInstance ( int  assemblyInstanceIdx)

When placing an instance of an assembly (PLACEASSEMBLY command), this method must be called after any changes are made to the assembly instance drawing options (via the Drawing Options data panel on the edit screen) in order for the changes to take effect. The index of the assembly is supplied to the method.

Parameters
assemblyInstanceIdxIndex of the assembly instance parent assembly.
Returns

◆ ResetCommand()

bool DB.Api.Environment.ResetCommand ( )

Cancels the current command and resets the command to the default SELECTITEM command.

Returns

◆ SaveImageToFile()

bool DB.Api.Environment.SaveImageToFile ( string  path)

Saves the current edit screen to a Bitmap file.

Parameters
pathFull path name of BMP file.
Returns
TRUE if screen image saved to file successfully otherwise FALSE.

◆ SetProgramOptionsRecordHandle()

void DB.Api.Environment.SetProgramOptionsRecordHandle ( int  handle)

Used to pass the 'ProgramOptionTemplates' table record handle for the DB 'Program Options' to Sketch. The 'Program Options' record handle is used by Sketch to obtain the correct record from the 'ProgramOptionTemplates' table for data such as type of units in current use.

Parameters
handleProgramOptionTemplates table record handle for the DB Program Options.

◆ SetSystemColour()

bool DB.Api.Environment.SetSystemColour ( ColouredObject  obj,
byte  r,
byte  g,
byte  b 
)

Used to specify colours as RGB values for the display of various objects on the edit screen.

Parameters
objColouredObject object used to specify the object that the colour is to be associated with (refer to ColouredObject class for the various objects).
rInteger value (0-255) for RED component.
gInteger value (0-255) for GREEN component.
bInteger value (0-255) for BLUE component.
Returns
TRUE if colour successfully set otherwise FALSE.

◆ ShowNorthIndicator()

void DB.Api.Environment.ShowNorthIndicator ( bool  value)

Boolean value to specify whether or not the North indicator is to be displayed on the edit screen.

Parameters
valueTRUE if the NORTH indicator is to be displayed otherwise FALSE

◆ TransferBuildingObjects()

bool DB.Api.Environment.TransferBuildingObjects ( int  srcBuildingIdx,
int  dstBuildingIdx 
)

Transfers model objects from the source building to the destination building.

Parameters
srcBuildingIdxInteger index of source building.
dstBuildingIdxInteger index of destination building.
Returns
TRUE if contents of source building are successfully transferred to the destination building otherwise FALSE.

◆ UndoLastPoint()

bool DB.Api.Environment.UndoLastPoint ( )

Undoes the last line segment for processes that involve line streams, e.g. placing partitions, drawing the perimeters of blocks, etc.

Returns
TRUE if last segment of line stream undone successfully otherwise FALSE.

Property Documentation

◆ DsbFilePath

string DB.Api.Environment.DsbFilePath
getset

Sets and/or retrieves the DB data file (.DSB) path.

Implements DB.Api.Contracts.IEnvironment.


The documentation for this class was generated from the following files: