Class TopSolidHostInstance
Represents a TopSolid host instance providing WCF services for automating.
Inheritance
Inherited Members
Namespace: TopSolid.Kernel.Automating
Assembly: cs.temp.dll.dll
Syntax
[AvailableSinceVersion(7, 10, 0, 0)]
public class TopSolidHostInstance
Remarks
When automating several instances of TopSolid at the same time one must make and use several instances of this class (one per TopSolid instance), otherwise if only one instance of TopSolid is to be automated, it is possible to simply use the TopSolidHost static class.
This class is available since v7.10.
Constructors
TopSolidHostInstance()
Initializes a new instance of the TopSolidHostInstance class.
Declaration
public TopSolidHostInstance()
Properties
Application
Gets access to the application, or null if not available.
Declaration
public IApplication Application { get; }
Property Value
Type | Description |
---|---|
IApplication |
Arguments
Gets or sets the arguments to declare to the TopSolid process when the process needs to be started. To set before the call to the Connect() methods.
Declaration
public string Arguments { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Classifications
Gets access to classifications, or null if not available.
Declaration
public IClassifications Classifications { get; }
Property Value
Type | Description |
---|---|
IClassifications |
ClientAddress
Gets the client IP address used for receiving events when using TCP, or null for not managing events.
Declaration
public string ClientAddress { get; }
Property Value
Type | Description |
---|---|
System.String |
ClientName
Gets the client name, or null if anonymous.
Declaration
public string ClientName { get; }
Property Value
Type | Description |
---|---|
System.String |
ClientPort
Gets the client port used for receiving events when using TCP, or 0 for not managing events.
Declaration
public int ClientPort { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Documents
Gets access to documents, or null if not available.
Declaration
public IDocuments Documents { get; }
Property Value
Type | Description |
---|---|
IDocuments |
DocumentsEventsHost
Gets access to the documents events service host, or null if not created.
Declaration
public ServiceHost DocumentsEventsHost { get; }
Property Value
Type | Description |
---|---|
ServiceHost |
Elements
Gets access to elements, or null if not available.
Declaration
public IElements Elements { get; }
Property Value
Type | Description |
---|---|
IElements |
Entities
Gets access to entities, or null if not available.
Declaration
public IEntities Entities { get; }
Property Value
Type | Description |
---|---|
IEntities |
Families
Gets access to families, or null if not available.
Declaration
public IFamilies Families { get; }
Property Value
Type | Description |
---|---|
IFamilies |
Geometries2D
Gets access to 2D geometric entities, or null if not available.
Declaration
public IGeometries2D Geometries2D { get; }
Property Value
Type | Description |
---|---|
IGeometries2D |
Geometries3D
Gets access to 3D geometric entities, or null if not available.
Declaration
public IGeometries3D Geometries3D { get; }
Property Value
Type | Description |
---|---|
IGeometries3D |
HostAddress
Gets the host IP address, or null if not using TCP.
Declaration
public string HostAddress { get; }
Property Value
Type | Description |
---|---|
System.String |
HostPort
Gets the host port, or 0 if not using TCP.
Declaration
public int HostPort { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
IsConnected
Tells whether TopSolid is connected.
Declaration
public bool IsConnected { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Layers
Gets access to layer entities, or null if not available.
Declaration
public ILayers Layers { get; }
Property Value
Type | Description |
---|---|
ILayers |
Licenses
Gets access to licenses, or null if not available.
Declaration
public ILicenses Licenses { get; }
Property Value
Type | Description |
---|---|
ILicenses |
Materials
Gets access to materials, or null if not available.
Declaration
public IMaterials Materials { get; }
Property Value
Type | Description |
---|---|
IMaterials |
Operations
Gets access to operations, or null if not available.
Declaration
public IOperations Operations { get; }
Property Value
Type | Description |
---|---|
IOperations |
Options
Gets access to documents options, or null if not available.
Declaration
public IOptions Options { get; }
Property Value
Type | Description |
---|---|
IOptions |
Parameters
Gets access to parameter entities, or null if not available.
Declaration
public IParameters Parameters { get; }
Property Value
Type | Description |
---|---|
IParameters |
Pdm
Gets access to the PDM, or null if not available.
Declaration
public IPdm Pdm { get; }
Property Value
Type | Description |
---|---|
IPdm |
PdmAdmin
Gets access to the PDM administration, or null if not available.
Declaration
public IPdmAdmin PdmAdmin { get; }
Property Value
Type | Description |
---|---|
IPdmAdmin |
PdmSecurity
Gets access to the PDM security, or null if not available.
Declaration
public IPdmSecurity PdmSecurity { get; }
Property Value
Type | Description |
---|---|
IPdmSecurity |
PdmWorkflow
Gets access to the PDM administration, or null if not available.
Declaration
public IPdmWorkflow PdmWorkflow { get; }
Property Value
Type | Description |
---|---|
IPdmWorkflow |
PipeName
Gets or sets the name used to make named pipe, or null for default.
Declaration
public string PipeName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
This property can be changed before connecting to a TopSolid host on the same machine using named pipes if the default name is not convenient (in particular when several TopSolid processes are running at the same time), it is not needed to change it otherwise.
This property cannot be set once connected to TopSolid, i.e. when IsConnected is true
.
Shapes
Gets access to shape entities, or null if not available.
Declaration
public IShapes Shapes { get; }
Property Value
Type | Description |
---|---|
IShapes |
Sketches2D
Gets access to 2D sketches, or null if not available.
Declaration
public ISketches2D Sketches2D { get; }
Property Value
Type | Description |
---|---|
ISketches2D |
Sketches3D
Gets access to 3D sketches, or null if not available.
Declaration
public ISketches3D Sketches3D { get; }
Property Value
Type | Description |
---|---|
ISketches3D |
Textures
Gets access to textures, or null if not available.
Declaration
public ITextures Textures { get; }
Property Value
Type | Description |
---|---|
ITextures |
Units
Gets access to units, or null if not available.
Declaration
public IUnits Units { get; }
Property Value
Type | Description |
---|---|
IUnits |
User
Gets access to the user, or null if not available.
Declaration
public IUser User { get; }
Property Value
Type | Description |
---|---|
IUser |
Version
Gets the version of TopSolid host, or 0 if not connected.
Declaration
public int Version { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
The value returned is defined by: Major * 100000000 + Minor * 1000000 + Build * 1000 + Revision
.
For example, v7.5.200.100 is returned as: 705200100
.
Visualization3D
Gets access to 3D visualization, or null if not available.
Declaration
public IVisualization3D Visualization3D { get; }
Property Value
Type | Description |
---|---|
IVisualization3D |
Methods
Connect()
Connects to TopSolid application.
Declaration
public bool Connect()
Returns
Type | Description |
---|---|
System.Boolean | TopSolid has been automatically started. |
Remarks
TopSolid is automatically started if it is not already running.
When starting TopSolid automatically, if several versions are installed, the most recent version is started.
When starting TopSolid automatically, if both 64-bit and 32-bit versions are installed, the 64-bit version is started.
This methods waits up to 10 minutes for TopSolid to be ready before failing to connect.
Connect(Boolean, Int32)
Connects to TopSolid application.
Declaration
public bool Connect(bool inStarts, int inTimeOut)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | inStarts | Automatically starts TopSolid if it is not already running. |
System.Int32 | inTimeOut | Number of seconds to wait for TopSolid to be ready before failing to connect. |
Returns
Type | Description |
---|---|
System.Boolean | TopSolid has been automatically started. |
Remarks
When starting TopSolid automatically, if several versions are installed, the most recent version is started.
When starting TopSolid automatically, if both 64-bit and 32-bit versions are installed, the 64-bit version is started.
Connect(Boolean, Int32, String)
Connects to TopSolid application.
Declaration
public bool Connect(bool inStarts, int inTimeOut, string inClientName)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | inStarts | Automatically starts TopSolid if it is not already running. |
System.Int32 | inTimeOut | Number of seconds to wait for TopSolid to be ready before failing to connect. |
System.String | inClientName | Name identifying your application, ex: "MyApplication". |
Returns
Type | Description |
---|---|
System.Boolean | TopSolid has been automatically started. |
Remarks
When starting TopSolid automatically, if several versions are installed, the most recent version is started.
When starting TopSolid automatically, if both 64-bit and 32-bit versions are installed, the 64-bit version is started.
The inClientName
string must uniquely identify your application, as it is used to make a Windows pipe name that must be unique
when managing events.
Connect(String)
Connects to TopSolid application.
Declaration
public bool Connect(string inClientName)
Parameters
Type | Name | Description |
---|---|---|
System.String | inClientName | Name identifying your application, ex: "MyApplication". |
Returns
Type | Description |
---|---|
System.Boolean | TopSolid has been automatically started. |
Remarks
TopSolid is automatically started if it is not already running.
When starting TopSolid automatically, if several versions are installed, the most recent version is started.
When starting TopSolid automatically, if both 64-bit and 32-bit versions are installed, the 64-bit version is started.
This methods waits up to 10 minutes for TopSolid to be ready before failing to connect.
DefineConnection(String, Int32, String, Int32)
Defines the connection between this client application and TopSolid host for remote access.
Declaration
public void DefineConnection(string inHostAddress, int inHostPort, string inClientAddress, int inClientPort)
Parameters
Type | Name | Description |
---|---|---|
System.String | inHostAddress | Host IP address (or "localhost" for local machine) if using TCP, or null otherwise (default). |
System.Int32 | inHostPort | Host port used if using TCP, or 0 otherwise (default). |
System.String | inClientAddress | Client IP address (or "localhost" for local machine) if using TCP and managing events, or null otherwise (default). |
System.Int32 | inClientPort | Client port used if using TCP and managing events, or 0 otherwise (default). |
Remarks
This method must be called before connecting to a remote TopSolid host on another machine to use TCP instead of named pipes, it is not needed to call it otherwise.
When performing remote access and using events, inClientAddress
and inClientPort
must be set to allow TopSolid to connect
to this client application, otherwise they must be set to null
and 0
.
This method cannot be called once connected to TopSolid, i.e. when IsConnected is true
.
Disconnect()
Disconnects from TopSolid application.
Declaration
public void Disconnect()
HandleDocumentsEvents(Type)
Starts documents events handling.
Declaration
public void HandleDocumentsEvents(Type inClassType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | inClassType | Type of class implementing IDocumentsEvents interface. |
Remarks
To handle documents events, one needs to make a class implementing IDocumentsEvents interface, and call this method
with that type in the inClassType
argument.
This method creates a new service host, returned afterwards by the DocumentsEventsHost property.
This method then subscribes to documents events using the SubscribeToEvents(Int32, String) method.
This method may only be called when connected to TopSolid, otherwise an exception is thrown.
MakeClientHost(Type, Type)
Makes a TopSolid client WCF host.
Declaration
public ServiceHost MakeClientHost(Type inClassType, Type inInterfaceType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | inClassType | Class type, implementing the |
System.Type | inInterfaceType | Interface type. |
Returns
Type | Description |
---|---|
ServiceHost | Host. |
Events
Exited
This event is raised when the host process was running on the local machine and has exited.
Declaration
public event EventHandler Exited
Event Type
Type | Description |
---|---|
System.EventHandler |