The Designer Library

General Info

The library exposed by Pro-Designer COM server is the Designer Type Library. The file that captures the definitions for this library is called “Designer.tlb” and it is located in the installation folder of your application. As mentioned in the introduction we use the term ‘Pro-Designer Server’ or ‘Designer Server’ to represent either the SuperPro-Designer server or the EnviroPro-Designer automation server. The Designer Type Library is common to both servers and it can be utilized to perform several actions including:

      Start / Shut down the Pro-Designer application

      Open / close a designer case file

      Solve the simulation (perform material and Energy balances)

      Perform economic calculations

      Data exchange (input / output variable values)

      Set report options and export reports to specified files

      Export pictures and charts to specified files or to the clipboard

      Enumerate over several items lists included in process file (unit procedures, equipment, streams, components, etc.)

      Error message retrieval

The Designer Type Library contains the following members:

      The class Application which includes methods (functions and subroutines) that can be used for communicating between the main Pro-Designer application and other applications. information on using these methods can be found in Pro-Designer COM server Methods

      The class Document which includes methods (functions and subroutines) that can be used for communicating information between a Pro-Designer case file and other applications. Information on using these methods can be found in Pro-Designer COM server Methods.

      The enum varID whose members are predefined constants, used as arguments in the methods of the Document class in order to access a Pro-Designer variable. Information on accessing the Pro-Designer variables using these constants can be found in Accessing Pro-Designer Variables with COM.

      Then enum ExportDestination which is used as an argument in the functions used to export objects as described in Specifying Export Destination. It is part of the argument list of some Object Export Related Methods.

      The enum ExportFormat which is used as an argument in the SetReportsFormat function as described in Specifying Export Format. It is part of the argument list of some Object Export Related Methods.

      The enum ExportObjectType which is used as an argument in the ExportObject function as described in Specifying Export Object Type and used in the Object Export Related Methods.

      The enum IngredientConsumptionType and IngredientOutputType which is used in export functions that refer to ingredient charts (see Object Export Related Methods).

      The enum ResourceUseTimeRef which is used in ingredient consumption functions IngredientAmtUsedAsRawMaterial & IngredientAmtConsumedByOperation as described in Functions for Stream Variables.

      The enums ListTypeID and ContainerTypeID used by the enumerator functions (Enumerator Description) in order to specify the type of items included in the list , see Specifying Item List Type, that are to be enumerated and to specify the container object for the list , see Specifying Container Type.

      The enum COMPQUnits which is used for specifying the units in the exported Stream Summary, Equipment Contents and Procedure Activity Overview tables Specifying Physical Quantity Units in Tables.

      The enums StreamInitMode and SolveAutoInitMode which are used to specify Auto Initialization options of Streams and Equipment. Please, see Auto Initialization Variables.

The object browser in Visual Basic Editor (VB Editor) can be used to view the classes of the Pro-Designer library and their member methods and properties as explained in Viewing Pro-Designer Methods and Properties.

Viewing Pro-Designer Methods and Properties

The object browser in Visual Basic Editor (VB editor) can be used to view the objects of the Designer Type Library and their member methods (and properties). From the VB Editor press F2 (or click on the VBA_edit400001.jpg icon from the standard toolbar, or select View/Object Browser from the VBE main menu) to display the object browser. From the drop down list box on the upper-left corner select the Designer library. this will display the classes, methods and enums belonging the Designer Type Library in the left pane (Document, EexportDestination, ExportFormat, ExportObjectType, IngredientConsumptionType, VarID and globals). The right pane displays the members of the selected class/enum. For example if you select the Document object (left-click) its members are displayed in the right pane as shown in the following figure.

ObjectBrowser.jpg

The bottom pane displays details for the selected item, in this case the class Document. You can see on the right pane the members of Document. If you select one of them, for example left click on GetFlowsheetVarVal, and information regarding the specific member is displayed in the bottom pane, as can be seen in the following figure.

ObjectBrowser2.jpg

In this case we can see that the function GetFlowsheetVarVal returns a Boolean value and that it takes 2 arguments, the first argument (VarID) is of VarID type and the second argument (val) is of VARIANT type.

IconInfo00002.bmp 

The bottom pane displays all information necessary for a Function / Subroutine. It specifies the type of value it returns (if is a function) for example Boolean/Double, Object, etc. Furthermore it shows the number and type of arguments needed for this method. When an argument is Variant type,i.e va; in the example, no type is specified. However this argument needs to be defined as a Variant in your VBA script.

 

Similarly if you select any of the Enums for example the VarID enum from the left pane, the variable ids, its constant members are displayed on the right pane as shown in the next figure.

The members of the Enums (ExportDestination, ExprortFormat, ExportObjectType, IngredientConsumptionType, and VarID) are predefined constants used as arguments in the Designer library methods. The members of VarID are used as variable identifiers in order to access or specify a Pro-Designer variable. Their value is insignificant, however in order to use the Pro-Designer OLE Automation Server you need to know the correspondence between the Pro-Designer variables and their identifiers.

This manual provides this information in sections:

      See Pro-Designer COM server Methods for information on the Pro-Designer COM Server methods that can be utilized.

      See Accessing Pro-Designer Variables with COM for information on the Pro-Designer variables than can be accesses with the COM Methods.

The object browser can be a valuable tool to be used as a quick reference when using the VB Editor since the method and the argument names are self-explanatory. For additional information on the action and the arguments of each method you can refer to this manual.

ObjectBrowser3.jpg

 

 

Declaring and Initializing Pro-Designer Server Objects

There are two main Pro-Designer server objects that must be created first to automate SuperPro or EnviroPro Designer. The first one is the Application object, which is responsible for the top level tasks of the Pro-Designer application, as well as getting a reference to the second main object which is the Document object. You always have to first get a reference to the Application object followed by a reference to a Document object in order to manipulate the process file.

You may see the objects and their methods provided by Pro-Designer by selecting View / Object Browser from the Visual Basic Editor main menu.

The following code can demonstrate the steps that are taken to declare and initialize these two server objects:

Dim superProApp As Designer.Application
Dim superProDoc As Designer.Document

Sub StartApp( )
   Set superProApp = New Designer.Application
   superProApp.ShowApp
End Sub

Sub OpenDoc( )
   Set superProDoc = superProApp.OpenDoc(“spdFileName”)
End Sub

In the above scripts both superProApp and SuperProDoc are declared globally, usually done at the class or module level of the VBA project, so they can be available to all of the procedures of the VBA project (sheets, modules, classes, ThisWorkbook). The initializations of the Application and Document objects are done in the two subroutines StartApp( ) and OpenApp( ) respectively, which can be defined anywhere in the VBA project but are usually placed in the “ThisWorkbook” project object.

      For information on the methods of the two objects, see Pro-Designer COM server Methods.

      For more detailed VBA examples that demonstrate the initialization of the two objects and the use of their methods, see Application Related Scripts.