Multiple interfaces


Your Ad Here


Topsolid online Help Index

Many TopSolid objects support more than one interface.

 

For example, design documents ("*.top" files) are accessible through DocumentDesign objects, which support two interfaces, IDocument for general document handling, and IDocumentDesign for design document specific functionalities.

 

To do so, TopSolid implements what is known in the COM (Component Object Model) world as "multiple dual interfaces".

 

This means that one single object may implement several (what is known as "IDispatch") interfaces, and one will need to switch from one to another to access the full set of available methods and properties.

 

For instance, you may write the following VB code to access the SaveAs method of the IDocument interface of a DocumentDesign object :

 

Dim TopDocDgn As TopSolid.DocumentDesign

...

Dim TopDoc As TopSolid.IDocument

Set TopDoc = TopDocDgn

TopDoc.SaveAs ("test.top")

...

 

To make it easier, most interfaces provide a property that allows you to get the base interface without actually explicitly going through another pointer.

 

For instance, the IDocumentDesign interface contains the Document property that just does that, and therefore the previous code may be simplified like this :

 

Dim TopDocDgn As TopSolid.DocumentDesign

...

TopDocDgn.Document.SaveAs ("test.top")

...

 

 

 

 

 

 

 

Topsolid online Help Index

Your Ad Here