Using the CopyCAD OLE Server

This page shows what interfaces are available via the CopyCAD OLE server.

Back to index
 
 

Creating a new CopyCAD object

Set copycad = Createobject ("Copycad.Document")

This will create a new CopyCAD session, linked to the object 'copycad'.

When you quit the VB application, although the object is destroyed, CopyCAD is not closed down.
 
 

Connecting to an existing CopyCAD session

Set copycad = Getobject(,"Copycad.Document")

This method will connect the object 'copycad' to an existing CopyCAD session.

With this method, when you quit the VB application, the CopyCAD session remains open.
 
 

Displaying the CopyCAD window

You can show or hide the CopyCAD window, using the server interface:

To show the CopyCAD window:

copycad.Visible = True

To hide the CopyCAD window:

copycad.Visible = False
 
 

Controlling the CopyCAD window

You can minimise/maximise/normalised and bring to foreground the CopyCAD window, using the server interface:

To nomalise the CopyCAD window:

copycad.windowstate = 1

To maximise the CopyCAD window:

copycad..windowstate = 2

To mimimise the CopyCAD window:

copycad.windowstate = 4

To bring the CopyCAD window to foreground:

copycad.windowstate = 8
 
 

Getting the current CopyCAD version

This can be used to check if a connection is made to CopyCAD. If the returned version is 0, or an error is generated, then no connection exists.

To extract the version number use the server interface:

Debug.Print copycad.Version
 
 

Sending commands to CopyCAD

Similar to a user typing in the command window, you can send a command to CopyCAD with the server interface:

copycad.Execute command_string, error_flag

Where 'command' is a string containing the command

And 'error_flag' is a LONG variable, and is an error flag which is only set if there is an internal error within CopyCAD. It is required to use the command, but its value can normally be ignored.

e.g.

copycad.Execute "DRAW ALL", error
 
 

You can also send commands to CopyCAD, and extract the resulting message from the command window, using the interface:

copycad.ExecuteEx command_string, error_flag, messages_string

Where 'command' and 'error_flag' are similar to using the 'Execute' method,

And 'messages_string' is a string variable, in which the command window output will be placed.

e.g.

copycad.ExecuteEx "SIZE COMPONENTS",error, size

The string variable 'size' will contain the command window message.
 
 

Quiting CopyCAD

To quit CopyCAD via the interface, use the command:

copycad.exit