Control how OpenTD connects to Thermal Desktop
In this guide, we mostly call ThermalDesktop.Connect() with default options, which means it starts a new instance of TD with the latest version of AutoCAD available, then creates a new, blank drawing. To change this behavior, set the ThermalDesktop.ConnectConfig member before calling Connect(), as shown in the following program, which hides the AutoCAD window while it’s running:- AcadExePathname: By default, Connect() starts the latest version of AutoCAD found on your machine. Set AcadExePathname to the full path of any acad.exe to use it instead.
- AcadVisible: Set to false to hide the AutoCAD window. This only works when starting new TD instances, not attaching to already-running instances.
- DwgPathname: If this is set, Connect() will try to attach to or start a TD instance with this dwg. It will throw an exception if the dwg does not exist. Instead of editing ConnectConfig, this can also be set using an overloaded ThermalDesktop constructor:
- PipeEndpointName: Use this after issuing one of the TD commands for starting servers (See the Control OpenTD servers from AutoCAD section) to connect to an already-running instance of TD.
- Type: This determines whether Connect() will try to attach to an already-running instance of TD or start a new one. The default is AUTO, which means it will try both – first it will try to attach, but if that fails, it will start a new instance.
Control OpenTD servers from AutoCAD
A client program communicates with TD via an OpenTD server launched within the acad.exe process, identified with a string called a Pipe Endpoint Name. When you load a dwg containing TD entities, an OpenTD server is started using the dwg pathname to generate the pipe endpoint name. That’s how the Connect() method finds the correct acad process when DwgPathname is set (See the Control how OpenTD connects to Thermal Desktop section). An OpenTD server is also automatically started when you start a new instance of TD via OpenTD. There are commands you can use at the AutoCAD command line to query and start OpenTD servers:- RCOpenTD: This command will ask you for a pipe endpoint name and start a server with that name.
- RCOpenTDRANDOM: This command will start a server with a random name.
- RCOpenTDDWG: This command will start a server with a name based on the dwg pathname. It is included for completeness, but there should never be a reason to call it, since it is called automatically by TD.
- RCOpenTDLISTSERVERS: This command will list the pipe endpoint names of the active OpenTD servers.
Execute AutoCAD commands
When an OpenTD method is not available to perform a task, you might be able to use the ThermalDesktop.SendCommand method to send an AutoCAD command to TD. SendCommand has the following signature:Execute TD COM commands
Before OpenTD, there was a Windows Component Object Model (COM) interface to TD. It could be used to perform a subset of OpenTD functions. To use it, commands were entered as text strings and parsed by the TD COM server. In OpenTD, the ThermalDesktop.SendLegacyComCommand method emulates the TD COM parser without actually using a COM connection. Most TD COM functionality can be accomplished using native OpenTD methods. The SendLegacyComCommand method is included for completeness, and to ease the process of migrating an existing TD COM application to OpenTD. SendLegacyComCommand is not recommended to be used for new OpenTD applications. Since the underlying RadCAD functions used by the COM server report success/failure via the AutoCAD console and not via a return value, SendLegacyComCommand may appear to succeed when it did not. It will only throw exceptions if it doesn’t recognize a command or if the command crashes AutoCAD, and not if the command fails in some non-catastrophic way. SendLegacyComCommand usually returns an empty string. The only exception to this is the “get” command, which attempts to return a string representing the value of a symbol. The following commands are supported:-
acadcommand “command” [“optional parameter” “optional parameter” …]
Executes an AutoCAD console command. The command and any parameters are individually enclosed in double quotes. New applications should use ThermalDesktop.SendCommand instead. Examples:- SendLegacyComCommand(“acadcommand \“zoom\” \“extents\"")
- SendLegacyComCommand(“acadcommand \“line\” \“1,1\” \“2,2\” \”\"")
-
case [optional parameters]
Calculates radiation and Cond/Cap data for the current case set. New applications should use OpenTD CaseSetManager and/or CaseSet instead. Examples:
- SendLegacyComCommand(“case”) // Calculates all radiation and cond/cap data.
- SendLegacyComCommand(“case rad0 rad3 cc”) // Calculates 1st and 4th radiation tasks and cond/cap data.
- caseset parameters Provides access to the Case Set Manager. New applications should use OpenTD CaseSetManager and/or CaseSet instead.
- copyradkfiles fromFilename toFilename Copies radk files.
- createmapset Undocumented interactive command.
-
disableuserbreaks
Disables the ability to press ESC to end tasks. - displaycurrentdataset Displays the current post-processing dataset. New applications should use OpenTD.PostProcessing instead.
- dumpppmap outputFilename Undocumented post-processing command. New applications should use OpenTD.Results instead.
- exitautocad Attempts to exit Thermal Desktop without saving the dwg. New applications should use ThermalDesktop.Quit instead.
-
exportnodeinfo
Calls the RcExportNodeInfo command. New applications should use ThermalDesktop.ExportNodeInfo instead. -
get symbolName
Returns a string representing the evaluated value of a symbol. New applications should use ThermalDesktop.GetSymbolValue instead. -
importcomet filename
Undocumented. -
mapnastran inputFilename outputFilename [optional tolerance]
Maps the current post-processing data to the Nastran mesh defined in inputFilename, writing the results in Nastran format in outputFilename. New applications should use PostProcessing.DataMapper instead. -
object
This command is used by Dynamic SINDA/FLUINT to display the value of OBJECT in the TD Dynamic SINDA/FLUINT status window. -
opticalias alias opticalProp
Changes what optical property an alias refers to. The names cannot include spaces. New applications should use ThermalDesktop.OpticalPropAliasManager instead. -
orbit parameters
Provides access to the Heating Rate Case Manager. New applications should use OpenTD Orbit instead. -
output message
Writes message to the TD Dynamic SINDA/FLUINT status window. -
postprocess filename [optional delay in ms]
Creates or updates a TEXT-type dataset from a file. New applications should use PostProcessing.DatasetManager instead. -
ppnexttime
Steps forward to the next record in the current dataset. New applications should use PostProcessing.DatasetManager instead. -
ppsavefile savOrCsrPathname
Creates or updates a SF-type dataset from a save file or CSR directory. New applications should use PostProcessing.DatasetManager instead. -
ppsettime index
Sets the record for the current post-processing dataset. Uses 0-indexed record array index (0, 1, 2, etc) not record number. New applications should use PostProcessing.DatasetManager instead. -
sendf4
Sends the F4 keycode. Useful for capturing the screen using hypersnap/cam. -
set symbolName expressionIncludingSpaces
Updates an existing symbol’s expression. New applications should use OpenTD Symbol instead. -
setmapconstanttol toleranceInDwgUnits
Sets the constant tolerance to be used by the mapnastran command, in dwg units. New applications should use PostProcessing.DataMapper instead. -
setmapcurrentorall parameter
If parameter is ALL, the mapnastran command will perform the mapping for all records in the dataset. If parameter is any other value, it will perform the mapping at the current record. New applications should use PostProcessing.DataMapper instead. -
setmapset mapsetName
Instructs the mapnastran command to only use the specified object mapset. -
setmapvariabletol TolerancesSeperatedBySpaces
Sets the progressive tolerance to be used by the mapnastran command, in dwg units. -
startcase [optional name]
Runs the current case set, or the one specified by the optional name. New applications should use OpenTD CaseSetManager and/or CaseSet instead. -
tdmapallmappers appendToFilename
Executes all mappers. Inserts the appendToFilename string at the end of each output file, before any extension. New applications should use PostProcessing.DataMapper instead. -
thermoalias alias thermoProp
Changes what thermophysical property an alias refers to. The names cannot include spaces. New applications should use ThermalDesktop.ThermoPropAliasManager instead. -
update
Updates all entity values based on symbol expressions.