ConnectToProject As Long - Integration - Update 44 - Help - Hexagon

SmartPlant Integration COM Help

Language
English
Product
Integration
Search by Category
Help
SmartPlant Foundation / SDx Version
10
Smart P&ID Version
9 (2019)
Smart Engineering Manager Version
10 (2019)

Connect to a project in SmartPlant Foundation.

The design tool must call this method before calling any other method on this interface, except Register.

Arguments

Name

Data type

Input/output

Description

sSPFURL

String (maximum 128 characters)

Input

SmartPlant Foundation URL

sSPFPlant

String (maximum 254 characters)

Input

SmartPlant Foundation Plant name

sProjectNameInTool

String (maximum 256 characters)

Input

Tool project name. This should match with the project name in SPF to establish connection.

sProjectNameInSPF

String (maximum 256 characters)

Input

SmartPlant Foundation Project Name.

sToolID

String (maximum 24 characters)

Input

Design tool name. For example, Smarplant P&ID.

sToolAdapterProgID

String

Input

ProgID of the design tool adapter, i.e., the ProgID of the tool’s adapter implementation that supports the IEFAdapter interface.

oToolParameters

IEFToolParameters

Input

Collection of tool parameters that in turn will be passed to the tool adapter. Arguments tool Site, tool Plant, and tool workgroup file of the IApplication.Register method, as well as any other tool specific parameters, can be passed using this argument.

oToolDocsForProject

IEFToolDocsForProject

Input

Interface pointer to the tool’s implementation object that supports the IEFToolDocsForProject interface. Tools must instantiate their implementation object before calling this method.

bFileMode

Boolean

Input

Optional argument to indicate whether Publish/Retrieve To File mode should be turned on.

TRUE turns on Publish/Retrieve To File.

Default is FALSE.

Return Value

0 if method is successful.

A negative number if method fails. (Check the LastErrorMessage property for error message.)

If the method fails because it is attempting to connect to a project whose status does not allow connection, the negative return value is equal to SPFConnectionFailedBecauseOfProjectStatus plus a value that indicates the project's status. SPFConnectionFailedBecauseOfProjectStatus is an enum in eErrorValues. The project status value added to SPFConnectionFailedBecauseOfProjectStatus is one of the enums in SPFProjectStatus. Both eErrorValues and SPFProjectStatus are part of SchemaCompInterfaces in SchemaComponent.Tlb (Intergraph - EF/SC Component Interfaces).

For example, if the method fails because it attempts to connect to a project with merged status, the method returns a value equal to SPFConnectionFailedBecauseOfProjectStatus + Merged.

The following table shows the Connect return value for different SmartPlant Foundation project statuses. The table also shows the value of the CurrentSPFProjectStatus property after the Connect call. The CurrentSPFProjectStatus property is set when connection is successful and also if the connection failed because of the project status.

Project status in SmartPlant Foundation

Value returned by Connect call

CurrentSPFProjectStatus property

Created

-2147220834 (Failure)

SPFProjectStatus.Created

Active

0 (Success)

SPFProjectStatus.Active

Completed

0 (Success)

SPFProjectStatus.Complete

Merged/Finished

-2147220831 (Failure)

SPFProjectStatus.Merged

Cancelled

0 (Success)

SPFProjectStatus.Cancelled

Terminated

-2147220829 (Failure)

SPFProjectStatus.Terminated

Comments

If the project arguments are not passed in the Connect method, the connection will be made in context of the As-built plant (no project context).