0% found this document useful (0 votes)
49 views645 pages

Top Solid API

The document provides an overview of the TopSolid 2008 Automation API, detailing its objects and interfaces for automating tasks to improve productivity. It assumes familiarity with TopSolid terminology and suggests a structured approach for new users to learn the API. Additionally, it discusses the use of Visual Basic for development, multiple interfaces for objects, and considerations for program units and version management.

Uploaded by

leon.vannesson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views645 pages

Top Solid API

The document provides an overview of the TopSolid 2008 Automation API, detailing its objects and interfaces for automating tasks to improve productivity. It assumes familiarity with TopSolid terminology and suggests a structured approach for new users to learn the API. Additionally, it discusses the use of Visual Basic for development, multiple interfaces for objects, and considerations for program units and version management.

Uploaded by

leon.vannesson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Welcome

Welcome

Welcome to the TopSolid 2008 (v6.9) Automation API on-line help.

This document describes the available objects and interfaces exposed by TopSolid that
will allow you to automatize frequent tasks, so you (or your customer if you are a third
party developer) may achieve a productivity improvement.

This on-line help assumes that you are a fully trained TopSolid user, as all the usual
TopSolid terminology (assembly, draft, component, shape, curve, layer, ..) will be used
without any explanation (you will find some in the TopSolid on-line help).

If you read this for the first time, you may wonder what is the best (and fastest) way to
know out to use the TopSolid API...

In that case, let us suggest you the following simple algorithm:

Read all the "Guide" chapter.

Have a look at the samples in the "Examples" chapter.

Go through the other chapters quickly to see how they are structured, so that you
will be able to find the right information when needed.

Start writing your own samples...

1
Welcome

Enjoy!

The TopSolid Development Team.

To download the last version of the TopSolid 2008 Automation API on-line help, click
here.

2
Welcome

Automation

TopSolid is an Automation server, and complies with the specifications of such, as


defined by Microsoft.

This means that you may develop programs to drive TopSolid using standard tools like
Microsoft Visual Basic.

As it is expected that this will be the most common way to automatize TopSolid
tasks, this on-line help assumes that you are familiar with VB, and will use VB to
develop programs to drive TopSolid.

To do so, first use the "References..." command of the "Project" menu and activate
the "TopSolid v6.9 Type Library" that should be part of the list (if not, you need to run
TopSolid once on your machine).

Once this is done, you will have an easy access to all of the API interfaces, with
some help from VB...

However, using VB is not an obligation, and any product capable of being an


Automation client, will be able to do the job!

3
Welcome

Multiple interfaces

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")

...

4
Welcome

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")

...

5
Welcome

Script languages

Unlike VB, script languages cannot manage objects with multiple interfaces
directly.

To compensate for this limitation, TopSolid uses a special mechanism, called


"DISPID encoding", that allows script languages to have access to methods and
properties of objects that have multiples interfaces, with the only restriction that the
name of the method/property must be unique among all the interfaces implemented in
the object.

Usually, this will be the case, but if it is not, then it is the method/property of the
first interface that will be called (the ordered list of the interfaces implemented by
each object is given in the object description page).

6
Welcome

Program units

By default, values are always input and output in reference units : angles in
degrees, lengths in meters.

It is possible to change this behavior with the ProgramUnitAngle and


ProgramUnitLength properties of the IApplication interface (ex: Setting program
units).

It is also possible to define program units associated to a given document (by


default, when a document is first accessed through Automation, it inherits the
application program units) by the ProgramUnitAngle and ProgramUnitLength
properties of the IDocument interface.

Whenever you send or receive values to or from objects belonging to a given


document, the program units of this document are used, unless explicitly specified in
the description of the method/property.

Usually, most programs will only set the application program units once at the
beginning, and forget about it.

However, there is one case where one should be careful : if several Automation
client programs are supposed to run in parallel on the same TopSolid instance, one of
them may change the program units to a setting that would not please another one...

In this case, checking for correct program units is needed before performing actions
that would involve exchanging values with TopSolid.

7
Welcome

Coordinates

Driving TopSolid often involves sending or receiving points or vectors (to define
directions or axes), using (x, y, z) Cartesian coordinates.

By convention, these coordinates are always expressed in length program units, and
are relative to the current coordinate system (or current draft view for draft
documents) of the involved document.

For instance, the following code will create a point on the X axis of the current
coordinate system of the document, at 20mm from the origin :

Dim TopDoc As TopSolid.DocumentDesign

Dim TopPnt As TopSolid.Point

...

TopDoc.Document.ProgramUnitLength = "mm"

TopPnt = TopDoc.Points.AddBasic(20, 0, 0)

...

8
Welcome

Object model overview

A simplified object model is presented in this diagram.

The root object Application gives access to all of the internal objects.

It contains three main collections : the Contexts, the Extensions, and the Documents.

The Contexts collection contains all the available contexts, with at least the
TopSolid standard ContextDesign and ContextDraft, and possibly more depending on
the installed TopSolid based applications.

There is one context per type of document supported. The context allows controlling
the management of this particular type of document, it is also used to create new
documents of this type with specific arguments (unlike with the Add method of the
Documents collection).

The Extensions collection contains all the available extensions, it is empty if no


TopSolid add-on has been installed.

The Documents collection contains all the documents loaded in memory, which is all
the displayed documents (with Visible property set to True) plus all their directly or
indirectly referenced documents.

All documents share the same common IDocument interface to deal with general use.
To reach their specific features, it is needed to perform a cast to another interface
(IDocumentDesign for DocumentDesign object, ...).

9
Welcome

Some TopSolid based application may not expose any extra interface to give access
to the specific features of the types of documents they support, in which case driving
them though Automation will be limited to what is available in IDocument.

Each Document, whatever its type is, contains at least one collection accessible
through the common IDocument interface : the Elements collection.

The Elements collection contains the actual elements that hold the specific model
representation of the document.

All elements share the same common IElement interface to deal with general use, to
reach their specific features, it is needed to perform a cast to another interface
(IParameter for a Parameter object, ...).

10
Welcome

Undocumented objects

If you scan all the available objects and interfaces of the API with some
development tools, you will see that there are more to it than what is currently
documented here.

You should not try and use these undocumented features, as they are only for
internal use, and may change or disappear without notice from one patch to another.

11
Welcome

Creation version

In most new releases of TopSolid, new objects, interfaces and methods or properties
are made available.

The version number in which the object/ interface/method/property has been


created is given at the top of its description page, like this:

Created: v<version>

Where <version> is the number of the version in which it has appeared for the first
time.

When running your program on an older version of TopSolid, it is your responsibility


to ensure that you are not going to access a resource that is not available on that
release.

To do so, the simplest way is to check for the version number of TopSolid at the
beginning of your program (ex: Checking for version).

Your program will not run correctly (i.e. crash at some point) on any TopSolid which
version number is lower than the highest creation deletion version number of the
resources you need to access.

12
Welcome

Modification version

In some releases of TopSolid, the implementation of objects, interfaces and methods


or properties may have to be modified, to take into account the change of behavior of
the product.

When this is the case, the version number in which the modification has occurred is
given at the top of the description page of the object/ interface/method/property, like
this:

Modified: v<version> (<description of modification>)

Where <version> is the number of the version in which the implementation has been
modified, and <description of modification> is a short description of the modification.

13
Welcome

Obsolescence version

In new releases of TopSolid, some objects, interfaces and methods or properties


may be replaced by new ones, and therefore become obsolete.

When this is the case, the version number in which the object/
interface/method/property has become obsolete is given at the top of its description
page, like this:

Obsolete: v<version> (superseded by: <link to replacement>)

Where <version> is the number of the version in which it has become obsolete, and
<link to replacement> is a link to the newer better choice (if there is any).

Although using these resources will still work, it is highly recommended not to use
them in a new program, or to shortly switch existing programs to the superseding
ones, because they may well be more efficient, or offer more flexibility.

Furthermore, obsolete resources have a tendency to be eventually removed from


the product at some time (see Deletion version), so it is good practice not to wait until
it is too late...

14
Welcome

Deletion version

In some releases of TopSolid, there may be previously implemented objects,


interfaces and methods or properties that will not be available anymore, because they
do not match the current capabilities of the product.

When this is the case, the version number in which the deletion occurred is given at
the top of the description page of the object/ interface/method/property, like this:

Deleted: v<version>

Where <version> is the number of the version in which the implementation has
disappeared.

When running your program on an newer version of TopSolid, it is your


responsibility to ensure that you are not going to access a resource that is not
available on that release.

To do so, the simplest way is to check for the version number of TopSolid at the
beginning of your program (ex: Checking for version).

Your program will not run correctly (i.e. crash at some point) on any TopSolid which
version number is greater or equal to the lowest deletion version number of any of the
resources you need to access.

As you do not know what is going to be deleted in future versions of TopSolid, it is


good practice not to allow the program to run on versions posterior to the one you
have used to develop it (as there is no deletion within patches, one should ignore the

15
Welcome

last three digits of the version number).

For instance, if you have developed a VB program using TopSolid v6.5.212, you
should not let it run on TopSolid versions posterior to v6.5, and enforce this rule by
checking the version right after connecting to TopSolid.

16
Welcome

Application

Object

Version : 6.5

Description :

This is TopSolid root object.

Interfaces

IApplication (default)

_IApplicationEvents (source).

17
Welcome

BOMProperty

Object

Version : 6.6

Description :

This object represents a bom property.

Interfaces

IBOMProperty (default)

18
Welcome

BOM

Object

Version : 6.6

Description :

This object represents a bom (bill of material).

Interfaces

IBOM (default)

19
Welcome

BOMLevel

Object

Version : 6.6

Description :

This object represents a bomlevel (for a multi-level bom).

Interfaces

IBOMLevel (default)

20
Welcome

Component

Object

Version : 6.5

Description :

This object represents the component.

Interfaces

IComponent (default)

IElement.

21
Welcome

ContextDesign

Object

Version : 6.5

Description :

This object represents the design context.

Interfaces

IContextDesign (default)

IContext.

22
Welcome

ContextDraft

Object

Version : 6.5

Description :

This object represents the draft context.

Interfaces

IContextDraft (default)

IContext.

23
Welcome

CoordinateSystem

Object

Version : 6.5

Description :

This object represents the coordinate system element.

Interfaces

ICoordinateSystem (default)

IElement.

24
Welcome

Curve

Object

Version : 6.5

Description :

This object represents the curve element.

Interfaces

ICurve (default)

IElement.

25
Welcome

Dimension

Object

Version : 6.6

Description :

This object represents the dimension.

Interfaces

IDimension (default)

IElement.

26
Welcome

DocumentDesign

Object

Version : 6.5

Description :

This object represents a design document (a ".top" file).

Interfaces

IDocumentDesign (default)

IDocument

_IDocumentDesignEvents (source)

27
Welcome

DocumentDraft

Object

Version : 6.5

Description :

This object represents a draft document (a ".dft" file).

Interfaces

IDocumentDraft (default)

IDocument

_IDocumentDraftEvents (source)

28
Welcome

Drawing

Object

Version : 6.5

Description :

This object represents the drawing element.

Interfaces

IDrawing (default)

IElement

29
Welcome

Parameter

Object

Version : 6.5

Description :

This object represents the parameter element.

Interfaces

IParameter (default)

IElement

30
Welcome

Point

Object

Version : 6.5

Description :

This object represents the point element.

Interfaces

IPoint (default)

IElement

31
Welcome

RefAxis

Object

Version : 6.5

Description :

This object represents a reference to an axis.

Interfaces

IRefAxis (default)

IRef

32
Welcome

RefDirection

Object

Version : 6.5

Description :

This object represents a reference to an direction.

Interfaces

IRefDirection (default)

IRef

33
Welcome

RefEdge

Object

Version : 6.5

Description :

This object represents a reference to an edge.

Interfaces

IRefEdge (default)

IRef

34
Welcome

RefFace

Object

Version : 6.5

Description :

This object represents a reference to a face.

Interfaces

IRefFace (default)

IRef

35
Welcome

RefPlane

Object

Version : 6.5

Description :

This object represents a reference to a plane.

Interfaces

IRefPlane (default)

IRef

36
Welcome

RefSegment

Object

Version : 6.5

Description :

This object represents a reference to a curve segment.

Interfaces

IRefSegment default)

IRef

37
Welcome

Set

Object

Version : 6.5

Description :

This object represents the set element.

Interfaces

ISet (default)

IElement

38
Welcome

Shape

Object

Version : 6.5

Description :

This object represents the shape element.

Interfaces

IShape (default)

IElement

39
Welcome

ShapeOperation

Object

Version : 6.5

Description :

This object represents the shape operation element.

Interfaces

IShapeOperation (default)

IShape

IElement

40
Welcome

ShapePart

Object

Version : 6.5

Description :

This object represents the part element.

Interfaces

IShapePart (default)

IShape

IElement

41
Welcome

Text

Object

Version : 6.5

Description :

This object represents the text element.

Interfaces

IText (default)

IElement

42
Welcome

IApplication

Interface

Version : 6.5

Description :

This interface gives access to all TopSolid internal objects.

43
Welcome

ActiveDocument

Property

Version : 6.5

Description :

This property gives the active document.

Use

IDocument = IApplication.ActiveDocument

Remarks

The active document is the document having the focus, its title bar is in a different
color, and it is displayed on top of all the other documents.

Usually, the active document is also current (see: CurrentDocument).

If there is no active document (for example when there is not any document loaded),
its value is Nothing.

44
Welcome

Application

Property

Version : 6.5

Description :

This property gives access to the application.

Use

IApplication = IApplication.Application

45
Welcome

Asks

Property

Version : 6.5

Description :

This property gives access to methods allowing to ask the user for some information
using TopSolid dialog bar.

Use

IAsks = IApplication.Asks

Remarks

In particular, it will be possible to query for points, edges, faces, and so on...

46
Welcome

Contexts

Property

Version : 6.5

Description :

This property gives access to the collection of available contexts.

Use

IContexts = IApplication.Contexts

47
Welcome

CurrentDocument

Property

Version : 6.5

Description :

This property gives the current document.

Use

IDocument = IApplication.CurrentDocument

Remarks

The current document is the document where the elements are created, its title bar
contains the word "<<current>>".

Usually, the current document is also active (see: ActiveDocument).

If there is no current document (for example when there is not any document
loaded), its value is Nothing.

48
Welcome

DefaultPrinterName

Property

Version : 6.6

Description :

This property allows to get and set the default printer used for printing documents.

Use

String = IApplication.DefaultPrinterName

IApplication.DefaultPrinterName= String

49
Welcome

Documents

Property

Version : 6.5

Description :

This property gives access to the collection of documents loaded by TopSolid.

Use

IDocuments = IApplication.Documents

50
Welcome

ExecuteMacro

Method

Version : 6.5

Description :

This method executes a LIP macro.

Use

IApplication.ExecuteMacro(Name)

Parameters

Full name (including the path and the ".lob"


IN String Name
extension) of the LIP macro file.

51
Welcome

ExecuteMacroKeepStack

Method

Version : 6.7

Description :

This method executes a macro with keeping the stack.

Use

IApplication.ExecuteMacroKeepStack(LipPath)

Parameters

IN String LipPath Path of the lip macro to execute.

52
Welcome

Extensions

Property

Version : 6.5

Description :

This property gives access to the collection of extensions loaded by TopSolid.

Use

IExtensions = IApplication.Extensions

53
Welcome

FullName

Property

Version : 6.5

Description :

This property gives the full path of the TopSolid executable, for example:
"C:\Missler\v67\bin\top67.exe".

Use

String = IApplication.FullName

54
Welcome

GetDoubleFromStack

Method

Version : 6.7

Description :

This method gets a double from the lip stack.

Use

Value = IApplication.GetDoubleFromStack

Parameters

RET Double Value Double from the stack.

55
Welcome

GetElementFromStack

Method

Version : 6.7

Description :

This method gets an element from the lip stack.

Use

Value = IApplication.GetElementFromStack

Parameters

RET Element Value Element from the stack.

56
Welcome

GetExportOption

Method

Version : 6.5

Description :

This method gets the value of an option of one of the available export translators.

Use

String = IApplication.GetExportOption(Extension, Name)

Parameters

Extension of files managed by the


IN String Extension
translator.
IN String Name Name of the option to get.
RET String Option current value.

Remarks

See IApplication.SetExportOption for the list of supported options.

Example

57
Welcome

Dim value As String

value = App.GetExportOption("dxf", "Unit")

58
Welcome

GetImportOption

Method

Version : 6.5

Description :

This method gets the value of an option of one of the available import translators.

Use

String = IApplication.GetImportOption(Extension, Name)

Parameters

Extension of files managed by the


IN String Extension
translator.
IN String Name Name of the option to get.
RET String Option current value.

Remarks

See IApplication.SetImportOption for the list of supported options.

Example

59
Welcome

Dim value As String

value = App.GetImportOption("dxf", "Unit")

60
Welcome

GetIntegerFromStack

Method

Version : 6.7

Description :

This method gets an integer from the lip stack.

Use

Value = IApplication.GetIntegerFromStack

Parameters

RET Integer Value Integer from the stack.

61
Welcome

GetInterfaceExportOption

Method

Version : 6.5

Description :

This method gets the value of an option of the specified interface provided.

Use

String = IApplication.GetInterfaceExportOption(InterfaceProvider, Name)

Parameters

Interface provider. See


IN String InterfaceProvider
InterfaceProviders to have the list..
IN String Name Name of the option to get.
RET String Option current value.

Remarks

See IApplication.SetImportOption for the list of supported options.

62
Welcome

GetInterfaceImportOption

Method

Version : 6.5

Description :

This method gets the value of an option of the specified interface provided.

Use

String = IApplication.GetInterfaceImportOption(InterfaceProvider, Name)

Parameters

Interface provider. See


IN String InterfaceProvider
InterfaceProviders to have the list..
IN String Name Name of the option to get.
RET String Option current value.

Remarks

See IApplication.SetImportOption for the list of supported options.

63
Welcome

GetReferencedDocuments

Method

Version : 6.6

Description :

This method gets all referenced document for file.

Use

IApplication.GetReferencedDocuments(DocPath)

Parameters

IN String DocPath Path of document to analyze.


RET Variant (strings) List of referenced file paths.

64
Welcome

GetStringFromStack

Method

Version : 6.7

Description :

This method gets a string from the lip stack.

Use

Value = IApplication.GetStringFromStack

Parameters

RET String Value String from the stack.

65
Welcome

GetTranslatorInfo

Method

Version : 6.6

Description :

This method gets some info about a translator.

Use

IApplication.GetTranslatorInfo(Index, Import, Export, Extension)

Parameters

Translator index, in [1,


IN Long index
TranslatorsCount]
OUT Boolean Import Translator is capable of import.
OUT Boolean Export Translator is capable of export..
Extension of files managed by the
OUT String Extension
translator.

Remarks

If the translator manages files with several extensions, this method returns the first
one of the list displayed in the TopSolid "Save As" or "Open" dialog box.

66
Welcome

InterfaceProviders

Property

Version : 6.7

Description :

This method allows to get all TopSolid interface providers to a given suffix.

Use

Interfaces = IApplication.InterfaceProviders(Suffix, IsImport)

Parameters

IN String Suffix Suffix of the wanted interfaces.


IN Boolean IsImport True if we want importing interfaces.
List of corresponding interfaces
RET Variant Interfaces
(strings).

67
Welcome

MainWindow

Property

Version : 6.6

Description :

This property gives the handle number of the application : "TopSolid".

Use

Long = IApplication.MainWindow

68
Welcome

Message

Method

Version : 6.7

Description :

This method displays a message box.

Use

Answer = IApplication.Message(Title, Text, ButtonStyle, ButtonIcon, Beep)

Parameters

IN String Title Title of the message box.


IN String Text Text of the message box.
TopMessageButton
IN Buttons to be displayed.
ButtonStyle
TopMessageIcon
IN Icon to be displayed.
IconStyle
IN Boolean Beep Beep or not.
TopMessageAnswer
RET Button clicked by the user.
Answer

69
Welcome

MoveDocumentsAndReferences

Method

Version : 6.6

Description :

This method moves list of documents and change each document references that point
to document of list.

Use

IApplication.MoveDocumentsAndReferences(DocPath)

Parameters

IN Variant (strings) Source file paths to change.


IN Variant (strings) Destination file paths..

70
Welcome

Name

Property

Version : 6.5

Description :

This property gives the name of the application : "TopSolid".

Use

String = IApplication.Name

71
Welcome

Path

Property

Version : 6.5

Description :

This property gives the path to the TopSolid executable, for example:
"C:\Missler\v67\bin".

Use

String = IApplication.Path

72
Welcome

PrintBorder

Property

Version : 6.5

Description :

When this property is True, borders are drawn on the paper when printing a 3D
document..

Use

Boolean = IApplication.PrintBorder

IApplication.PrintBorder= Boolean

73
Welcome

PrintShaded

Property

Version : 6.5

Description :

When this property is False, shaded views of 3D documents are printed in wire frame
mode.

Use

Boolean = IApplication.PrintShaded

IApplication.PrintShaded= Boolean

74
Welcome

ProgramUnitAngle

Property

Version : 6.5

Description :

This property allows to get and set the angle unit used by the API.

Use

String = IApplication.ProgramUnitAngle

IApplication.ProgramUnitAngle = String

Remarks

The angle unit is defined by its symbol : "°" for degrees, "rad" for radians, ...

The list of all supported angle units is displayed in the "Angle" combo box of the
"Units" tab of TopSolid "File | Properties" panel.

When TopSolid is first started, the program angle unit is set to "°".

See also

75
Welcome

Program units.

Example

Setting program units.

76
Welcome

ProgramUnitLength

Property

Version : 6.5

Description :

This property allows to get and set the length unit used by the API.

Use

String = IApplication.ProgramUnitLength

IApplication.ProgramUnitLength = String

Remarks

The length unit is defined by its symbol : "mm" for millimeters, "m" for meters, "in"
for inches, ...

The list of all supported length units is displayed in the "Length" combo box of the
"Units" tab of TopSolid "File | Properties" panel.

When TopSolid is first started, the program length unit is set to "m".

See also

77
Welcome

Program units, Coordinates.

Example

Setting program units.

78
Welcome

PushDoubleOnStack

Method

Version : 6.7

Description :

This method pushes a double on the lip stack.

Use

IApplication.PushDoubleOnStack(Value)

Parameters

IN Double Value Double to push on the stack.

79
Welcome

PushElementOnStack

Method

Version : 6.7

Description :

This method pushes an element on the lip stack.

Use

IApplication.PushElementOnStack(Value)

Parameters

IN IElement Value Element to push on the stack.

80
Welcome

PushIntegerOnStack

Method

Version : 6.7

Description :

This method pushes an integer on the lip stack.

Use

IApplication.PushIntegerOnStack(Value)

Parameters

IN Integer Value Integer to push on the stack.

81
Welcome

PushStringOnStack

Method

Version : 6.7

Description :

This method pushes a string on the lip stack.

Use

IApplication.PushStringOnStack(Value)

Parameters

IN String Value String to push on the stack.

82
Welcome

Quit

Method

Version : 6.5

Description :

This method terminates TopSolid.

Use

IApplication.Quit

Remarks

The method prompts the user to save documents that have changed before shutting
down TopSolid.

83
Welcome

Regenerate

Method

Version : 6.6

Description :

This method regenerates all opened documents in TopSolid.

Use

IApplication.Regenerate(AskReadWrite)

Parameters

Prompt on read only file and ask to


IN Boolean AskReadWrite
change to read write mode.

84
Welcome

SetExportOption

Method

Version : 6.5

Description :

This method allows to customize the behavior of the export translators, by setting the
value of one of the available options.

Use

IApplication.SetExportOption(Extension, Name, Value)

Parameters

Extension of files managed by the


IN String Extension
translator.
IN String Name Name of the option to get.
IN String Value Option new value.

Remarks

The following options may be set (see TopSolid on-line help for options meaning) :

AutoCAD (dxf, dwg) :

85
Welcome

format : "dxf", "dwg", "binary dxf".

unit : "mm", "cm", "m", "km", "µm", "ft", "in", "mil", "mile", "µin".

version : "2.5", "2.6", "9", "10", "11", "12", "13", "14", "2000".

Example

App.SetExportOption("dxf", "unit", "mm")

86
Welcome

SetImportOption

Method

Version : 6.5

Description :

This method allows to customize the behavior of the import translators, by setting the
value of one of the available options.

Use

IApplication.SetImportOption(Extension, Name, Value)

Parameters

Extension of files managed by the


IN String Extension
translator.
IN String Name Name of the option to get.
IN String Value Option new value.

Remarks

The following options may be set (see TopSolid on-line help for options meaning) :

AutoCAD (dxf, dwg) :

87
Welcome

unit : "mm", "cm", "m", "km", "µm", "ft", "in", "mil", "mile", "µin", "auto".

standard : "iso", "afnor", "ansi", "jis", "din", "auto".

Example

App.SetImportOption("dxf", "unit", "mm")

88
Welcome

SetInterfaceExportOption

Method

Version : 6.5

Description :

This method sets the value of an option of the specified interface provided.

Use

IApplication.SetInterfaceExportOption(InterfaceProvider, Name, Value)

Parameters

Interface provider. See


IN String InterfaceProvider
InterfaceProviders to have the list..
IN String Name Name of the option to get.
IN String Value Option new value.

Remarks

See IApplication.SetImportOption for the list of supported options.

89
Welcome

SetInterfaceImportOption

Method

Version : 6.5

Description :

This method sets the value of an option of the specified interface provided.

Use

IApplication.GetInterfaceImportOption(InterfaceProvider, Name, Value)

Parameters

Interface provider. See


IN String InterfaceProvider
InterfaceProviders to have the list..
IN String Name Name of the option to get.
IN String Value Option new value.

Remarks

See IApplication.SetImportOption for the list of supported options.

90
Welcome

Synchronize

Method

Version : 6.5

Description :

This method synchronizes TopSolid after one or several calls to the Automation API.

Use

IApplication.Synchronize

Remarks

In particular, newly created elements will be displayed, and existing ones will be
updated to take into account the modifications.

There is no need for calling this method if SynchronizeAuto is True.

91
Welcome

SynchronizeAuto

Property

Version : 6.5

Description :

If this property is True, then TopSolid will update after every call to the Automation
API, otherwise, it will be necessary to call the Synchronize method to do so.

Use

Boolean = IApplication.SynchronizeAuto

IApplication.SynchronizeAuto= Boolean

Remarks

When TopSolid is started, this property is initially set to True.

92
Welcome

TileTwoDocuments

Property

Version : 6.7

Description :

This method allows to see two documents side to side in TopSolid.

Use

IApplication.TileTwoDocuments(Document1, Document2, Vertically)

Parameters

IN IDocument *Document1 First document to tile.


IN IDocument *Document1 Second document to tile.
True if documents will be tile
IN Boolean Vertically
vertically.

93
Welcome

TranslatorsCount

Property

Version : 6.5

Description :

This property gives the number of available translators.

Use

Long = IApplication.TranslatorsCount

94
Welcome

Version

Property

Version : 6.5

Description :

This property gives the version of TopSolid.

Use

Long = IApplication.Version

Remarks

TopSolid version may be found interactively in the "About TopSolid..." box of the
Help menu, and is expressed with three numbers : " v<major>.<minor>.<build>".

The value of the Version property is defined as : <major> * 100000 + <minor> *


1000 + <build>.

For example, for TopSolid v6.4.243, the property value would be 604243.

It is important to check for TopSolid version at the start of the Automation program.

It is your responsibility to ensure that you are not going to access a resource that is
not available on the TopSolid release your are running.

95
Welcome

See also

Creation version, Modification version, Obsolescence version, Deletion version.

Example

Checking for version.

96
Welcome

Visible

Property

Version : 6.5

Description :

This property is True when TopSolid application window is visible.

Use

Boolean = IApplication.Visible

IApplication.Visible = Boolean

Remarks

When TopSolid is started by Automation, the application window is initially


invisible, and may be made visible by setting this property to True if required.

Setting this property to False, will make the application window invisible, even is
TopSolid was not started by Automation.

97
Welcome

_IApplicationEvents

Interface

Version : 6.5

Description :

This interface allows to receive TopSolid application events.

98
Welcome

NotifyAboutToQuit

Event

Version : 6.5

Description :

This event notifies that TopSolid is about to terminate.

Use

_IApplicationEvents.NotifyAboutToQuit(Cancel)

Parameters

INOUT Boolean *Cancel Set to true to cancel TopSolid termination.

99
Welcome

NotifyAfterDocumentSave

Event

Version : 6.6

Description :

This event notifies that the document has been saved.

Use

_IApplicationEvents.NotifyAfterDocumentSave(Document)

Parameters

IN IDocument *Document Set to true to cancel TopSolid termination.

100
Welcome

NotifyAfterDocumentUpdate

Event

Version : 6.6

Description :

This event notifies that the document has been updated (after loading).

Use

_IApplicationEvents.NotifyAfterDocumentUpdate(Document)

Parameters

The document which has been


IN IDocument *Document
updated.

101
Welcome

NotifyBeforeDocIndexModification

Event

Version : 6.7

Description :

This event notifies that the index of the document is going to be modified.

Use

_IApplicationEvents.NotifyBeforeDocIndexModification(Document, Cancel)

Parameters

The document which has been


IN IDocument *Document
updated.
Set to true to cancel the
INOUT Boolean *Cancel
modification.

102
Welcome

NotifyBeforeDocumentClose

Event

Version : 6.6

Description :

This event notifies that the document is about to be closed.

Use

_IApplicationEvents.NotifyBeforeDocumentClose(Document, Cancel)

Parameters

The document which is about to be


IN IDocument *Document
closed.
Set to true to cancel the document
INOUT Boolean *Cancel
close.

103
Welcome

NotifyBeforeDocumentLoad

Event

Version : 6.6

Description :

This event notifies that the document is about to be loaded.

Use

_IApplicationEvents.NotifyBeforeDocumentLoad(TypeNotify, Path, Readonlyfile)

Parameters

Type of reaction (browse


TopBoxNotify TopSolidBox, another box or
INOUT
*TypeNotifye none).he document which is about to
be closed.
INOUT String *Path Path of the document to load.
Set to true to open the document in
INOUT Boolean *Readonlyfile
readonly mode.

104
Welcome

NotifyBeforeDocumentModification

Event

Version : 6.6

Description :

This event notifies that the document is about to be modified.

Use

_IApplicationEvents.NotifyBeforeDocumentModification(Document, Cancel)

Parameters

The document which is about to be


IN IDocument *Document
modified.
Set to true to cancel the document
INOUT Boolean *Cancel
modification.

105
Welcome

NotifyBeforeDocumentSave

Event

Version : 6.6

Description :

This event notifies that the document is about to be saved.

Use

_IApplicationEvents.NotifyBeforeDocumentSave(Document, Cancel)

Parameters

The document which is about to be


IN IDocument *Document
saved.
Set to true to cancel the document
INOUT Boolean *Cancel
saving.

106
Welcome

NotifyBeforeDocumentUpdate

Event

Version : 6.6

Description :

This event notifies that the document is about to be updated (on document loading).

Use

_IApplicationEvents.NotifyBeforeDocumentUpdate(l)

107
Welcome

NotifyBrowseForInsertPart

Event

Version : 6.6

Description :

This event notifies that the document is about to be saved.

Use

_IApplicationEvents.NotifyBrowseForInsertPart(TypeNotify, Path)

Parameters

TopBoxNotify Type of reaction (browse


INOUT
*TypeNotify TopSolidBox, another box or none).
Path of the part to insert (if another
INOUT String *Path
box is choosen).

108
Welcome

NotifyCurrentDocumentHasChanged

Event

Version : 6.5

Description :

This event notifies that the current document has been changed.

Use

_IApplicationEvents.NotifyCurrentDocumentHasChanged()

109
Welcome

NotifyDocumentPasswordsAsked

Event

Version : 6.7

Description :

This event notifies that passwords for the loaded document are asked..

Use

_IApplicationEvents.NotifyPasswordsAsked(Document, WritePassword,
ReadPassword)

Parameters

The document concerned by the


IN IDocument *Document
passwords.
INOUT String *WritePassword Password for write right.
INOUT String *ReadPassword Password for read right.

110
Welcome

NotifyQuit

Event

Version : 6.5

Description :

This event notifies that TopSolid has terminated..

Use

_IApplicationEvents.NotifyQuit()

111
Welcome

IAsks

Interface

Version : 6.5

Description :

This interface contains methods allowing to ask the user for some information using
TopSolid dialog bar.

Remarks

The Ask* methods display a question in the usual TopSolid way, and wait for an
answer from the user, which is returned once entered.

The message displayed in the dialog bar is defined with the Question property,
which must be set before calling the Ask* methods.

The Ask* methods usually return the type of answer given by the user (a
TopAskAnswer value).

If something went wrong (for example the user has interrupted the function by
pressing escape), the value topAskAnswerNothing is returned.

112
Welcome

Ask

Method

Version : 6.5

Description :

This method asks a question to the user.

Use

TopAskAnswer = IAsks.Ask

Parameters

Type of answer received from the


RET TopAskAnswer
user.

113
Welcome

AskEdge

Method

Version : 6.5

Description :

This method asks the user to pick an edge.

Use

TopAskAnswer = IAsks.AskEdge(Edge)

Parameters

OUT IRefEdge Edge Edge picked, or Nothing if none.


Type of answer received from the
RET TopAskAnswer
user.

114
Welcome

AskElement

Method

Version : 6.5

Description :

This method asks the user to pick an element.

Use

TopAskAnswer = IAsks.AskElement(Element)

Parameters

OUT IElement Element Element picked, or Nothing if none..


Type of answer received from the
RET TopAskAnswer
user.

115
Welcome

AskFace

Method

Version : 6.5

Description :

This method asks the user to pick a face.

Use

TopAskAnswer = IAsks.AskFace(Face)

Parameters

OUT IRefFace Face Face picked, or Nothing if none..


Type of answer received from the
RET TopAskAnswer
user.

116
Welcome

AskParameter

Method

Version : 6.5

Description :

This method asks the user to enter or pick a parameter element.

Use

TopAskAnswer = IAsks.AskParameter(Parameter)

Parameters

Parameter element entered or


OUT IParameter Parameter
picked, or Nothing if none.
Type of answer received from the
RET TopAskAnswer
user.

117
Welcome

AskPoint

Method

Version : 6.5

Description :

This method asks the user to pick a point element.

Use

TopAskAnswer = IAsks.Askpoint(Point)

Parameters

OUT IPoint Point Point picked, or Nothing if none.


Type of answer received from the
RET TopAskAnswer
user.

118
Welcome

Button

Property

Version : 6.5

Description :

This property gives the number of the Question button clicked by the user, in the case
of an answer of type topAskAnswerButton.

Use

Long = IAsks.Button

Remarks

The first button from the left is number 1, and the following ones are obviously 2, 3,
...

119
Welcome

Question

Property

Version : 6.5

Description :

This property contains the message displayed in the dialog bar when a Ask method is
called.

Use

String = IAsks.Question

IAsks.Question = String

Remarks

The Question string may contain one or more buttons, defined by one or more
characters inside a pair of '{' '}' characters (ex: Question = "{STOP}{ALL EDGES}
Edge to copy:").

If one of these buttons are clicked by the user, the Ask method will return the value
topAskAnswerButton, and the number of the button clicked will be stored the Button
property.

120
Welcome

IBOM

Interface

Version : 6.6

Description :

This interface is implemented in every kind of BOM, and gives access to its features.

121
Welcome

ColumnsNumber

Property

Version : 6.6

Description :

This property gives the number of columns (BOM properties) in this BOM.

Use

Long = IBOM.ColumnsNumber

122
Welcome

ColumnsTitle

Property

Version : 6.6

Description :

This property allows to get the titles of each BOM property of the BOM (1 <= Index
<= ColumnsNumber).

Use

String = IBOM.ColumnTitle(Variant Index)

123
Welcome

SubLevels

Property

Version : 6.6

Description :

This property gives access to the BOM levels of the BOM.

124
Welcome

IBOMLevel

Interface

Version : 6.6

Description :

This interface is implemented in every kind of BOM levels, and gives access to the
features that are common to all of them.

125
Welcome

Element

Property

Version : 6.6

Description :

This property gives access to the IElement interface of the BOMLevel object.

Remarks

This may me useful to simplify VB code for accessing to the methods/properties of


the base interface (see: Multiple interfaces)

126
Welcome

ElementCount

Property

Version : 6.6

Description :

This property gives the number of element of this level.

Use

Long = IBOMLevel.ElementCount

Parameters

RET Long Element count.

127
Welcome

ElementDesignation

Property

Version : 6.7

Description :

This property gives the designation of the element of this level.

Use

String = IBOMLevel.ElementDesignation

Parameters

RET String Element designation.

128
Welcome

ElementReference

Property

Version : 6.7

Description :

This property gives the reference of the element of this level.

Use

String = IBOMLevel.ElementReference

Parameters

RET String Element reference.

129
Welcome

GetShapes

Method

Version : 6.6

Description :

This method gets the shapes of the BOMLevel.

Use

Variant = IBOMLevel.GetShapes

Parameters

Array of the shapes (IShape) (0 to


OUT Variant Shapes (array)
UBound)

Remarks

With this method you can get the shapes of the BOMLEvel. The return value is an
array of IShape.

Example

130
Welcome

Dim TopShapes As Variant

Dim TopShape As TopSolid.IShape

Dim ShapeCount As Long

Dim i As Long

TopShapes = TopBomLevel.GetShapes

ShapeCount = UBound (TopShapes, 1)

For i = 0 To ShapeCount

Set TopShape = TopShapes(i)

...

Next i

131
Welcome

Properties

Property

Version : 6.6

Description :

This property gives access to the BOM properties of the BOM level.

Use

IBOMProperties = IBOMLevel.Properties

132
Welcome

SubLevels

Property

Version : 6.6

Description :

This property gives access to the BOM levels of the BOM level.

Use

IBOMLevels = IBOMLevel.SubLevels

133
Welcome

IBOMLevels

Interface

Version : 6.6

Description :

This interface is a collection that allows to scan through the BOM levels of a BOM or
of a BOM level.

134
Welcome

Count

Property

Version : 6.6

Description :

This property allows to get the number of BOM levels in collection.

Use

Integer = IBOMLevels.Count

135
Welcome

Item

Property

Version : 6.6

Description :

This property allows to get a BOM level of the collection (1 <= Index <= Count).

Use

IBOMLevel = IBOMLevels.Item(Variant Index)

136
Welcome

IBOMProperties

Interface

Version : 6.6

Description :

This interface is a collection that allows to scan through the BOM properties of a BOM
level.

137
Welcome

Count

Property

Version : 6.6

Description :

This property allows to get the number of BOM properties in collection.

Use

Integer = IBOMProperties.Count

138
Welcome

Item

Property

Version : 6.6

Description :

This property allows to get a BOM property of the collection (1 <= Index <= Count).

Use

IBOMProperty = IBOMProperties.Item(Variant Index)

139
Welcome

IBOMProperty

Interface

Version : 6.6

Description :

This interface is implemented in every kind of BOM properties, and gives access to the
features that are common to all of them.

140
Welcome

Value

Property

Version : 6.6

Description :

This property gives access to the value of the BOM property.

Use

String = IBOMProperty.Value

141
Welcome

ValueType

Property

Version : 6.6

Description :

This property gives access to the type of the value of the BOM property.

Use

TopBomPropType = IBOMProperty.ValueType

142
Welcome

IComponent

Interface

Version : 6.5

Description :

This interface is implemented in every kind of components elements, and gives access
to the features that are common to all of them.

143
Welcome

Code

Property

Version : 6.6

Description :

This property allows to get or set the code of the component.

Use

String = IComponent.Code

IComponent.Code= String

Remarks

If the element has no code, an empty string is returned.

144
Welcome

Element

Property

Version : 6.5

Description :

This property gives access to the IElement interface of the Component object.

Use

IElement = IComponent.Element

Remarks

This may me useful to simplify VB code for accessing to the methods/properties of


the base interface (see: Multiple interfaces).

145
Welcome

IsGeneric

Property

Version : 6.5

Description :

This property is True when the component is generic.

Use

Boolean = IComponent.IsGeneric

Remarks

A component is generic when it is defined with a catalog code or one or more


drivers.

When a component is generic, the occurrence of the component in the assembly is


different from the definition of the component in the template document.

146
Welcome

IsLocallyModified

Property

Version : 6.5

Description :

This property is True when the component is locally modified in the assembly.

Use

Boolean = IComponent.IsLocallyModified

Remarks

This happens when the geometry of one or several of its shapes/curves has been
altered with a modeling operation in the assembly (fillet, trim, ...).

147
Welcome

IsStandard

Property

Version : 6.5

Description :

This property is True when the component is a standard component.

Use

Boolean = IComponent.IsLocallyModified

148
Welcome

Move

Method

Version : 6.5

Description :

This method moves the component.

Use

IComponent.Move(Tx, Ty, Tz)

Parameters

X coordinate of the translation


IN Double Tx
vector.
Y coordinate of the translation
IN Double Ty
vector.
Z coordinate of the translation
IN Double Tz
vector.

Remarks

The translation must not conflict with the component positioning constraints.

149
Welcome

Rotate

Method

Version : 6.5

Description :

This method rotates the component.

Use

IComponent.Rotate(Ox, Oy, Oz, Dx, Dy, Dz, Angle)

Parameters

IN Double Ox X coordinate of rotation axis origin.


IN Double Oy Y coordinate of rotation axis origin.
IN Double Oz Z coordinate of rotation axis origin.
X coordinate of rotation axis
IN Double Dx
direction.
Y coordinate of rotation axis
IN Double Dy
direction.
Z coordinate of rotation axis
IN Double Dz
direction.
Rotation angle in angle program
IN Double Angle
units.

Remarks

150
Welcome

The rotation must not conflict with the component positioning constraints.

151
Welcome

TemplateDocument

Property

Version : 6.5

Description :

This property gives access to the component template document.

Use

IDocument = IComponent.TemplateDocument

152
Welcome

Variant

Property

Version : 6.5

Description :

This property allows to get or set the variant of the component.

Use

String = IComponent.Variant

IComponent.Variant= String

Remarks

If the element has no variant, an empty string is returned.

153
Welcome

IComponents interface

Interface

Version : 6.5

Description :

This interface is a collection that allows to scan through the components of the
document, and to create new components with the Add* methods.

154
Welcome

Add

Method

Version : 6.5

Description :

This method creates a component.

Use

IComponent = IComponent.Add(Name, Ox, Oy, Oz)

Parameters

Name of the component template


IN String Name
document.
IN Double Ox X coordinate of component origin.
IN Double Oy Y coordinate of component origin.
IN Double Oz Z coordinate of component origin.
RET IComponent Created component.

Remarks

The created component is not automatically added to the assembly, if this is


required, this must be done using IDocumentDesign.Assembly.Elements.Add().

155
Welcome

Example

Creating a component.

156
Welcome

AddStandard

Method

Version : 6.5

Description :

This method creates a standard component.

Use

IComponent = IComponent.AddStandard(Standard, Family, Type, Variant, Version,


Repres, Code, Ox, Oy, Oz)

Parameters

IN String Standard Standard of the component.


IN String Family Family of the component.
IN String Type Type of the component.
IN String Variant Variant of the component.
Version of the component, or empty
IN String Version
string for latest.
Representation of the component, or
IN String Repres
empty string for normal.
IN String Code Code of the component.
IN Double Ox X coordinate of component origin.
IN Double Oy Y coordinate of component origin.
IN Double Oz Z coordinate of component origin.
RET IComponent Created component.

157
Welcome

Remarks

The created component is not automatically added to the assembly, if this is


required, this must be done using IDocumentDesign.Assembly.Elements.Add().

Example

Creating a standard component.

158
Welcome

AddStandardWithPositioningByCoordinateSystems

Method

Version : 6.5

Description :

This method creates a standard component with a coordinate system positioning.

Use

IComponent =
IComponent.AddStandardWithPositioningByCoordinateSystems(Standard, Family,
Type, Variant, Version, Repres, Code, Origin, Destination)

Parameters

IN String Standard Standard of the component.


IN String Family Family of the component.
IN String Type Type of the component.
IN String Variant Variant of the component.
Version of the component, or empty
IN String Version
string for latest.
Representation of the component, or
IN String Repres
empty string for normal.
IN String Code Code of the component.
Name of the origin coordinate system
in the component template
IN String Origin
document, or empty string for
absolute coordinate system.
IN ICoordinateSystem Destination coordinate system.
Destination

159
Welcome

RET IComponent Created component.

Remarks

The created component is not automatically added to the assembly, if this is


required, this must be done using IDocumentDesign.Assembly.Elements.Add().

160
Welcome

AddWithPositioningByCoordinateSystems

Method

Version : 6.5

Description :

This method creates a component with a coordinate system positioning.

Use

IComponent = IComponent.AddWithPositioningByCoordinateSystems(Name, Origin,


Destination)

Parameters

Name of the component template


IN String Name
document.
Name of the origin coordinate system
in the component template
IN String Origin
document, or empty string for
absolute coordinate system.
ICoordinateSystem
IN Destination coordinate system.
Destination
RET IComponent Created component.

Remarks

161
Welcome

The created component is not automatically added to the assembly, if this is


required, this must be done using IDocumentDesign.Assembly.Elements.Add().

162
Welcome

Count

Method

Version : 6.5

Description :

This property allows to get the number of components in the collection.

Use

Integer = IComponents.Count

163
Welcome

Item

Method

Version : 6.5

Description :

This property allows to get a component of the collection (1 <= Index <= Count).

Use

IComponent = IComponents.Item(Variant Index)

164
Welcome

IContext

Interface

Version : 6.5

Description :

This interface is implemented in every kind of context objects (see: ContextDesign,


ContextDraft), and gives access to the features that are common to all of them.

165
Welcome

Application

Method

Version : 6.5

Description :

This property gives access to the application.

Use

IApplication = IContext.Application

166
Welcome

Name

Property

Version : 6.5

Description :

This property gives the name of the context.

Use

String = IContext.Name

Remarks

By convention, the name of the context is made of the name of the type library
where it has been defined, followed by the name of the context object, separated by a
dot.

For instance, the names of the standard ContextDesign and ContextDraft are :
"TopSolid.ContextDesign" and "TopSolid.ContextDraft".

167
Welcome

Version

Property

Version : 6.5

Description :

This property gives the version of the TopSolid based application managing the
context.

Use

Long= IContext.Version

Remarks

For the standard TopSolid contexts (ContextDesign and ContextDraft), this property
is equal to the Version property of the Application object (see: IApplication.Version).

168
Welcome

IContextDesign

Interface

Version : 6.5

Description :

This interface is implemented in the ContextDesign object, and gives access to the
specific features of this kind of context (the common features being accessed through
the IContext interface).

169
Welcome

CreateDocument

Method

Version : 6.5

Description :

This method creates a new design document.

Use

IDocumentDesign = IContextDesign.CreateDocument(Mode, Metric, Standard)

Parameters

IN TopDesignMode Mode Design mode.


IN Boolean Metric Use metric units.
IN TopStandard Standard Standard to use.
RET IDocumentDesign Document created.

Remarks

The document created is automatically made visible.

Example

170
Welcome

Creating new design document.

171
Welcome

IContextDraft

Interface

Version : 6.5

Description :

This interface is implemented in the ContextDraft object, and gives access to the
specific features of this kind of context (the common features being accessed through
the IContext interface).

172
Welcome

CreateDocument

Method

Version : 6.5

Description :

This method creates a new draft document.

Use

IDocumentDraft = IContextDraft.CreateDocument(Mode, Metric, Standard, Format,


Scale)

Parameters

IN TopDesignMode Mode Design mode.


IN Boolean Metric Use metric units.
IN TopStandard Standard Standard to use.
IN TopPaperFormat Format Paper format to use.
IN Double Scale Scale factor (optional, default = 1).
RET IDocumentDesign Document created.

Remarks

The document created is automatically made visible.

173
Welcome

Example

Creating new design document.

174
Welcome

IContexts

Interface

Version : 6.5

Description :

This interface gives access to the collection of the available contexts.

Remarks

There is one context per type of document supported.

The context allows controlling the behavior of the management of this particular
type of document, it is also used to create new documents of this type with specific
arguments (unlike with the Add method of the Documents collection).

There are at least two contexts available : ContextDesign for managing design
documents, and ContextDraft for managing draft documents.

There may be more contexts available depending on the installed TopSolid based
applications.

Example

Creating new design document.

175
Welcome

Count

Method

Version : 6.5

Description :

This property allows to get the number of contexts in the collection.

Use

Integer = IContexts.Count

176
Welcome

Item

Method

Version : 6.5

Description :

This property allows to get a context of the collection (1 <= Index <= Count).

Use

IContext = IContexts.Item(Variant Index)

177
Welcome

ICoordinateSystem

Interface

Version : 6.5

Description :

This interface is implemented in every kind of coordinate systems elements, and gives
access to the features that are common to all of them.

178
Welcome

Current

Property

Version : 6.5

Description :

This property is True when the coordinate system is current. Setting this property to
True makes the coordinate system current.

Use

Boolean = ICoordinateSystem.Current

ICoordinateSystem.Current = Boolean

Remarks

Setting this property to False is not allowed. If you wish to make the coordinate
system "not current", you need to make another coordinate system current is the same
document (there must always be one current coordinate system in the document).

179
Welcome

Element

Property

Version : 6.5

Description :

This property gives access to the IElement interface of the CoordinateSystem object.

Use

IElement = ICoordinateSystem.Element

Remarks

This may me useful to simplify VB code for accessing to the methods/properties of


the base interface (see: Multiple interfaces).

180
Welcome

MakeRefAxis

Method

Version : 6.5

Description :

This method makes a reference to one of the coordinate system axes : OX+, OY+,
OZ+, OX-, OY-, OZ-.

Use

IRefAxis = ICoordinateSystem.MakeRefAxis(Dir)

Parameters

IN TopDirection Dir Coordinate system direction to use.


RET IRefAxis Reference to given axis.

181
Welcome

MakeRefDirection

Method

Version : 6.5

Description :

This method makes a reference to one of the coordinate system directions : X+, Y+,
Z+, X-, Y-, Z-.

Use

IRefDirection = ICoordinateSystem.MakeRefDirection(Dir)

Parameters

IN TopDirection Dir Coordinate system direction to use.


RET IRefDirection Reference to given direction.

182
Welcome

ICoordinateSystems

Interface

Version : 6.5

Description :

This interface is a collection that allows to scan through the coordinate systems of the
document, and to create new coordinate systems with the Add* methods.

183
Welcome

AddBasic

Method

Version : 6.5

Description :

This method creates a non associative coordinate system.

Use

ICoordinateSystem = ICoordinateSystems.AddBasic(Ox, Oy, Oz, Xx, Xy, Xz, Yx, Yy, Yz)

Parameters

IN Double Ox X coordinate of origin.


IN Double Oy Y coordinate of origin.
IN Double Oz Z coordinate of origin.
IN Double Xx X coordinate or X direction.
IN Double Xy Y coordinate or X direction.
IN Double Xz Z coordinate or X direction.
IN Double Yx X coordinate or Y direction.
IN Double Yy Y coordinate or Y direction.
IN Double Yz Z coordinate or Y direction.
RET ICoordinateSystem Created coordinate system.

Remarks

184
Welcome
The X and Y directions do not need to be exactly perpendicular (the Y direction will
be automatically modified to become perpendicular to the X direction), but they must
not be parallel.

185
Welcome

Count

Method

Version : 6.5

Description :

This property allows to get the number of coordinate systems in the collection.

Use

Integer = ICoordinateSystems.Count

186
Welcome

Item

Method

Version : 6.5

Description :

This property allows to get a coordinate system of the collection (1 <= Index <=
Count).

Use

ICoordinateSystem = ICoordinateSystems.Item(Variant Index)

187
Welcome

ICurve

Interface

Version : 6.5

Description :

This interface is implemented in every kind of curve elements, and gives access to the
features that are common to all of them.

188
Welcome

Element

Property

Version : 6.5

Description :

This property gives access to the IElement interface of the Curve object.

Use

IElement = ICurve.Element

Remarks

This may me useful to simplify VB code for accessing to the methods/properties of


the base interface (see: Multiple interfaces).

189
Welcome

MakeRefAxis

Method

Version : 6.5

Description :

This method makes a reference to the axis defined by the curve.

Use

IRefAxis = ICurve.MakeRefAxis

Parameters

RET IRefAxis Reference to curve axis.

190
Welcome

MakeRefDirection

Method

Version : 6.5

Description :

This method makes a reference to the direction defined by the curve.

Use

IRefDirection = ICurve.MakeRefDirection

Parameters

RET IRefDirection Reference to curve direction.

Remarks

The direction defined by a line is along the line.

The direction defined by a circle is along the circle plane normal.

191
Welcome

Segments

Property

Version : 6.5

Description :

This property gives access to the collection of segments contained in the curve.

Use

IRefSegments = ICurve.Segments

192
Welcome

ICurves

Interface

Version : 6.5

Description :

This interface is a collection that allows to scan through the curves of the document,
and to create new curves with the Add* methods.

193
Welcome

Add3PointsCircle

Method

Version : 6.6

Description :

This method creates a non associative circle.

Use

ICurve = ICurves.Add3PointsCircle(P1x, P1y, P1z, P2x, P2y, P2z, P3x, P3y, P3z, Type)

Parameters

IN Double P1x X coordinate of first point.


IN Double P1y Y coordinate of first point.
IN Double P1z Z coordinate of first point.
IN Double P2x X coordinate of second point.
IN Double P2y Y coordinate of second point.
IN Double P2z Z coordinate of second point.
IN Double P3x X coordinate of third point.
IN Double P3y Y coordinate of third point.
IN Double P3z Z coordinate of third point.
Circle type : default arc,
IN TopCircleType Type complementary arc or complete
circle.
RET ICurve Created circle.

194
Welcome

AddBasicBSplineByInterpolation

Method

Version : 6.5

Description :

This method creates a non associative B-spline by interpolation.

Use

ICurve = ICurves.AddBasicBSplineByInterpolation(Pxs, Pys, Pzs, Sx, Sy, Sz, Tx, Ty, Tz)

Parameters

IN Variant Pxs X coordinates of points to interpolate.


IN Variant Pxs Y coordinates of points to interpolate..
IN Variant Pxs Z coordinates of points to interpolate..
X coordinate of start tangent vector (optional,
IN Double Sx
default = 0).
Y coordinate of start tangent vector (optional,
IN Double Sy
default = 0).
Z coordinate of start tangent vector (optional,
IN Double Sz
default = 0).
X coordinate of termination tangent vector
IN Double Tx
(optional, default = 0).
Y coordinate of termination tangent vector
IN Double Ty
(optional, default = 0).
Z coordinate of termination tangent vector
IN Double Tz
(optional, default = 0).
RET ICurve Created B-spline curve.

195
Welcome

Remarks

To create a B-spline curve with null curvature as an end condition, the tangent
vector must be set to (0,0,0).

There must be at least two points to interpolate.

Example

Creating a basic B-spline curve.

196
Welcome

AddBasicCircle

Method

Version : 6.5

Description :

This method creates a non associative circle.

Use

ICurve = ICurves.AddBasicCircle(Cx, Cy, Cz, Xx, Xy, Xz, Yx, Yy, Yz, Radius, Angle)

Parameters

IN Double Cx X coordinate of center.


IN Double Cy Y coordinate of center.
IN Double Cz Z coordinate of center.
IN Double Xx X coordinate of X direction.
IN Double Xy Y coordinate of X direction.
IN Double Xz Z coordinate of X direction.
IN Double Yx X coordinate of Y direction.
IN Double Yy Y coordinate of Y direction.
IN Double Yz Z coordinate of Y direction.
IN Double Radius Radius in length program units.
Aperture angle in angle program units, or 0
IN Double Angle
for full circle (optional, default = 0).
RET ICurve Created circle.

197
Welcome

AddBasicComposit

Method

Version : 6.5

Description :

This method creates a non associative composite curve.

Use

ICurve = ICurves.AddBasicComposite(Curves, Delete)

Parameters

IN Variant Curves Constituent curves.


Delete constituent curves (optional, default =
IN Boolean Delete
True).
RET ICurve Created composit curve.

Remarks

The constituent curves must be connected : the termination point of one curve must
coincide with the starting point of the next one (within the modeling precision which is
0.01µm).

198
Welcome

Example

Creating a basic composite curve.

199
Welcome

AddBasicEllipse

Method

Version : 6.5

Description :

This method creates a non associative ellipse.

Use

ICurve = ICurves.AddBasicEllipse(Cx, Cy, Cz, Xx, Xy, Xz, Yx, Yy, Yz, XRadius, YRadius,
SAngle, TAngle)

Parameters

IN Double Cx X coordinate of center.


IN Double Cy Y coordinate of center.
IN Double Cz Z coordinate of center.
IN Double Xx X coordinate of X direction.
IN Double Xy Y coordinate of X direction.
IN Double Xz Z coordinate of X direction.
IN Double Yx X coordinate of Y direction.
IN Double Yy Y coordinate of Y direction.
IN Double Yz Z coordinate of Y direction.
Radius along X direction in length program
IN Double XRadius
units.
Radius along Y direction in length program
IN Double YRadius
units.
Start angle in angle program units (optional,
IN Double SAngle
default = 0).

200
Welcome

Termination angle in angle program units


IN Double TAngle
(optional, default = 0).
RET ICurve Created ellips.

201
Welcome

AddBasicLine

Method

Version : 6.5

Description :

This method creates a non associative line.

Use

ICurve = ICurves.AddBasicLine(Sx, Sy, Sz, Tx, Ty, Tz)

Parameters

IN Double Sx X coordinate of start point.


IN Double Sy X coordinate of start point.
IN Double Sz X coordinate of start point.
IN Double Sx X coordinate of end point.
IN Double Sy X coordinate of end point.
IN Double Sz X coordinate of end point.
RET ICurve Created line.

Example

Creating a basic line.

202
Welcome

AddBasicPeriodicBSplineByInterpolation

Method

Version : 6.5

Description :

This method creates a non associative periodic B-spline by interpolation.

Use

ICurve = ICurves.AddBasicPeriodicBSplineByInterpolation(Pxs, Pys, Pzs)

Parameters

IN Double Pxs X coordinates of points to interpolate.


IN Double Pys X coordinates of points to interpolate.
IN Double Pzs X coordinates of points to interpolate.
RET ICurve Created B-Spline curve.

Remarks

There must be at least four points to interpolate.

203
Welcome

Count

Method

Version : 6.5

Description :

This property allows to get the number of curves in the collection.

Use

Integer = ICurves.Count

204
Welcome

Item

Method

Version : 6.5

Description :

This property allows to get a curve of the collection (1 <= Index <= Count).

Use

ICurve = ICurves.Item(Variant Index)

205
Welcome

IDimension

Interface

Version : 6.5

Description :

This interface is implemented in every kind of dimensions, and gives access to the
features that are common to all of them.

206
Welcome

Element

Property

Version : 6.5

Description :

This property gives access to the IElement interface of the Dimension object.

Use

IElement = IDimension.Element

Remarks

This may me useful to simplify VB code for accessing to the methods/properties of


the base interface (see: Multiple interfaces).

207
Welcome

HighSuffix

Property

Version : 6.6

Description :

This property gives the high suffix of the dimension.

Use

String = IDimension.HighSuffix

208
Welcome

LowSuffix

Property

Version : 6.6

Description :

This property gives the low suffix of the dimension.

Use

String = IDimension.LowSuffix

209
Welcome

Prefix

Property

Version : 6.6

Description :

This property gives the prefix of the dimension

Use

String = IDimension.Prefix

210
Welcome

Suffix

Property

Version : 6.6

Description :

This property allows to get or set the suffix of the dimension.

Use

String = IDimension.Suffix

IDimension.Suffix = String

211
Welcome

Text

Property

Version : 6.6

Description :

This property allows to get or set the text of the dimension.

Use

String = IDimension.Text

IDimension.Text = String

212
Welcome

IDimensions

Interface

Version : 6.6

Description :

This interface is a collection that allows to scan through the dimensions of the
document.

213
Welcome

Count

Property

Version : 6.6

Description :

This property allows to get the number of dimensions in the collection.

Use

Integer = IDimensions.Count

214
Welcome

Item

Property

Version : 6.6

Description :

This property allows to get a dimension of the collection (1 <= Index <= Count).

Use

IDimension = IDimensions.Item(Variant Index)

215
Welcome

IDocument

Interface

Version : 6.5

Description :

This interface is implemented in every kind of document objects editable with


TopSolid (see: DocumentDesign, DocumentDraft), and gives access to the features
that are common to all of them.

Using this interface allows performing some general tasks (like printing or adding
comments...) without bothering about the exact type of the actual document being
handled.

216
Welcome

Address1

Property

Version : 6.5

Description :

This property allows to get or set the "Address 1" field of the document general
information (accessible to the TopSolid user through the "File | Properties" command).

Use

String = IDocument.Address1

IDocument.Address1 = String

217
Welcome

Address2

Property

Version : 6.5

Description :

This property allows to get or set the "Address 2" field of the document general
information (accessible to the TopSolid user through the "File | Properties" command).

Use

String = IDocument.Address2

IDocument.Address2 = String

218
Welcome

Application

Property

Version : 6.5

Description :

This property gives access to the application.

Use

IApplication = IDocument.Application

219
Welcome

Author

Property

Version : 6.5

Description :

This property allows to get or set the "Author" field of the document general
information (accessible to the TopSolid user through the "File | Properties" command).

Use

String = IDocument.Author

IDocument.Author = String

220
Welcome

BreakAllGroups

Method

Version : 6.6

Description :

This method breaks all groups in document. Elements inside groups are kept.

Use

IDocument.BreakAllGroups()

221
Welcome

Close

Method

Version : 6.5

Description :

This method closes the document.

Use

IDocument.Close(Save, Ask)

Parameters

Save document if modified (optional, default =


IN Boolean Save
False).
Ask user for confirmation before saving
IN Boolean Ask
(optional, default = False).

Remarks

It is good practice to set the document pointer to Nothing just after calling this
method, as the document does not exist anymore, and trying to access it through the
pointer will then cause a crash :

Dim Doc As TopSolid.Document

222
Welcome

...

Doc.Close

Set Doc = Nothing

...

223
Welcome

Company

Method

Version : 6.5

Description :

This property allows to get or set the "Company name" field of the document general
information (accessible to the TopSolid user through the "File | Properties" command).

Use

String = IDocument.Company

IDocument.Company = String

224
Welcome

CreateRevisionIndex

Method

Version : 6.6

Description :

This method creates a revision index.

Use

IDocument.CreateRevisionIndex(Index, Date, Author, Comment, VerificationDate,


VerificationAuthor, VerificationComment)

Parameters

IN String Index Index to create.


IN String Date Date of the creation.
IN String Author Author of the creation index.
String
IN Date of the verification.
VerificationDate
String
IN Author of the verification.
VertificationAuthor
String
IN Comment of the verification.
VerificationComment

225
Welcome

Current

Property

Version : 6.5

Description :

This property is True when the document is current. Setting this property to True will
make the document current.

Use

Boolean = IDocument.Current

IDocument.Current = Boolean

Remarks

Setting this property to False is not allowed.

226
Welcome

CurrentLevel

Property

Version : 6.6

Description :

This property allows to get or set the current level of the document.

Use

Long = IDocument.CurrentLevel

IDocument.CurrentLevel = Long

227
Welcome

Elements

Property

Version : 6.5

Description :

This property gives access to the collection of elements contained in the document.

Use

IElements = IDocument.Elements

228
Welcome

Export

Method

Version : 6.7

Description :

This method exports the document with the specified interface provider.

Use

IDocument.Export(Path, InterfaceProvider, Ask)

Parameters

Full name (including the path and the extension) of


IN String Path
the file.
The interface provider you want to use. See
String
IN InterfaceProviders to have the list (optional, default
InterfaceProvider
= ""))
Ask user for confirmation before saving modified
IN Boolean Ask
referenced files (optional, default = False).

229
Welcome

FactorySuffix

Property

Version : 6.7

Description :

This method gets the suffix of the document.

Use

String = IDocument.FactorySuffix

230
Welcome

FullName

Property

Version : 6.5

Description :

This property allows to get the full name (including the path) of the document.

Use

String = IDocument.Name

231
Welcome

GetBOM

Method

Version : 6.6

Description :

This method gets the BOM of a document.

Use

IBOM = IDocument.GetBOM(Element, Path, GroupElements)

Parameters

DocumentDesign.Assembly for
DocumentDesign.
IN IElement Element
View for DocumentDraft.
IN String Path Date of the creation.
Boolean
IN True to group same elements.
GroupElements
RET IBOM BOM of the document.

232
Welcome

GetExternalReferencedDocuments

Method

Version : 6.6

Description :

This method gets external referenced documents of the document.

Use

IDocument.GetExternalReferencedDocuments(Paths, Types)

Parameters

List of external referenced documents


OUT String Paths (array)
paths.
TopExtRefType Types List of external referenced documents
OUT
(array) types.

Example

Dim path As Variant

Dim types As Variant

...

233
Welcome

TopDoc.GetExternalReferencedDocuments path, types

...

234
Welcome

GetLevelProperties

Method

Version : 6.6

Description :

This method gets the properties of a level.

Use

IDocument.GetLevelProperties(Level, States, LevelName, GroupName)

Parameters

IN Long Level Level index.


OUT Boolean States(2) List of properties states.
OUT String LevelName Level name if there's one.
Name of the group of the level (if the
OUT String GroupName
level is in a group).

Remarks

With this method you can get the properties of a level.

States returns a list of three booleans :

235
Welcome

. the level is active or not

. the level is frozen or not

. the level is in a group or not

Example

Dim states As Variant

Dim name As String

Dim gname As String

Doc.GetLevelProperties 5, states, name, gname

236
Welcome

GetLevelPropertiesByName

Method

Version : 6.6

Description :

This method gets the properties of a level or a group.

Use

IDocument.GetLevelPropertiesByName(Level, States, LevelName, GroupName)

Parameters

IN String Level Level or groupe name.


OUT Boolean States(3) List of properties states.
OUT String LevelName Level name if there's one.
Name of the group of the level (if the
OUT String GroupName
level is in a group).

Remarks

With this method you can get the properties of a level or a group. The level must be
named with the SetLevelProperty method. The group must be named with the
SetLevelsProperty method.

237
Welcome

States returns a list of four booleans :

. the level or group is active or not

. the level or group is frozen or not

. if level, it's in a group or not

. it's a group or nor

LevelName returns the name of the level if it's a level (it's the same name as Level).

GroupName returns the name of the group if it's a group or the name of the group
of the level (if the level is in a group).

Example

Dim states As Variant

Dim name As String

Dim gname As String

Doc.GetLevelPropertiesByName "level1", states, name, gname ("level1" is the name of


a level)

238
Welcome

GetProperty

Method

Version : 6.6

Description :

This method gets the value of a property.

Use

String = IDocument.GetProperty(property)

Parameters

IN String Property Property name.


RET String Value of property.

Remarks

With this method you can access to user information variables (defined in your
top.dgi file).

Example

239
Welcome

Dim value As String

value = Doc.GetProperty("$Author")

240
Welcome

Identifier

Property

Version : 6.7

Description :

This method gets the identifier of the document.

Use

Integer = IDocument.Identifier

241
Welcome

InvalidElementsSet

Method

Version : 6.6

Description :

This property gives access to the invalid elements set.

Use

ISet = IDocument.InvalidElementsSet

242
Welcome

LastRevisionIndex

Method

Version : 6.6

Description :

This property gives access to the last revision index of a document. A revision index
can be created with CreateRevisionIndex.

Use

String = IDocument.LastRevisionIndex

243
Welcome

Modified

Method

Version : 6.6

Description :

This property is True when the document is modified.

Use

Boolean = IDocument.Modified

244
Welcome

MoveExternalReferences

Method

Version : 6.6

Description :

This method moves external references.

Use

IDocument.MoveExternalReferences(OldPaths, NewPaths)

Parameters

IN String OldPaths(array) List of old paths of external references


List of new paths of external
IN String NewPaths(array)
references

Example

Dim oldpath() As String

Dim newpath() As String

...

245
Welcome

ReDim oldpath(1)

ReDim newpath(1)

oldpath(0) = "D:\Projets\Classeur1.xls"

newpath(0) = "D:\Projets\classeur2.xls"

...

246
Welcome

Name

Property

Version : 6.5

Description :

This property allows to get the name of the document.

Use

String = IDocument.Name

247
Welcome

Number

Property

Version : 6.5

Description :

This property allows to get or set the "Document number" field of the document
general information (accessible to the TopSolid user through the "File | Properties"
command).

Use

String = IDocument.Number

IDocument.Number = String

248
Welcome

Path

Property

Version : 6.5

Description :

This property allows to get the path for the document (i.e. the full name of the folder
containing the document).

Use

String = IDocument.Path

249
Welcome

PrintOut

Method

Version : 6.5

Description :

This method prints the document.

Use

IDocument.PrintOut()

Remarks

The document must be visible.

In the case of a draft document with multiple drawings, all drawings are printed
separately. If you want to only print one of them, you should use the
IDrawing.PrintOut method.

Example

Printing all displayed documents.

250
Welcome

ProgramUnitAngle

Property

Version : 6.5

Description :

This property allows to get and set the angle unit used by the API for objects
belonging to the document.

Use

String = IDocument.ProgramUnitAngle

IDocument.ProgramUnitAngle = String

Remarks

The angle unit is defined by its symbol : "°" for degrees, "rad" for radians, ...

The list of all supported angle units is displayed in the "Angle" combo box of the
"Units" tab of TopSolid "File | Properties" panel.

When the document is first accessed, the document program angle unit is set equal
to the application program unit.

See also

251
Welcome

Program units

IApplication.ProgramUnitAngle.

252
Welcome

ProgramUnitLength

Property

Version : 6.5

Description :

This property allows to get and set the length unit used by the API for objects
belonging to the document.

Use

String = IDocument.ProgramUnitLength

IDocument.ProgramUnitLength = String

Remarks

The length unit is defined by its symbol : "mm" for millimeters, "m" for meters, "in"
for inches, ...

The list of all supported length units is displayed in the "Length" combo box of the
"Units" tab of TopSolid "File | Properties" panel.

When the document is first accessed, the document program length unit is set equal
to the application program unit.

253
Welcome

See also

Program units

IApplication.ProgramUnitLength.

254
Welcome

ReadOnly

Property

Version : 6.5

Description :

This property is True when the document is read only.

Use

Boolean = IDocument.ReadOnly

255
Welcome

Regenerate

Property

Version : 6.6

Description :

This method regenerates document .

Use

IDocument.Regenerate()

256
Welcome

Save

Method

Version : 6.5

Description :

This method saves the document.

Use

IDocument.Save(Ask)

Parameters

Ask user for confirmation before saving


IN Boolean Ask modified referenced files (optional, default =
False).

Remarks

If the user refuses to save the modified referenced files, the document is not saved.

It is possible to check that the document has been saved with the Saved property.

257
Welcome

SaveAs

Method

Version : 6.5

Description :

This method saves the document.

Use

IDocument.SaveAs(Name, Ask)

Parameters

Full name (including the path and the extension)


IN String Name
of the file.
Ask user for confirmation before saving modified
IN Boolean Ask
referenced files (optional, default = False).

Remarks

As the TopSolid "File | Save as" command, this method allows to both save the
document into a different file, and export the document into an external format file
(the available translators will depend on your TopSolid configuration : IGES, STEP, ...)
depending on the file name extension.

If the user refuses to save the modified referenced files, the document is not saved.

258
Welcome

It is possible to check that the document has been saved with the Saved property.

259
Welcome

Saved

Method

Version : 6.5

Description :

This property is True when the document file on the disk is up-to-date with the "in
memory" document (i.e. when there is no '*' displayed in the document window title
bar).

Use

Boolean = IDocument.Saved

Remarks

This property is also True if the document has never been saved, but has not
changed since it was created.

260
Welcome

SearchElementByName

Method

Version : 6.6

Description :

This method searches an element by its name.

Use

IElement = IDocument.SearchElementByName(name)

Parameters

IN String Name Searched element name.


RET IElement The element searched.

Remarks

With this method you can search an element by name.

Example

261
Welcome

Dim element As TopSolid.Element

element = Doc.SearchElementByName("cube_orange")

If (element Is Nothing) Then

MsgBox "No element found"

Else

MsgBox "Element found"

End If

262
Welcome

SetLevelProperty

Method

Version : 6.6

Description :

This method sets the property of a level.

Use

IDocument.SetLevelProperty(PropertyType, Level, (optionnal) Name)

Parameters

TopLevelProperty
IN Property type.
PropertyType
IN Long Level Level index.
IN String Name Name.

Remarks

The TopLevelProperty TopGroup can't be used with this method (see also
SetLevelsProperty method and SetLevelsPropertyByName method).

The TopLevelProperty TopSplit can't be used with this method (see also
SetLevelPropertyByName method when there's only a group to split of

263
Welcome

SetLevelsPropertyByName method to split a list of groups).

Example

Doc.SetLevelProperty topDisable, 12

Doc.SetLevelProperty topName, 18, "level18"

264
Welcome

SetLevelPropertyByName

Method

Version : 6.6

Description :

This method sets the property of a level.

Use

IDocument.SetLevelPropertyByName(PropertyType, Level, (optionnal) Name)

Parameters

TopLevelProperty
IN Property type.
PropertyType
IN String Level Level or group name.
IN String Name Property name.

Remarks

The TopLevelProperty TopGroup can't be used with this method (see also
SetLevelsProperty method and SetLevelsPropertyByName method).

The TopLevelProperty TopName is used to change the name of a level or a group.

265
Welcome

Example

Doc.SetLevelProperty topSplit, "group1" ("group1" is the name of a group of levels)

266
Welcome

SetLevelsProperty

Method

Version : 6.6

Description :

This method sets the property of a list of levels.

Use

IDocument.SetLevelsProperty(PropertyType, Levels, (optionnal) Name)

Parameters

TopLevelProperty
IN Property type.
PropertyType
IN Long Levels (array) List of level indexes.
IN String Name Property name.

Remarks

The name can be used to name a group when it's a list of level indexes.

The name can be used to name a level when there's only one level in the list. (See also
SetLevelProperty method).

267
Welcome

Example

Dim lindexes(2) as long

Dim lgroup (3) as long

linexes(0) = 10

lindexes(1) = 11

lindexes(2) = 12

Doc.SetLevelsProperty topFreeze, lindexes

lgroup(0) = 20

lgroup(1) = 21

lgroup(2) = 22

lgroup(3) = 23

Doc.SetLevelsProperty topGroup, lgroup, "toto"

268
Welcome

SetLevelsPropertyByName

Method

Version : 6.6

Description :

This method sets the property of a list of levels.

Use

IDocument.SetLevelsPropertyByName(PropertyType, Levels, (optionnal) Name)

Parameters

TopLevelProperty
IN Property type.
PropertyType
IN Long Levels (array) List of level names.
IN String Name Property name.

Remarks

The levels must be named with the SetLevelProperty method.

The name can be used to name a group when it's a list of level.

269
Welcome

The name can be used to name a level when there's only one level in the list. (See also
SetLevelProperty method).

Example

Dim lnames(2) as String

Dim lgroup (3) as String

lnames(0) = "level1"

lnames(1) = "level2"

lnames(2) = "level3"

Doc.SetLevelsProperty topFreeze, lindexes

270
Welcome

SetPasswords

Method

Version : 6.7

Description :

This method sets the write and read password of the document.

Use

IDocument.SetPasswords(WritePassword, ReadPassword)

Parameters

Password to block the modification of the


IN String WritePassword
document, but not the reading.
Password to block the reading of the
IN String ReadPassword
document too. (optional, default = "").

Remarks

To enter the password(s) when opening a document, you have to use the
NotifyDocumentPasswordsAsked event.

271
Welcome

SetProperty

Method

Version : 6.6

Description :

This method sets the value of a property.

Use

IDocument.SetProperty(propertyname, value)

Parameters

IN String PropertyName Property name.


IN String Name New value of property.

Remarks

With this method you can access to user information variables (defined in your
top.dgi file).

Example

272
Welcome

Dim value As String

Doc.SetProperty "$VERIFICATION_DATE", value

273
Welcome

Texts

Property

Version : 6.6

Description :

This property gives access to the methods allowing to create textsin the document.

Use

ITexts = IDocument.Texts

274
Welcome

Title1

Property

Version : 6.5

Description :

This property allows to get or set the "Title 1" field of the document general
information (accessible to the TopSolid user through the "File | Properties" command).

Use

String = IDocument.Title1

IDocument.Title1 = String

275
Welcome

Title2

Property

Version : 6.5

Description :

This property allows to get or set the "Title 2" field of the document general
information (accessible to the TopSolid user through the "File | Properties" command).

Use

String = IDocument.Title2

IDocument.Title2 = String

276
Welcome

Undisplay

Method

Version : 6.7

Description :

This method undisplays a document. The document is always loaded.

Use

IDocument.Undisplay()

277
Welcome

Version

Property

Version : 6.5

Description :

This property gives the version of TopSolid used when last saving the document.

Use

Long = IDocument.Version

See also

IApplication.Version.

278
Welcome

Visible

Property

Version : 6.5

Description :

This property is True when the document window is visible. Setting this property to
True/False will make the document window visible/invisible.

Use

Boolean = IDocument.Visible

IDocument.Visible = Boolean

279
Welcome

IDocumentDesign

Interface

Version : 6.5

Description :

This interface is implemented in the DocumentDesign object, and gives access to the
specific features of this kind of document (the common features being accessed
through the IDocument interface).

280
Welcome

AbsoluteCoordinateSystem

Property

Version : 6.5

Description :

This property gives access to the absolute coordinate system of the document.

Use

ICoordinateSystem = IDocumentDesign.AbsoluteCoordinateSystem

281
Welcome

Assembly

Property

Version : 6.5

Description :

This property gives access to the assembly.

Use

ISet = IDocumentDesign.Assembly

Remarks

The assembly is a set that contains all the elements that actually make it.

282
Welcome

Components

Property

Version : 6.5

Description :

This property gives access to the methods allowing to create components in the
document.

Use

IComponents = IDocumentDesign.Components

283
Welcome

CoordinateSystems

Property

Version : 6.5

Description :

This property gives access to the methods allowing to create coordinate systems in the
document.

Use

ICoordinateSystems = IDocumentDesign.CoordinateSystems

284
Welcome

CurrentCoordinateSystem

Property

Version : 6.5

Description :

This property gives access to the current coordinate system of the document. To make
a coordinate system current, set the Current property of the coordinate system to
True.

Use

ICoordinateSystem = IDocumentDesign.CurrentCoordinateSystem

285
Welcome

Curves

Property

Version : 6.5

Description :

This property gives access to the methods allowing to create curves in the document.

Use

ICurves = IDocumentDesign.Curves

286
Welcome

Document

Property

Version : 6.5

Description :

This property gives access to the IDocument interface of the DocumentDesign object.

Use

IDocument = IDocumentDesign.Document

Remarks

This may me useful to simplify VB code for accessing to the methods/properties of


the base interface (see: Multiple interfaces).

287
Welcome

Parameters

Property

Version : 6.5

Description :

This property gives access to the methods allowing to create parameters in the
document.

Use

IParameters = IDocumentDesign.Parameters

288
Welcome

Points

Property

Version : 6.5

Description :

This property gives access to the methods allowing to create points in the document.

Use

IPoints = IDocumentDesign.Points

289
Welcome

PurgeShapes

Method

Version : 6.6

Description :

This method purges all the shapes of a document design.

Use

IDocumentDesign.PurgeShapes()

290
Welcome

Shapes

Method

Version : 6.6

Description :

This property gives access to the methods allowing to create shapes in the document.

Use

IShapes = IDocumentDesign.Shapes

291
Welcome

_IDocumentDesignEvents

Interface

Version : 6.5

Description :

This interface allows to receive TopSolid design documents events.

292
Welcome

NotifyDelete

Event

Version : 6.5

Description :

This event notifies that the document is being deleted.

Use

_IDocumentDesignEvents.NotifyDelete()

293
Welcome

IDocumentDraft

Interface

Version : 6.5

Description :

This interface is implemented in the DocumentDraft object, and gives access to the
specific features of this kind of document (the common features being accessed
through the IDocument interface).

294
Welcome

Drawings

Method

Version : 6.5

Description :

This property gives access to the methods allowing to get the drawings of the
document.

Use

IDrawings = IDocumentDraft.Drawings

295
Welcome

Dimensions

Method

Version : 6.6

Description :

This property gives access to the collection of dimensions contained in the draft
document.

Use

IDimensions = IDocumentDraft.Dimensions

296
Welcome

_IDocumentDraftEvents

Interface

Version : 6.5

Description :

This interface allows to receive TopSolid draft documents events.

297
Welcome

NotifyDelete

Event

Version : 6.5

Description :

This event notifies that the document is being deleted.

Use

_IDocumentDdraftEvents.NotifyDelete()

298
Welcome

IDocuments

Interface

Version : 6.5

Description :

This interface gives access to the collection of the documents loaded in memory.

In general, this means all the displayed documents (Visible property equal to True)
plus all the documents directly or indirectly referenced by them.

299
Welcome

Add

Method

Version : 6.5

Description :

This method creates a new document from scratch or by using a given template.

Use

IDocument = IDocuments.Add(Template)

Parameters

Name of template file with extension, or


IN String Template
just extension.
RET IDocument Created document.

Remarks

To create a new document from scratch, just give the extension of the type of file
you want to create (for example, to create a new design document, use Template =
"top", to create a new draft document use Template = "dft", ...).

To use a given template, just give the name of the template file (including
extension) as Template parameter (for example Template = "MyTemplate.top").

300
Welcome

Creating a new document from scratch is equivalent to using the "File | New" menu
function of TopSolid, in the mode "Without template", and accepting the default
options in the final dialog box.

When giving the name of a template file, the file is searched sequentially in the
following directories : $TOPCONFIG\template, $TOPGROUP\template,
$TOPHOME\local\$TOPLANG\template (if the file is not found, the method fails).

The document created is automatically made visible.

Example

Creating a new design document.

301
Welcome

Close

Method

Version : 6.5

Description :

This method closes all the documents.

Use

IDocuments.Close(Save, Ask)

Parameters

Save modified documents (optional, default =


IN Boolean Save
False).
Ask user for confirmation before saving
IN Boolean Ask
(optional, default = False).

302
Welcome

Count

Property

Version : 6.5

Description :

This property allows to get the number of documents in the collection.

Use

Integer = IDocuments.Count

303
Welcome

Import

Method

Version : 6.7

Description :

This method imports an existing document by specifying the interface provider to use.

Use

IDocument = IDocuments.Load(Path, Type, InterfaceProvider, ReadOnly, Documents)

Parameters

Name of file, including its path and


IN String Path
extension.
Type of document to produce defined by its
IN String Type extension, or empty string for automatic
(optional, default = Empty).
InterfaceProvider to use. See
String
IN InterfaceProviders to have the list
InterfaceProvider
(optional, default value = "")
True if opening document in read only
IN Boolean ReadOnly
mode (optional, default value = False).
OUT Variant Documents Opened documents (optional).
RET IDocument Loaded document.

304
Welcome

Item

Property

Version : 6.5

Description :

This property allows to get a document the collection (1 <= Index <= Count).

Use

IDocument = IDocuments.Item(Variant Index)

305
Welcome

Load

Method

Version : 6.7

Description :

This method load an existing document.

Use

IDocument = IDocuments.Load(Path, ReadOnly, Display, Current)

Parameters

Name of file, including its path and


IN String Path
extension.
True if opening document in read only
IN Boolean ReadOnly
mode (optional, default value = False).
True to display the document (optional,
IN Boolean Display
default value = True).
True to set the document current (optional,
IN Boolean Current
default value = True).
RET IDocument Loaded document.

306
Welcome

Open

Method

Version : 6.5

Description :

This method opens an existing document.

Use

IDocument = IDocuments.Open(Name, Type, Documents)

Parameters

Name of file, including its path and


IN String Name
extension.
Type of document to produce defined by its
IN String Type extension, or empty string for automatic
(optional, default = Empty).
OUT Variant Documents Opened documents (optional).
RET IDocument Opened document, or Nothing if none.

Remarks

As the TopSolid "File | Open" command, this method allows to both open a TopSolid
application document (Design, Draft, Mold, CAM, ...), and import an external format
file (the available translators will depend on your TopSolid configuration : IGES, STEP,
...) into a new document.

307
Welcome

In the second case, several documents may be produced (for instance, some IGES
files contain a 3D model and a draft), which are returned in the "Documents" variant
array.

When importing an external format file, it is possible to choose the type of TopSolid
document produced by giving the extension of the document in the "Type" parameter
(for instance, to import an XT file into a new CAM document, use Type = "cam").

Example

pening a document

Importing an IGES file.

308
Welcome

IDrawing

Interface

Version : 6.5

Description :

This interface is implemented in every kind of drawing elements, and gives access to
the features that are common to all of them.

309
Welcome

Element

Property

Version : 6.5

Description :

This property gives access to the IElement interface of the Drawing object.

Use

IElement = IDrawing.Element

Remarks

This may me useful to simplify VB code for accessing to the methods/properties of


the base interface (see: Multiple interfaces).

310
Welcome

PaperFormat

Property

Version : 6.5 / 6.7

Description :

This property allows to get and set the drawing paper format.

Use

TopPaperFormat = IDrawing.PaperFormat

IDrawing.PaperFormat(PaperFormat)

311
Welcome

PrintOut

Method

Version : 6.5

Description :

This method prints the drawing.

Use

IDrawing.PrintOut()

Remarks

The document containing the drawing must be visible.

312
Welcome

ScaleFactor

Property

Version : 6.7

Description :

This property allows to get and set the scale factor.

Use

Double = IDrawing.ScaleFactor

IDrawing.ScaleFactor(Scale)

313
Welcome

IDrawings

Interface

Version : 6.5

Description :

This interface is a collection that allows to scan through the drawings of the
document.

314
Welcome

Count

Property

Version : 6.5

Description :

This property allows to get the number of drawings in the collection.

Use

Integer = IDrawings.Count

315
Welcome

Item

Property

Version : 6.5

Description :

This property allows to get a drawing of the collection (1 <= Index <= Count).

Use

IDrawing = IDrawings.Item(Variant Index)

316
Welcome

IElement

Interface

Version : 6.5

Description :

This interface is implemented in every kind of elements contained by a document


(coordinate systems, points, curves, texts, ...), and gives access to the features that are
common to all of them.

Using this interface allows performing some general tasks (like changing layer,
scanning user properties, ...) without bothering about the exact type of the actual
element being handled.

317
Welcome

Analyse

Method

Version : 6.6

Description :

This method allows to get some geometrical properties (area, volume, mass).

Use

Variant = IElement.Analyse(Analysis)

Parameters

TopAnalyse Type of analysis (volume, mass and area for


IN
Analysis 3D element and area for 2D element).
OUT Variant Value of the geometrical property.

Example

Dim value As Variant

value = Doc.Elements.Item(i).Analyse(topArea)

318
Welcome

Application

Property

Version : 6.5

Description :

This property gives access to the application.

Use

IApplication = IElement.Application

319
Welcome

Basify

Method

Version : 6.6

Description :

This method basifies the geometry of an element.

Use

IElement.Basify()

320
Welcome

Blanked

Property

Version : 6.5

Description :

When this property is True, the element is blanked out, and therefore not visible.
When this property is False, the element may be visible, depending on other factors.

Use

Boolean = IElement.Blanked

IElement.Blanked= Boolean

321
Welcome

BreakAssociativity

Method

Version : 6.5

Description :

This method allows to break the associativity of the element.

Use

IElement.BreakAssociativity(DeleteTools, ShowTools)

Parameters

Boolean Delete element tools (optional, default =


IN
DeleteTools True).
Show element tools, if not deleted
IN Boolean ShowTools
(optional, default = True).

322
Welcome

Color

Property

Version : 6.5

Description :

This property allows to get and set the element color.

Use

TopColor = IElement.Color

IElement.Color = TopColor

See also

GetColorRGB method.

323
Welcome

Delete

Method

Version : 6.5

Description :

This method deletes the element.

Use

IElement.Delete

Remarks

It is good practice to set the element pointer to Nothing just after calling this
method, as the element does not exist anymore, and trying to access it through the
pointer will then cause a crash :

Dim Elt As TopSolid.Element

...

Elt.Delete

Set Elt = Nothing

...

324
Welcome

Designation

Property

Version : 6.5

Description :

This property allows to get or set the designation of the element.

Use

String = IElement.Designation

IElement.Designation = String

Remarks

To remove the explicit designation of an element, just set it equal to an empty


string.

When an element has no explicit designation, an automatic designation is generated


when getting the designation through this property, made with :

- A specific method when available (for instance for the standard components).

- Otherwise the name of the element, if it has gone one.

- Otherwise the identifier of the element prefixed with '@'.

325
Welcome

Document

Property

Version : 6.5

Description :

This property gives access to the document containing the element.

Use

IDocument = IElement.Document

326
Welcome

GetColorRGB

Method

Version : 6.5

Description :

This method gets the RGB intensities of the element color.

Use

IElement.GetColorRGB(Red, Green, Blue)

Parameters

OUT Long Red Red intensity within [0,255].


OUT Long Green Green intensity within [0,255].
OUT Long Blue Blue intensity within [0,255].

Remarks

If the element does not support the color attribute, (0,0,0) is returned.

See also

327
Welcome

Color property.

328
Welcome

GetConstituents

Method

Version : 6.7

Description :

This method gets constituent elements of this element.

Use

Variant = IElement.GetConstituents()

Parameters

RET Variant Constituent elements.

329
Welcome

GetMatter

Method

Version : 6.6

Description :

This method gets the matter name and its properties.

Use

IElement.GetMatter(Name, Density, YoungModulus, PoissonRatio, Expansion,


ElasticLimit, ShearModulus, ShrinkageFactor, ShrinkageFactorMin,
ShrinkageFactorMax, InjectionPressureMin, InjectionPressureMax, Conductivity,
ThermicInertia)

Parameters

OUT String Name Name of the matter.


OUT Double Density Density, in kg/dm³.
Young modulus or modulus of elasticity,
OUT Double YoungModulus
in Pa.
OUT Double PoissonRatio Poisson's ratio.
OUT Double Expansion Expansion coefficient, in °C-¹.
OUT Double ElasticLimit Elastic limit, in Pa.
OUT Double ShearModulus Shear modulus, in Pa.
OUT Double ShrinkageFactor Shrinkage factor.
Double
OUT Minimum shrinkage factor
ShrinkageFactorMin
Double
OUT Maximum shrinkage factor
ShrinkageFactorMax
OUT Minimum injection pressure, in kg/cm²

330
Welcome

Double
InjectionPressureMin
Double
OUT Maximum injection pressure, in kg/cm²
InjectionPressureMax
OUT Double Conductivity Conductivity, in W/m.°C.
OUT Double Thermicinertia Thermic inertia, in J/m³.°C.

331
Welcome

GetTextProperty

Method

Version : 6.6

Description :

This method gets the value of a property containing a single text field.

Use

String = IElement.GetTextProperty(Name)

Parameters

IN String Name Name of the property to get.


RET String Text field value.

Remarks

If the element does not have the wanted property, the method returns an empty
string.

332
Welcome

Identifier

Property

Version : 6.6

Description :

This property allows to get a persistent identifier for the element.

Use

Long = IElement.Identifier

333
Welcome

Invalid

Property

Version : 6.6

Description :

This property is True when the element is invalid.

Use

Boolean = IElement.Invalid

334
Welcome

Layer

Property

Version : 6.6

Description :

This property allows to get and set the element layer.

Use

Integer = IElement.Layer

IElement.Layer = Integer

Remarks

If the element does not support the layer attribute, the property returns -2.

If the element is on several layers, the property returns -1.

Valid layer numbers are within [0, 999].

335
Welcome

Level

Property

Version : 6.6

Description :

This property allows to get or set the level of the element.

Use

Long = IElement.Level

IElement.Level = Long

336
Welcome

Name

Property

Version : 6.5

Description :

This property allows to get or set the name of the element.

Use

String = IElement.Name

IElement.Name = String

Use

If the element has no name, an empty string is returned.

To remove the name of an element, just set it equal to an empty string.

337
Welcome

NameOrIdentifier

Property

Version : 6.5

Description :

This property allows to get a unique name identifying the element.

Use

String = IElement.NameOrIdentifier

Use

If the element has got a name, then the name is returned.

Otherwise, a name is made by concatenating '@' and the identifier of the element
(ex: "@1234").

338
Welcome

Reference

Property

Version : 6.5

Description :

This property allows to get or set the reference number of the element.

Use

String = IElement.Reference

IElement.Reference = String

Remarks

To remove the reference number of an element, just set it equal to an empty string.

If the element has no reference number, this property returns an empty string.

339
Welcome

RemoveProperty

Method

Version : 6.6

Description :

This method allows to remove a property.

Use

IElement.RemoveProperty(Name)

Parameters

IN String Name Name of the property to remove.

Remarks

If the element does not have the property, an error occurs.

340
Welcome

SaveInFile

Method

Version : 6.6

Description :

This method allows to save this element in a file.

Use

IElement.SaveInFile(Dir, Name, Interface)

Parameters

IN String Dir Directory


IN String Path Name of the file, without suffix.
IN TopInterface Interface Interface in which save the file.

341
Welcome

SetTextProperty

Method

Version : 6.5

Description :

This method allows to set the value of a property containing a single text field.

Use

IElement.SetTextProperty(Name, Value)

Parameters

IN String Name Name of the property to set.


IN String Value New text field value.

Remarks

If the element does not already have the property, a new property is added to the
element.

342
Welcome

SetTexture

Method

Version : 6.7

Description :

This method set the texture of the element.

Use

IElement.SetTexture(RefElement)

Parameters

IN IElement RefElement Reference element.

343
Welcome

Supplier

Property

Version : 6.5

Description :

This property allows to get or set the supplier of the element.

Use

String = IElement.Supplier

IElement.Supplier = String

Remarks

To remove the supplier of an element, just set it equal to an empty string.

If the element has no supplier, this property returns an empty string.

344
Welcome

Visible

Property

Version : 6.5

Description :

This property is True when the element is visible.

Use

Boolean = IElement.Visible

Remarks

There are several conditions for an element to be visible :

- It must have a graphic representation (a parameter is never visible !).

- It must not be blanked out.

- It must be on an active layer.

345
Welcome

IElements

Interface

Version : 6.5

Description :

This interface gives access to the collection of the elements contained by a document.

346
Welcome

Count

Property

Version : 6.5

Description :

This property allows to get the number of elements in the collection.

Use

Integer = IElements.Count

347
Welcome

Item

Property

Version : 6.5

Description :

This property allows to get an element of the collection (1 <= Index <= Count).

Use

IElement = IElements.Item(Variant Index)

348
Welcome

NameIsUsed

Method

Version : 6.5

Description :

This method finds out if a given name is already used by an element of the collection.

Use

Boolean = IElements.NameIsUsed(Name)

Parameters

IN String Name Name to check for.


RET Boolean True if the name is already used.

349
Welcome

IExtension

Interface

Version : 6.5

Description :

This interface is implemented in every kind of extension objects, and gives access to
the features that are common to all of them.

350
Welcome

Application

Property

Version : 6.5

Description :

This property gives access to the application.

Use

IApplication = IExtension.Application

351
Welcome

Name

Property

Version : 6.5

Description :

This property gives the name of the extension.

Use

String = IExtension.Name

Remarks

By convention, the name of the extension is made of the name of the type library
where it has been defined, followed by the name of the extension object, separated by
a dot.

352
Welcome

Version

Property

Version : 6.5

Description :

This property gives the version of the extension.

Use

Long= IExtension.Version

353
Welcome

IContexts

Interface

Version : 6.5

Description :

This interface gives access to the collection of the available extensions.

Third parties may provide extensions for TopSolid.

These extensions are able to expose some COM Automation interfaces to enrich
TopSolid API, in which case they will be accessible in this collection.

If no such extension has been installed, this collection will be empty.

354
Welcome

Count

Property

Version : 6.5

Description :

This property allows to get the number of extensions in the collection.

Use

Integer = IExtensions.Count

355
Welcome

Item

Property

Version : 6.5

Description :

This property allows to get an extension of the collection (1 <= Index <= Count).

Use

IExtension = IExtensions.Item(Variant Index)

356
Welcome

IParameter

Interface

Version : 6.5

Description :

This interface is implemented in every kind of parameter elements, and gives access
to the features that are common to all of them.

357
Welcome

GetConvertedTolerance

Method

Version : 6.6

Description :

This method gets the minimum and maximum tolerance values of a parameter in the
unit you want (Symbol).

Use

IParameter.GetConvertedTolerance(Symbol, ToleranceMin, ToleranceMax)

Parameters

Symbol of the unit in which you want the


IN String Symbol
values.
Double Value of the minimum tolerance in the
OUT
ToleranceMin right symbol.
Double Value of the maximum tolerance in the
OUT
ToleranceMax right symbol.

Remarks

If the symbol is not in the same type unit as the parameter, the method returns an
error.

358
Welcome

GetConvertedValue

Method

Version : 6.6

Description :

This method gets the value of a parameter in the unit you want (Symbol).

Use

Double = IParameter.GetConvertedValue(Symbol)

Parameters

Symbol of the unit in which you want the


IN String Symbol
value.
RET Double Value of the parameter in the right symbol.

Remarks

If the symbol is not in the same type unit as the parameter, the method returns an
error.

Example

359
Welcome

Dim value As Double

value = TopParam.GetConvertedValue("cm")

' the value you will have is in cm

360
Welcome

Element

Property

Version : 6.5

Description :

This property gives access to the IElement interface of the Parameter object.

Use

IElement = IParameter.Element

Remarks

This may me useful to simplify VB code for accessing to the methods/properties of


the base interface (see: Multiple interfaces).

361
Welcome

Modifiable

Property

Version : 6.6

Description :

This property is True when the parameter is modifiable. Only basic parameters can be
modified.

Use

Boolean = IParameter.Modifiable

362
Welcome

NominalValue

Property

Version : 6.5

Description :

This property allows to get and to set the nominal value of the parameter.

Use

Double = IParameter.NominalValue

IParameter.NominalValue = Double

Remarks

For length and angle type parameter, the value is not expressed in the parameter
units, but in program units.

For the other types, the value is expressed in the parameter units.

You can get the unit of a parameter with the method GetUnitSymbol.

363
Welcome

SetConvertedTolerance

Method

Version : 6.6

Description :

This method sets the minimum and maximum tolerance values of a parameter in the
unit you want (Symbol).

Use

IParameter.SetConvertedTolerance(ToleranceMin, ToleranceMax, Symbol)

Parameters

Double Value of the minimum tolerance in the


IN
ToleranceMin right symbol.
Double Value of the maximum tolerance in the
IN
ToleranceMax right symbol.
Symbol of the unit in which you want to set
IN String Symbol
the values.

Remarks

If the symbol is not in the same type unit as the parameter, the method returns an
error.

364
Welcome

SetConvertedValue

Method

Version : 6.6

Description :

This method sets the value of the parameter in the unit you want (Symbol).

Use

IParameter.SetConvertedValue(Value, Symbol)

Parameters

Double Value of the minimum tolerance in the


IN
ToleranceMin right symbol.
Double Value of the maximum tolerance in the
IN
ToleranceMax right symbol.
Symbol of the unit in which you want to set
IN String Symbol
the values.

Remarks

If the symbol is not in the same type unit as the parameter, the method returns an
error.

365
Welcome

Example

Dim value As Double

TopParam.SetConvertedValue(value, "cm")

' the value is in cm and you want to set it to the parameter

366
Welcome

UnitSymbol

Property

Version : 6.5

Description :

This property allows to get the symbol of the unit of the parameter.

Use

String = IParameter.UnitType

Remarks

The list of all units is displayed in the "Units" tab of TopSolid "File | Properties"
panel.

367
Welcome

UnitType

Property

Version : 6.6

Description :

This property allows to get the type of the parameter.

Use

TopParamUnitType = IParameter.UnitType

368
Welcome

Value

Property

Version : 6.5

Description :

This property allows to get the parameter value.

Use

Double = IParameter.Value

Remarks

The value is not expressed in the parameter units, but in program units.

369
Welcome

IParameters

Interface

Version : 6.5

Description :

This interface is a collection that allows to scan through the parameters of the
document, and to create new parameters with the Add* methods.

370
Welcome

AddBasic

Method

Version : 6.5

Description :

This method creates a non associative parameter.

Use

IParameter = IParameters.AddBasic(Value, Units)

Parameters

IN Double Value Nominal value.


IN String Units Units.
RET IParameter Created parameter.

Example

Creating a basic parameter.

371
Welcome

Count

Property

Version : 6.5

Description :

This property allows to get the number of parameters in the collection.

Use

Integer = IParameters.Count

372
Welcome

Item

Property

Version : 6.5

Description :

This property allows to get a parameter of the collection (1 <= Index <= Count).

Use

IParameters = IParameters.Item(Variant Index)

373
Welcome

IPoint

Interface

Version : 6.5

Description :

This interface is implemented in every kind of point elements, and gives access to the
features that are common to all of them.

374
Welcome

Element

Property

Version : 6.5

Description :

This property gives access to the IElement interface of the Point object.

Use

IElement = IPoint.Element

Remarks

This may me useful to simplify VB code for accessing to the methods/properties of


the base interface (see: Multiple interfaces).

375
Welcome

GetCoordinates

Method

Version : 6.5

Description :

This method gets the coordinates of a point.

Use

IPoint.GetCoordinates(X, Y, Z)

Parameters

OUT Double X X coordinate.


OUT Double Y Y coordinate.
OUT Double Z Z coordinate.

376
Welcome

SetCoordinates

Method

Version : 6.5

Description :

This method modifies the coordinates of a non associative point.

Use

IPoint.SetCoordinates(X, Y, Z)

Parameters

IN Double X X coordinate.
IN Double Y Y coordinate.
IN Double Z Z coordinate.

377
Welcome

Property

Version : 6.5

Description :

This property allows to get and to set the X coordinate of the point.

Use

Double = IPoint.X

IPoint.X = Double

Remarks

It is not possible to modify the coordinates of an associative point.

378
Welcome

Property

Version : 6.5

Description :

This property allows to get and to set the Y coordinate of the point.

Use

Double = IPoint.Y

IPoint.Y = Double

Remarks

It is not possible to modify the coordinates of an associative point.

379
Welcome

Property

Version : 6.5

Description :

This property allows to get and to set the Z coordinate of the point.

Use

Double = IPoint.Z

IPoint.Z = Double

Remarks

It is not possible to modify the coordinates of an associative point.

380
Welcome

IPoints

Interface

Version : 6.5

Description :

This interface is a collection that allows to scan through the points of the document,
and to create new points with the Add* methods.

381
Welcome

AddBarycenter

Method

Version : 6.5

Description :

This method creates an associative barycenter point.

Use

IPoint = IPoints.AddBarycenter(Elements, Weights)

Parameters

IN Variant Elements Reference elements.


IN Variant Weights Weights parameters.
RET IParameter Created point.

382
Welcome

AddBasic

Method

Version : 6.5

Description :

This method creates a non associative point.

Use

IPoint = IPoints.AddBasic(X, Y, Z)

Parameters

IN Double X X coordinate.
IN Double Y Y coordinate.
IN Double Z Z coordinate.
RET IPoint Created point.

383
Welcome

Count

Property

Version : 6.5

Description :

This property allows to get the number of points in the collection.

Use

Integer = IPoints.Count

384
Welcome

Item

Property

Version : 6.5

Description :

This property allows to get a point of the collection (1 <= Index <= Count).

Use

IPoint = IPoints.Item(Variant Index)

385
Welcome

IRef

Interface

Version : 6.5

Description :

This interface is implemented in every kind of reference objects.

386
Welcome

Element

Property

Version : 6.5

Description :

This property gives access to the referenced element.

Use

IElement = IRef.Element

387
Welcome

IRefAxis

Interface

Version : 6.5

Description :

This interface is implemented in the RefAxis object, and gives access to the specific
features of this kind of reference (the common features being accessed through the
IRef interface).

388
Welcome

GetAxis

Method

Version : 6.5

Description :

This method gets the coordinates of the origin point and the direction of the
referenced axis.

Use

IRefAxis.GetAxis(Ox, Oy, Oz, Dx, Dy, Dz)

Parameters

OUT Double Ox X coordinate of origin point.


OUT Double Oy Y coordinate of origin point.
OUT Double Oz Z coordinate of origin point.
OUT Double Dx X coordinate of direction vector.
OUT Double Dy Y coordinate of direction vector.
OUT Double Dz Z coordinate of direction vector.

Remarks

The direction vector is a unit vector.

389
Welcome

GetDirection

Method

Version : 6.5

Description :

This method gets the coordinates of the direction vector of the referenced axis.

Use

IRefAxis.GetDirection(Dx, Dy, Dz)

Parameters

OUT Double Dx X coordinate of direction vector.


OUT Double Dy Y coordinate of direction vector.
OUT Double Dz Z coordinate of direction vector.

Remarks

The direction vector is a unit vector.

390
Welcome

GetOrigin

Method

Version : 6.5

Description :

This method gets the coordinates of the origin point of the referenced axis.

Use

IRefAxis.GetOrigin(Ox, Oy, Oz)

Parameters

OUT Double Ox X coordinate of origin point.


OUT Double Oy Y coordinate of origin point.
OUT Double Oz Z coordinate of origin point.

391
Welcome

ReverseDirection

Method

Version : 6.5

Description :

This method reverses the direction of the referenced axis.

Use

IRefAxis.ReverseDirection

392
Welcome

IRefDirection

Interface

Version : 6.5

Description :

This interface is implemented in the RefDirection object, and gives access to the
specific features of this kind of reference (the common features being accessed
through the IRef interface).

393
Welcome

GetDirection

Method

Version : 6.5

Description :

This method gets the coordinates of the referenced direction vector.

Use

IRefDirection.GetDirection(Dx, Dy, Dz)

Parameters

OUT Double Dx X coordinate of direction vector.


OUT Double Dy Y coordinate of direction vector.
OUT Double Dz Z coordinate of direction vector.

Remarks

The direction vector is a unit vector.

394
Welcome

ReverseDirection

Method

Version : 6.5

Description :

This method reverses the direction of the referenced direction.

Use

IRefDirection.ReverseDirection

395
Welcome

IRefEdge

Interface

Version : 6.5

Description :

This interface is implemented in the RefEdge object, and gives access to the specific
features of this kind of reference (the common features being accessed through the
IRef interface).

396
Welcome

CurveType

Property

Version : 6.5

Description :

This property allows to get the type of the geometric curve attached to the referenced
edge.

Use

TopCurveType = IRefEdge.CurveType

397
Welcome

Identifier

Property

Version : 6.5

Description :

This property allows to get the edge identifier.

Use

Long = IRefEdge.Identifier

Remarks

This identifier is unique within the same shape.

398
Welcome

IRefEdges

Interface

Version : 6.5

Description :

This interface gives access to the collection of the edges contained in a shape.

399
Welcome

Count

Property

Version : 6.5

Description :

This property allows to get the number of edges in the collection.

Use

Integer = IRefEdges.Count

400
Welcome

Item

Property

Version : 6.5

Description :

This property allows to get an edge of the collection (1 <= Index <= Count).

Use

IRefEdge = IRefEdges.Item(Variant Index)

401
Welcome

IRefFace

Interface

Version : 6.5

Description :

This interface is implemented in the RefFace object, and gives access to the specific
features of this kind of reference (the common features being accessed through the
IRef interface).

402
Welcome

Identifier

Property

Version : 6.5

Description :

This property allows to get the face identifier.

Use

Long = IRefFace.Identifier

Remarks

This identifier is unique within the same shape.

403
Welcome

SurfaceType

Property

Version : 6.5

Description :

This property allows to get the type of the geometric surface attached to the
referenced face.

Use

TopSurfaceType = IRefFace.SurfaceType

404
Welcome

IRefFaces

Interface

Version : 6.5

Description :

This interface gives access to the collection of the faces contained in a shape.

405
Welcome

Count

Property

Version : 6.5

Description :

This property allows to get the number of faces in the collection.

Use

Integer = IRefFaces.Count

406
Welcome

Item

Property

Version : 6.5

Description :

This property allows to get a face of the collection (1 <= Index <= Count).

Use

IRefFace = IRefFaces.Item(Variant Index)

407
Welcome

IRefPlane

Interface

Version : 6.5

Description :

This interface is implemented in the RefPlane object, and gives access to the specific
features of this kind of reference (the common features being accessed through the
IRef interface).

408
Welcome

GetNormal

Method

Version : 6.5

Description :

This method gets the coordinates of the normal direction vector of the referenced
plane.

Use

IRefPlane.GetNormal(Nx, Ny, Nz)

Parameters

OUT Double Nx X coordinate of normal direction vector.


OUT Double Ny Y coordinate of normal direction vector.
OUT Double Nz Z coordinate of normal direction vector.

Remarks

The direction vector is a unit vector.

409
Welcome

GetOrigin

Method

Version : 6.5

Description :

This method gets the coordinates of the origin point of the referenced plane.

Use

IRefPlane.GetOrigin(Ox, Oy, Oz)

Parameters

OUT Double Ox X coordinate of origin point.


OUT Double Oy Y coordinate of origin point.
OUT Double Oz Z coordinate of origin point.

410
Welcome

GetPlane

Method

Version : 6.5

Description :

This method gets the coordinates of the origin point and the normal direction of the
referenced plane.

Use

IRefPlane.GetPlane(Ox, Oy, Oz, Nx, Ny, Nz)

Parameters

OUT Double Ox X coordinate of origin point.


OUT Double Oy Y coordinate of origin point.
OUT Double Oz Z coordinate of origin point.
OUT Double Nx X coordinate of normal direction vector.
OUT Double Ny Y coordinate of normal direction vector.
OUT Double Nz Z coordinate of normal direction vector.

Remarks

The direction vector is a unit vector.

411
Welcome

ReverseNormal

Method

Version : 6.5

Description :

This method reverses the normal direction of the referenced plane.

Use

IRefPlane.ReverseNormal

412
Welcome

IRefSegment

Interface

Version : 6.5

Description :

This interface is implemented in the RefSegment object, and gives access to the
specific features of this kind of reference (the common features being accessed
through the IRef interface).

413
Welcome

CurveType

Property

Version : 6.5

Description :

This property allows to get the type of the geometric curve attached to the referenced
segment.

Use

TopCurveType = IRefSegment.CurveType

414
Welcome

Identifier

Property

Version : 6.5

Description :

This property allows to get the segment identifier.

Use

Long = IRefSegment.Identifier

Remarks

This identifier is unique within the same shape.

415
Welcome

IRefSegments

Interface

Version : 6.5

Description :

This interface gives access to the collection of the segments contained in a curve.

416
Welcome

Count

Property

Version : 6.5

Description :

This property allows to get the number of segments in the collection.

Use

Integer = IRefSegments.Count

417
Welcome

Item

Property

Version : 6.5

Description :

This property allows to get a segment of the collection (1 <= Index <= Count).

Use

IRefSegment = IRefSegments.Item(Variant Index)

418
Welcome

ISet

Interface

Version : 6.5

Description :

This interface is implemented in every kind of set elements, and gives access to the
features that are common to all of them.

419
Welcome

Elements

Property

Version : 6.5

Description :

This property gives access to the collection of elements contained in the set.

Use

ISetElements = ISet.Elements

420
Welcome

Shapes

Property

Version : 6.6

Description :

This method gets the shapes of the set.

Use

Variant = ISet.Shapes

Parameters

Variant Shapes
RET Array of the shapes (IShape) (0 to UBound)
(array)

Remarks

With this method you can get the shapes of the set. The return value is an array of
IShape.

Example

421
Welcome

Dim SetShapes As Variant

Dim TopShape As TopSolid.IShape

Dim ShapeCount As Long

Dim i As Long

SetShapes = Set.Shapes

ShapeCount = UBound (SetShapes, 1)

For i = 0 To ShapeCount

Set TopShape = SetShapes(i)

...

Next i

422
Welcome

Type

Property

Version : 6.6

Description :

This method allows to get or set the type of the set.

Use

TopTypeSet = ISet.Type

ISet.Type = TopTypeSet

423
Welcome

ISetElements

Interface

Version : 6.5

Description :

This interface gives access to the collection of the elements contained by a set.

424
Welcome

Add

Method

Version : 6.5

Description :

This method adds an element to the set.

Use

ISetElements.Add(Element)

Parameters

IN IElement Element Element to add.

425
Welcome

Count

Property

Version : 6.5

Description :

This property allows to get the number of elements in the collection.

Use

Integer = ISetElements.Count

426
Welcome

Item

Property

Version : 6.5

Description :

This property allows to get an element of the collection (1 <= Index <= Count).

Use

IElement = ISetElements.Item(Variant Index)

427
Welcome

Remove

Method

Version : 6.5

Description :

This method removes an element from the set.

Use

ISetElements.Remove(Index)

Parameters

IN Variant Index Index (starting at 1) of element to remove.

428
Welcome

IShape

Interface

Version : 6.5

Description :

This interface is implemented in every kind of shapes elements, and gives access to
the features that are common to all of them.

429
Welcome

CheckGeometry

Method

Version : 6.6

Description :

This method checks the geometry of the shape.

Use

Boolean = IShape.CheckGeometry()

Parameters

RET Boolean Geometry of the shape is OK.

430
Welcome

CleanGeometry

Method

Version : 6.6

Description :

This method cleans the geometry of the shape.

Use

IShape.CleanGeometry(LinTol, AngTol)

Parameters

IN Double LinTol Linear tolerance in length program units.


IN Double AngTol Angular tolerance in angle program units.

Remarks

An error is triggered if the shape is not basic.

431
Welcome

Edges

Property

Version : 6.5

Description :

This property gives access to the collection of edges contained in the shape.

Use

IRefEdges = IShape.Edges

432
Welcome

Element

Property

Version : 6.5

Description :

This property gives access to the IElement interface of the Shape object.

Use

IElement = IShape.Element

Remarks

This may me useful to simplify VB code for accessing to the methods/properties of


the base interface (see: Multiple interfaces).

433
Welcome

Faces

Property

Version : 6.5

Description :

This property gives access to the collection of faces contained in the shape.

Use

IRefFaces = IShape.Faces

434
Welcome

FacetFace

Method

Version : 6.6

Description :

This method facets a face.

Use

IShape.FacetFace(FaceId, SurfaceTol, AngleTol, StripLength, VertX, VertY, VertZ,


NormX, NormY, NormZ)

Parameters

IN Long FaceId Id of the face.


IN Double SurfaceTol Surface tolerance.
IN Double AngleTol Angular tolerance.
Variant StripLength Array of the number of vertices of each strip
OUT
(array) (array of long).
Array of the X coordinates of the vertices
OUT Variant VertX (array)
(array of double).
Array of the Y coordinates of the vertices
OUT Variant VertY (array)
(array of double).
Array of the Z coordinates of the vertices
OUT Variant VertZ (array)
(array of double).
Variant NormX Array of the X coordinates of the vertex normal
OUT
(array) (array of double).
Variant NormY Array of the Y coordinates of the vertex normal
OUT
(array) (array of double).
OUT

435
Welcome

Variant NormZ Array of the Z coordinates of the vertex normal


(array) (array of double).

Example

Dim vertexCountInStrip As Variant

Dim vertX As Variant

Dim vertY As Variant

Dim vertZ As Variant

Dim normX As Variant

Dim normY As Variant

Dim normZ As Variant

Dim verticesNumber As Long

Dim stripNumber As Long

Dim verticesCount As long

Dim Cv As TopSolid.Curve

......

' To get the FaceCount and the Faceids, see GetShellFaces or GetBodyFaces.

For i = 0 To FaceCount

'Face tessellation.

SetShape.FacetFace FaceIds(i), -1, -1, vertexCountInStrip, vertX, vertY, vertZ, normX,


normY, normZ

verticesNumber = UBound(vertX, 1) + 1

436
Welcome

stripNumber = UBound(vertexCountInStrip, 1) + 1

verticesCount = 0

For j = 0 To stripNumber 1

For k = 0 To vertexCountInStrip(j) 3

' Creation of the lines to form triangles.

Set Cv = TopDoc3D.Curves.AddBasicLine(vertX(k + verticesCount), vertY(k +


verticesCount), vertZ(k + verticesCount), vertX(k + verticesCount + 1), vertY(k +
verticesCount + 1), vertZ(k + verticesCount + 1))

Set Cv = TopDoc3D.Curves.AddBasicLine(vertX(k + verticesCount+ 1), vertY(k +


verticesCount + 1), vertZ(k + verticesCount + 1), vertX(k + verticesCount + 2),
vertY(k + verticesCount + 2), vertZ(k + verticesCount + 2))

Set Cv = TopDoc3D.Curves.AddBasicLine(vertX(k + verticesCount + 2), vertY(k +


verticesCount + 2), vertZ(k + verticesCount + 2), vertX(k + verticesCount), vertY(k +
verticesCount), vertZ(k + verticesCount))

Next k

verticesCount = verticesCount + vertexCountInStrip(j)

Next j

Next i

437
Welcome

FindFaceWithRay

Method

Version : 6.5

Description :

This method finds the first face intersected with a ray.

Use

IRefFace = IShape.FindFaceWithRay(Ox, Oy, Oz, Dx, Dy, Dz, Ix, Iy, Iz)

Parameters

IN Double Ox X coordinate of ray origin.


IN Double Oy Y coordinate of ray origin.
IN Double Oz Z coordinate of ray origin.
IN Double Dx X coordinate of ray direction.
IN Double Dy Y coordinate of ray direction.
IN Double Dz Z coordinate of ray direction.
OUT Double Ix X coordinate of intersection.
OUT Double Iy Y coordinate of intersection.
OUT Double Iz Z coordinate of intersection.
Reference to intersected face, or Nothing if
RET IRefFace
none.

438
Welcome

GetBodies

Method

Version : 6.6

Description :

This method finds the ids of the bodies of the shape.

Use

IShape.GetBodies(BodyIds)

Parameters

Variant BodyIds
OUT Array of the ids of the bodies (array of long)
(array)

Remarks

A shape is made of zero (void), one (connected), or more (disconnected) bodies.


Each body of a shape is identified by a body identifier which is the index of the body in
the range [1, NumberOfBodies].

Example

439
Welcome

Dim BodyIds As Variant

Dim BodyCount As Long

Dim Id As Long

Dim i As Integer

...

TopShape.GetBodies BodyIds

BodyCount = UBound(BodyIds, 1)

For i = 0 To BodyCount

Id = BodyIds(i)

...

Next i

440
Welcome

GetBodyFaces

Method

Version : 6.6

Description :

This method finds the ids of the faces of a body.

Use

IShape.GetBodyFaces(BodyId, FaceIds)

Parameters

IN Long BodyId Id of the body you want the faces.


Variant FaceIds
OUT Array of the ids of the faces (array of long).
(array)

Example

Dim BodyIds As Variant

Dim BodyCount As Long

Dim BodyId As Long

Dim FaceIds As Variant

441
Welcome

Dim FaceCount As Long

Dim FaceId As Long

Dim i As Integer

Dim j As Integer

...

TopShape.GetBodies BodyIds

BodyCount = UBound(BodyIds, 1)

For i = 0 To BodyCount

BodyId = BodyIds(i)

TopShape.GetBodyFaces BodyId, FaceIds

FaceCount = UBound(FaceIds, 1)

For j = 0 To FaceCount

FaceId = FaceIds(j)

...

Next j

Next i

442
Welcome

GetBodyMass

Method

Version : 6.6

Description :

This method gets the mass of a body.

Use

IShape.GetBodyMass(BodyId, Mass)

Parameters

IN Long BodyId Id of the body you want the mass.


OUT Double Mass Mass of the body (in kg).

443
Welcome

GetBodyShells

Method

Version : 6.6

Description :

This method finds the ids of the shells of a body.

Use

IShape.GetBodyFaces(BodyId, FaceIds)

Parameters

IN Long BodyId Id of the body you want the shells.


Variant ShellIds
OUT Array of the ids of the shells (array of long).
(array)

Remarks

A sheet body is made of one shell, and a solid body is made of one extrerior shell,
and zero or more interior shells, defining voids.

Example

444
Welcome

Dim BodyIds As Variant

Dim BodyCount As Long

Dim BodyId As Long

Dim ShellIds As Variant

Dim ShellCount As Long

Dim ShellId As Long

Dim i As Integer

Dim j As Integer

...

TopShape.GetBodies BodyIds

BodyCount = UBound(BodyIds, 1)

For i = 0 To BodyCount

BodyId = BodyIds(i)

TopShape.GetBodyShells BodyId, ShellIds

ShellCount = UBound(ShellIds, 1)

For j = 0 To ShellCount

ShellId = ShellIds(j)

...

Next j

Next i

445
Welcome

GetBodyVertices

Method

Version : 6.6

Description :

This method finds the ids of the vertices of a body.

Use

IShape.GetBodyVertices(BodyId, VerticesIds)

Parameters

IN Long BodyId Id of the body you want the vertices.


Variant VerticesIds
OUT Array of the ids of the vertices (array of long).
(array)

Remarks

A sheet body is made of one shell, and a solid body is made of one extrerior shell,
and zero or more interior shells, defining voids.

Example

446
Welcome

Dim BodyIds As Variant

Dim BodyCount As Long

Dim BodyId As Long

Dim VerticesIds As Variant

Dim VerticesCount As Long

Dim VertexId As Long

Dim i As Integer

Dim j As Integer

...

TopShape.GetBodies BodyIds

BodyCount = UBound(BodyIds, 1)

For i = 0 To BodyCount

BodyId = BodyIds(i)

TopShape.GetBodyVertices BodyId, VerticesIds

VerticesCount = UBound(VerticesIds, 1)

For j = 0 To VerticesCount

VertexId = VerticesIds(j)

...

Next j

Next i

447
Welcome

GetBodyVertices

Method

Version : 6.6

Description :

This method gets the volume of a body.

Use

IShape.GetBodyVolume(BodyId, Volume)

Parameters

IN Long BodyId Id of the body you want the volume.


OUT Double Volume Volume of the body.

448
Welcome

GetBoundingBox

Method

Version : 6.6

Description :

This method gets the bounding box of an object in the global frame.

Use

IShape.GetBodyVolume(Topology, Id, Xmin, Xmax, Ymin, Ymax, Zmin, Zmax)

Parameters

IN TopTopo Topology Topology of the object.


IN Long Id Id of the object you want the bounding box.
OUT Double Xmin Minimum X coordinate of the bounding box.
OUT Double Xmax Maximum X coordinate of the bounding box.
OUT Double Ymin Minimum Y coordinate of the bounding box.
OUT Double Ymax Maximum Y coordinate of the bounding box.
OUT Double Zmin Minimum Z coordinate of the bounding box.
OUT Double Zmax Maximum Z coordinate of the bounding box.

449
Welcome

GetEdgeBsplineParams

Method

Version : 6.6

Description :

This method gets the parameters of a bspline curve. There are only the knots and the
control points in the range [Umin, Umax].

Use

IShape.GetEdgeBsplineParams(EdgeId, Umin, Umax, Rational, UClosed, UPeriodic,


USinguls, UNumCpts, UNumKnots, UDegree, CptsX, CptsY, CptsZ, Weights, UKnots,
Sense)

Parameters

IN Long EdgeId Id of the edge.


OUT Double Umin Minimum U-parameter.
OUT Double Umax Maximum U-parameter.
OUT Boolean Rational True if the curve is rational.
OUT Boolean UClosed True if the curve is U-closed.
OUT Boolean UPeriodic True if the curve is U-periodic.
Variant USinguls
OUT Array of the U-singuls (array of double).
(array)
OUT Long UNumCpts Number of U-control points.
OUT Long UNumKnots Number of the U-knots.
OUT Long UDegree U-degree.
Array of the X coordinates of the control points
OUT Variant CptsX (array)
(array of double).
OUT Variant CptsY (array)

450
Welcome

Array of the Y coordinates of the control points


(array of double).
Array of the Z coordinates of the control points
OUT Variant CptsZ (array)
(array of double).
Variant Weights
OUT Array of the weights (array of double).
(array
Variant UKnots
OUT Array of the U-knots (array of double).
(array)
True if the curve is in the same sense as the
OUT Boolean Sense
edge.

451
Welcome

GetEdgeCircleParams

Method

Version : 6.6

Description :

This method gets the parameters of a circle curve.

Use

IShape.GetEdgeCircleParams(EdgeId, Umin, Umax, P1X, P1Y, P1Z, P2X, P2Y, P2Z,


PcX, PcY, PcZ, vX, vY, vZ, Radius, Sense)

Parameters

IN Long EdgeId Id of the edge.


OUT Double Umin Minimum U-parameter.
OUT Double Umax Maximum U-parameter.
OUT Double P1X X coordinate of the minimum point.
OUT Double P1Y Y coordinate of the minimum point.
OUT Double P1Z Z coordinate of the minimum point.
OUT Double P2X X coordinate of the maximum point.
OUT Double P2Y Y coordinate of the maximum point.
OUT Double P2Z Z coordinate of the maximum point.
OUT Double PcX X coordinate of the center.
OUT Double PcY Y coordinate of the center.
OUT Double PcZ Z coordinate of the center.
OUT Double vX X coordinate of the normal.
OUT Double vY Y coordinate of the normal.
OUT Double vZ Z coordinate of the normal.

452
Welcome

OUT Double Radius Radius of the circle.


True if the curve is in the same sense as the
OUT Boolean Sense
edge.

453
Welcome

GetEdgeBsplineParams

Method

Version : 6.6

Description :

This method gets the type of curve attached to an edge.

Use

TopCurveType = IShape.GetEdgeCvType(EdgeId)

Parameters

Id of the edge you want to know the curve


IN Long EdgeId
type.
RET TopCurveType

Example

Dim BodyIds As Variant

Dim BodyCount As Long

Dim BodyId As Long

Dim ShellIds As Variant

454
Welcome

Dim ShellCount As Long

Dim ShellId As Long

Dim FaceIds As Variant

Dim FaceCount As Long

Dim FaceId As Long

Dim LoopIds As Variant

Dim LoopCount As Long

Dim LoopId As Long

Dim EdgeIds As Variant

Dim EdgeCount As Long

Dim EdgeId As Long

Dim CurveType As TopSolid.TopCurveType

Dim i As Integer

Dim j As Integer

Dim k As Integer

Dim l As Integer

Dim m As Integer

...

TopShape.GetBodies BodyIds

455
Welcome

BodyCount = UBound(BodyIds, 1)

For i = 0 To BodyCount

BodyId = BodyIds(i)

TopShape.GetBodyShells BodyId, ShellIds

ShellCount = UBound(ShellIds, 1)

For j = 0 To ShellCount

ShellId = ShellIds(j)

TopShape.GetShellFaces ShellId, FaceIds

FaceCount = UBound(FaceIds, 1)

For k = 0 Top FaceCount

FaceId = FaceIds(k)

TopShape.GetFaceLoops FaceId, LoopIds

LoopCount = UBound(LoopIds, 1)

For l = 0 To LoopCount

LoopId = LoopIds(i)

TopShape.GetLoopEdges LoopId, EdgeIds

EdgeCount = UBound(EdgeIds, 1)

For m = 0 To EdgeCount

EdgeId = EdgeIds(m)

CurveType = TopShape.GetEdgeCvType

456
Welcome

...

Next m

Next l

Next k

Next j

Next i

457
Welcome

GetEdgeEllipseParams

Method

Version : 6.6

Description :

This method gets the parameters of an ellipse curve.

Use

IShape.GetEdgeEllipseParams(EdgeId, Umin, Umax, P1X, P1Y, P1Z, P2X, P2Y, P2Z,


PcX, PcY, PcZ, VXx, VXy, VXz, VYx, VYy, VYz, RadiusX, RadiusY, Sense)

Parameters

IN Long EdgeId Id of the edge.


OUT Double Umin Minimum U-parameter.
OUT Double Umax Maximum U-parameter.
OUT Double P1X X coordinate of the minimum point.
OUT Double P1Y Y coordinate of the minimum point.
OUT Double P1Z Z coordinate of the minimum point.
OUT Double P2X X coordinate of the maximum point.
OUT Double P2Y Y coordinate of the maximum point.
OUT Double P2Z Z coordinate of the maximum point.
OUT Double PcX X coordinate of the center.
OUT Double PcY Y coordinate of the center.
OUT Double PcZ Z coordinate of the center.
OUT Double VXx X coordinate of the vector X.
OUT Double VXy Y coordinate of the vector X.
OUT Double VXz Z coordinate of the vector X.

458
Welcome

OUT Double VYx X coordinate of the vector Y.


OUT Double VYy Y coordinate of the vector Y.
OUT Double VYz Z coordinate of the vector Y.
OUT Double RadiusX Radius along X.
OUT Double RadiusY Radius along X.
True if the curve is in the same sense as the
OUT Boolean Sense
edge.

459
Welcome

GetEdgeLength

Method

Version : 6.6

Description :

This method gets the length of an edge.

Use

IShape.GetEdgeLength(EdgeId, Length)

Parameters

IN Long EdgeId Id of the edge.


OUT Double Length Length of the edge.

460
Welcome

GetEdgeLineParams

Method

Version : 6.6

Description :

This method gets the parameters of a line curve.

Use

IShape.GetEdgeLineParams(EdgeId, Umin, Umax, P1X, P1Y, P1Z, P2X, P2Y, P2Z,


Sense)

Parameters

IN Long EdgeId Id of the edge.


OUT Double Umin Minimum U-parameter.
OUT Double Umax Maximum U-parameter.
OUT Double P1X X coordinate of the minimum point.
OUT Double P1Y Y coordinate of the minimum point.
OUT Double P1Z Z coordinate of the minimum point.
OUT Double P2X X coordinate of the maximum point.
OUT Double P2Y Y coordinate of the maximum point.
OUT Double P2Z Z coordinate of the maximum point.
True if the curve is in the same sense as the
OUT Boolean Sense
edge.

461
Welcome

GetEdgeNearest

Method

Version : 6.6

Description :

This method gets the nearest point on an edge to a given point.

Use

IShape.GetEdgeNearest(EdgeId, Pt1X, Pt1Y, Pt1Z, u, Pt2X, Pt2Y, Pt2Z)

Parameters

IN Long EdgeId Id of the edge.


IN Double Pt1X X coordinate of the given point.
IN Double Pt1Y Y coordinate of the given point.
IN Double Pt1Z Z coordinate of the given point.
OUT Double u U-parameter of the nearest point.
OUT Double Pt2X X coordinate of the nearest point.
OUT Double Pt2Y Y coordinate of the nearest point.
OUT Double Pt2Z Z coordinate of the nearest point.

462
Welcome

GetEdgeNearestAsBspline

Method

Version : 6.6

Description :

This method gets the nearest point on an edge converted in bspline to a given point.
This function should be use when you have used the GetEdgeBsplineParams or
GetEdgeParasolidBsplineParams method to get the parameters of this edge.

Use

IShape.GetEdgeNearestAsBspline(EdgeId, Pt1X, Pt1Y, Pt1Z, u, Pt2X, Pt2Y, Pt2Z)

Parameters

IN Long EdgeId Id of the edge.


IN Double Pt1X X coordinate of the given point.
IN Double Pt1Y Y coordinate of the given point.
IN Double Pt1Z Z coordinate of the given point.
OUT Double u U-parameter of the nearest point.
OUT Double Pt2X X coordinate of the nearest point.
OUT Double Pt2Y Y coordinate of the nearest point.
OUT Double Pt2Z Z coordinate of the nearest point.

463
Welcome

GetEdgeParasolidBsplineParams

Method

Version : 6.6

Description :

This method gets the parasolid parameters of a bspline curve. There are all the knots
and the control points that Parasolid returns (in and out the range [Umin, Umax]).

Use

IShape.GetEdgeParasolidBsplineParams(EdgeId, Umin, Umax, Rational, UClosed,


UPeriodic, USinguls, UNumCpts, UNumKnots, UDegree, CptsX, CptsY, CptsZ,
Weights, UKnots, Sense)

Parameters

IN Long EdgeId Id of the edge.


OUT Double Umin Minimum U-parameter.
OUT Double Umax Maximum U-parameter.
OUT Boolean Rational True if the curve is rational.
OUT Boolean UClosed True if the curve is U-closed.
OUT Boolean UPeriodic True if the curve is U-periodic.
Variant USinguls
OUT Array of the U-singuls (array of double).
(array)
OUT Long UNumCpts Number of U-control points.
OUT Long UNumKnots Number of the U-knots.
OUT Long UDegree U-degree.
Array of the X coordinates of the control points
OUT Variant CptsX (array)
(array of double).
OUT Variant CptsY (array)

464
Welcome

Array of the Y coordinates of the control points


(array of double).
Array of the Z coordinates of the control points
OUT Variant CptsZ (array)
(array of double).
Variant Weights
OUT Array of the weights (array of double).
(array
Variant UKnots
OUT Array of the U-knots (array of double).
(array)
True if the curve is in the same sense as the
OUT Boolean Sense
edge.

465
Welcome

GetEdgePosition

Method

Version : 6.6

Description :

This method gets the position on the edge, at a given parameter.

Use

IShape.GetEdgePosition(EdgeId, u, PtX, PtY, PtZ)

Parameters

IN Long EdgeId Id of the edge.


IN Double u U-parameter.
OUT Double PtX X coordinate of the position.
OUT Double PtY Y coordinate of the position.
OUT Double PtZ Z coordinate of the position.

466
Welcome

GetEdgePositionAsBspline

Method

Version : 6.6

Description :

This method gets the position on the edge, converted in bspline, at a given parameter.
This function should be use when you have used the GetEdgeBsplineParams or
GetEdgeParasolidBsplineParams method to get the parameters of this edge.

Use

IShape.GetEdgePositionAsBspline(EdgeId, u, PtX, PtY, PtZ)

Parameters

IN Long EdgeId Id of the edge.


IN Double u U-parameter.
OUT Double PtX X coordinate of the position.
OUT Double PtY Y coordinate of the position.
OUT Double PtZ Z coordinate of the position.

467
Welcome

GetEdgeVertices

Method

Version : 6.6

Description :

This method finds the ids of the start and terminate vertices of an edge.

Use

IShape.GetEdgeVertices(EdgeId, SVertexId, TVertexId)

Parameters

IN Long EdgeId Id of the edge.


OUT Long SVertexId Id of the start vertex.
OUT Long TVertexId Id of the terminate vertex.

Remarks

An edge is made of 2 vertices.

Example

468
Welcome

Dim BodyIds As Variant

Dim BodyCount As Long

Dim BodyId As Long

Dim ShellIds As Variant

Dim ShellCount As Long

Dim ShellId As Long

Dim FaceIds As Variant

Dim FaceCount As Long

Dim FaceId As Long

Dim LoopIds As Variant

Dim LoopCount As Long

Dim LoopId As Long

Dim EdgeIds As Variant

Dim EdgeCount As Long

Dim EdgeId As Long

Dim SVertexId As Long

Dim TVertexId As Long

Dim i As Integer

Dim j As Integer

Dim k As Integer

469
Welcome

Dim l As Integer

Dim m As Integer

...

TopShape.GetBodies BodyIds

BodyCount = UBound(BodyIds, 1)

For i = 0 To BodyCount

BodyId = BodyIds(i)

TopShape.GetBodyShells BodyId, ShellIds

ShellCount = UBound(ShellIds, 1)

For j = 0 To ShellCount

ShellId = ShellIds(j)

TopShape.GetShellFaces ShellId, FaceIds

FaceCount = UBound(FaceIds, 1)

For k = 0 Top FaceCount

FaceId = FaceIds(k)

TopShape.GetFaceLoops FaceId, LoopIds

LoopCount = UBound(LoopIds, 1)

For l = 0 To LoopCount

LoopId = LoopIds(i)

TopShape.GetLoopEdges LoopId, EdgeIds

470
Welcome

EdgeCount = UBound(EdgeIds, 1)

For m = 0 To EdgeCount

EdgeId = EdgeIds(m)

TopShape.GetEdgeVertices EdgeId, SVertexId, TVertexId

...

Next m

Next l

Next k

Next j

Next i

471
Welcome

GetFaceAre

Method

Version : 6.6

Description :

This method gets the area of a face.

Use

IShape.GetFaceArea(FaceId, Area)

Parameters

IN Long FaceId Id of the face you want the area.


OUT Double Area Area of the face
OUT Long TVertexId Id of the terminate vertex.

472
Welcome

GetFaceBsplineParams

Method

Version : 6.6

Description :

This method gets the parameters of a bspline surface. There are only the knots and
the control points in the range [Umin, Umax] [Vmin, Vmax].

Use

IShape.GetFaceBsplineParams(FaceId, Umin, Umax, Vmin, Vmax, Rational,


UClosed, VClosed, UPeriodic, VPeriodic, USinguls, VSinguls, UNumCpts, VNumCpts,
UNumKnots, VNumKnots, UDegree, VDegree, CptsX, CptsY, CptsZ, Weights, UKnots,
VKnots, Sense)

Parameters

IN Long EdgeId Id of the edge.


OUT Double Umin Minimum U-parameter.
OUT Double Umax Maximum U-parameter.
OUT Double Vmin Minimum V-parameter.
OUT Double Vmax Maximum V-parameter.
OUT Boolean Rational True if the curve is rational.
OUT Boolean UClosed True if the curve is U-closed.
OUT Boolean VClosed True if the curve is V-closed.
OUT Boolean UPeriodic True if the curve is U-periodic.
OUT Boolean VPeriodic True if the curve is V-periodic.
Variant USinguls
OUT Array of the U-singuls (array of double).
(array)
OUT Array of the V-singuls (array of double).

473
Welcome

Variant VSinguls
(array)
OUT Long UNumCpts Number of U-control points.
OUT Long VNumCpts Number of V-control points.
OUT Long UNumKnots Number of the U-knots.
OUT Long VNumKnots Number of the V-knots.
OUT Long UDegree U-degree.
OUT Long VDegree V-degree.
Array of the X coordinates of the control points
OUT Variant CptsX (array)
(array of double).
Array of the Y coordinates of the control points
OUT Variant CptsY (array)
(array of double).
Array of the Z coordinates of the control points
OUT Variant CptsZ (array)
(array of double).
Variant Weights
OUT Array of the weights (array of double).
(array
Variant UKnots
OUT Array of the U-knots (array of double).
(array)
Variant VKnots
OUT Array of the V-knots (array of double).
(array)
OUT Boolean Sense True if the face is outside oriented.

474
Welcome

GetFaceConeParams

Method

Version : 6.6

Description :

This method gets the parameters of a cone surface.

Use

IShape.GetFaceConeParams(FaceId, Umin, Umax, Vmin, Vmax, PoX, PoY, PoZ, vX,


vY, vZ, Radius, HAngle, Sense)

Parameters

IN Long EdgeId Id of the edge.


OUT Double Umin Minimum U-parameter.
OUT Double Umax Maximum U-parameter.
OUT Double Vmin Minimum V-parameter.
OUT Double Vmax Maximum V-parameter.
OUT Double PoX X coordinate of the origin.
OUT Double PoY Y coordinate of the origin.
OUT Double PoZ Z coordinate of the origin.
OUT Double vX X coordinate of the axis.
OUT Double vY Y coordinate of the axis.
OUT Double vZ Z coordinate of the axis.
OUT Double Radius Radius of the cone.
OUT Double HAngle Half-angle of the cone.
OUT Boolean Sense True if the face is outside oriented.

475
Welcome

476
Welcome

GetFaceCylinderParams

Method

Version : 6.6

Description :

This method gets parameters of a cylinder surface.

Use

IShape.GetFaceCylinderParams(FaceId, Umin, Umax, Vmin, Vmax, PoX, PoY, PoZ,


vX, vY, vZ, Radius, Sense)

Parameters

IN Long EdgeId Id of the edge.


OUT Double Umin Minimum U-parameter.
OUT Double Umax Maximum U-parameter.
OUT Double Vmin Minimum V-parameter.
OUT Double Vmax Maximum V-parameter.
OUT Double PoX X coordinate of the origin.
OUT Double PoY Y coordinate of the origin.
OUT Double PoZ Z coordinate of the origin.
OUT Double vX X coordinate of the axis.
OUT Double vY Y coordinate of the axis.
OUT Double vZ Z coordinate of the axis.
OUT Double Radius Radius of the cyrlinder.
OUT Boolean Sense True if the face is outside oriented.

477
Welcome

478
Welcome

GetFaceLoops

Method

Version : 6.6

Description :

This method finds the ids of the loops of a face.

Use

IShape.GetFaceLoops(FaceId, LoopIds)

Parameters

IN Long FaceId Id of the face.


Variant LoopIds
OUT Array of the ids of the loops (array of long).
(array)

Remarks

A face is made of one external loop, and zero or more internal loops, defining holes.

Example

479
Welcome

Dim BodyIds As Variant

Dim BodyCount As Long

Dim BodyId As Long

Dim ShellIds As Variant

Dim ShellCount As Long

Dim ShellId As Long

Dim FaceIds As Variant

Dim FaceCount As Long

Dim FaceId As Long

Dim LoopIds As Variant

Dim LoopCount As Long

Dim LoopId As Long

Dim i As Integer

Dim j As Integer

Dim k As Integer

Dim l As Integer

...

TopShape.GetBodies BodyIds

BodyCount = UBound(BodyIds, 1)

480
Welcome

For i = 0 To BodyCount

BodyId = BodyIds(i)

TopShape.GetBodyShells BodyId, ShellIds

ShellCount = UBound(ShellIds, 1)

For j = 0 To ShellCount

ShellId = ShellIds(j)

TopShape.GetShellFaces ShellId, FaceIds

FaceCount = UBound(FaceIds, 1)

For k = 0 Top FaceCount

FaceId = FaceIds(k)

TopShape.GetFaceLoops FaceId, LoopIds

LoopCount = UBound(LoopIds, 1)

For l = 0 To LoopCount

LoopId = LoopIds(i)

...

Next l

Next k

Next j

481
Welcome

Next i

482
Welcome

GetFaceNearest

Method

Version : 6.6

Description :

This method gets the nearest point on a face to a given point.

Use

IShape.GetFaceNearest(FaceId, Pt1X, Pt1Y, Pt1Z, u, v, Pt2X, Pt2Y, Pt2Z)

Parameters

IN Long EdgeId Id of the edge.


IN Double Pt1X X coordinate of the given point.
IN Double Pt1Y Y coordinate of the given point.
IN Double Pt1Z Z coordinate of the given point.
OUT Double u U-parameter of the nearest point.
OUT Double v V-parameter of the nearest point.
OUT Double Pt2X X coordinate of the nearest point.
OUT Double Pt2Y Y coordinate of the nearest point.
OUT Double Pt2Z Z coordinate of the nearest point.

483
Welcome

GetFaceNormal

Method

Version : 6.6

Description :

This method gets the face normal vector in parameter (u,v).

Use

IShape.GetFaceNormal(FaceId, u, v, vX, vY, vZ)

Parameters

IN Long FaceId Id of the edge.


IN Double u U-parameter.
IN Double v V-parameter.
OUT Double vX X coordinate of the normal.
OUT Double vY Y coordinate of the normal.
OUT Double vZ Z coordinate of the normal.

484
Welcome

GetFaceBsplineParams

Method

Version : 6.6

Description :

This method gets the parameters of a bspline surface. There are all the knots and the
control points that Parasolid returns (in and out the range [Umin, Umax] [Vmin,
Vmax]).

Use

IShape.GetFaceParasolidBsplineParams(FaceId, Umin, Umax, Vmin, Vmax,


Rational, UClosed, VClosed, UPeriodic, VPeriodic, USinguls, VSinguls, UNumCpts,
VNumCpts, UNumKnots, VNumKnots, UDegree, VDegree, CptsX, CptsY, CptsZ,
Weights, UKnots, VKnots, Sense)

Parameters

IN Long EdgeId Id of the edge.


OUT Double Umin Minimum U-parameter.
OUT Double Umax Maximum U-parameter.
OUT Double Vmin Minimum V-parameter.
OUT Double Vmax Maximum V-parameter.
OUT Boolean Rational True if the curve is rational.
OUT Boolean UClosed True if the curve is U-closed.
OUT Boolean VClosed True if the curve is V-closed.
OUT Boolean UPeriodic True if the curve is U-periodic.
OUT Boolean VPeriodic True if the curve is V-periodic.
OUT Variant USinguls Array of the U-singuls (array of double).
(array)

485
Welcome

Variant VSinguls
OUT Array of the V-singuls (array of double).
(array)
OUT Long UNumCpts Number of U-control points.
OUT Long VNumCpts Number of V-control points.
OUT Long UNumKnots Number of the U-knots.
OUT Long VNumKnots Number of the V-knots.
OUT Long UDegree U-degree.
OUT Long VDegree V-degree.
Array of the X coordinates of the control points
OUT Variant CptsX (array)
(array of double).
Array of the Y coordinates of the control points
OUT Variant CptsY (array)
(array of double).
Array of the Z coordinates of the control points
OUT Variant CptsZ (array)
(array of double).
Variant Weights
OUT Array of the weights (array of double).
(array
Variant UKnots
OUT Array of the U-knots (array of double).
(array)
Variant VKnots
OUT Array of the V-knots (array of double).
(array)
OUT Boolean Sense True if the face is outside oriented.

486
Welcome

GetFacePlaneParams

Method

Version : 6.6

Description :

This method gets the parameters of a plane surface.

Use

IShape.GetFacePlaneParams(FaceId, Umin, Umax, Vmin, Vmax, PoX, PoY, PoZ, vX,


vY, vZ, Sense)

Parameters

IN Long FaceId Id of the face.


OUT Double Umin Minimum U-parameter.
OUT Double Umax Maximum U-parameter.
OUT Double Vmin Minimum V-parameter.
OUT Double Vmax Maximum V-parameter.
OUT Double PoX X coordinate of the origin.
OUT Double PoY Y coordinate of the origin.
OUT Double PoZ Z coordinate of the origin.
OUT Double vX X coordinate of the axis.
OUT Double vY Y coordinate of the axis.
OUT Double vZ Z coordinate of the axis.
OUT Boolean Sense True if the face is outside oriented.

487
Welcome

488
Welcome

GetFacePosition

Method

Version : 6.6

Description :

This method gets the position on a face corresponding to given parameters.

Use

IShape.GetFacePosition(FaceId, u, v, PtX, PtY, PtZ)

Parameters

IN Long FaceI Id of the face you want to project.


IN Double u U-parameter.
IN Double v V-parameter
OUT Double PtX X coordinate of the position.
OUT Double PtY Y coordinate of the position.
OUT Double PtZ Z coordinate of the position.

489
Welcome

GetFaceShells

Method

Version : 6.6

Description :

This method finds the ids of the shells of a face.

Use

IShape.GetFaceShells(FaceId, ShellIds)

Parameters

IN Long FaceId Id of the face.


Variant ShellIds
OUT Array of the ids of the shells (array of long).
(array)

Example

Dim BodyIds As Variant

Dim BodyCount As Long

Dim BodyId As Long

Dim FaceIds As Variant

490
Welcome

Dim FaceCount As Long

Dim FaceId As Long

Dim ShellIds As Variant

Dim ShellCount As Long

Dim ShellId As Long

Dim i As Integer

Dim j As Integer

Dim k As Integer

...

TopShape.GetBodies BodyIds

BodyCount = UBound(BodyIds, 1)

For i = 0 To BodyCount

BodyId = BodyIds(i)

TopShape.GetBodyFaces BodyId, FaceIds

FaceCount = UBound(FaceIds, 1)

For j = 0 To FaceCount

FaceId = FaceIds(j)

TopShape.GetFaceShells FaceId, ShellIds

ShellCount = UBound(ShellIds, 1)

491
Welcome

For k = 0 Top ShellCount

ShellId = ShellIds(k)

...

Next k

Next j

Next i

492
Welcome

GetFaceSfType

Method

Version : 6.6

Description :

This method gets the type of surface attached to a face.

Use

TopSurfaceType = IShape.GetFaceSfType(FaceId)

Parameters

Id of the face you want to know the surface


IN Long FaceId
type.
RET TopSurfaceType

Example

Dim BodyIds As Variant

Dim BodyCount As Long

Dim BodyId As Long

Dim ShellIds As Variant

493
Welcome

Dim ShellCount As Long

Dim ShellId As Long

Dim FaceIds As Variant

Dim FaceCount As Long

Dim FaceId As Long

Dim SurfaceType As TopSolid.TopSurfaceType

Dim i As Integer

Dim j As Integer

Dim k As Integer

Dim l As Integer

Dim m As Integer

...

TopShape.GetBodies BodyIds

BodyCount = UBound(BodyIds, 1)

For i = 0 To BodyCount

BodyId = BodyIds(i)

TopShape.GetBodyShells BodyId, ShellIds

ShellCount = UBound(ShellIds, 1)

For j = 0 To ShellCount

494
Welcome

ShellId = ShellIds(j)

TopShape.GetShellFaces ShellId, FaceIds

FaceCount = UBound(FaceIds, 1)

For k = 0 Top FaceCount

FaceId = FaceIds(k)

SurfaceType = TopShape.GetFaceSfType(FaceId)

...

Next k

Next j

Next i

495
Welcome

GetFaceSphereParams

Method

Version : 6.6

Description :

This method gets the parameters of a sphere surface.

Use

IShape.GetFaceSphereParams(FaceId, Umin, Umax, Vmin, Vmax, PcX, PcY, PcZ,


Radius, Sense)

Parameters

IN Long FaceId Id of the face.


OUT Double Umin Minimum U-parameter.
OUT Double Umax Maximum U-parameter.
OUT Double Vmin Minimum V-parameter.
OUT Double Vmax Maximum V-parameter.
OUT Double PcX X coordinate of the center.
OUT Double PcY Y coordinate of the center.
OUT Double PcZ Z coordinate of the center.
OUT Double Radius Radius of the sphere.
OUT Boolean Sense True if the face is outside oriented.

496
Welcome

497
Welcome

GetFaceTorusParams

Method

Version : 6.6

Description :

This method gets the parameters of a torus surface.

Use

IShape.GetFaceTorusParams(FaceId, Umin, Umax, Vmin, Vmax, PcX, PcY, PcZ, vX,


vY, vZ, MinorRadius, MajorRadius, Sense)

Parameters

IN Long FaceId Id of the face.


OUT Double Umin Minimum U-parameter.
OUT Double Umax Maximum U-parameter.
OUT Double Vmin Minimum V-parameter.
OUT Double Vmax Maximum V-parameter.
OUT Double PcX X coordinate of the center.
OUT Double PcY Y coordinate of the center.
OUT Double PcZ Z coordinate of the center.
OUT Double vX X coordinate of the normal.
OUT Double vX Y coordinate of the normal.
OUT Double vX Z coordinate of the normal.
OUT Double MajorRadius Minor radius of the torus.
OUT Double MinorRadius Major radius of the torus.
OUT Boolean Sense True if the face is outside oriented.

498
Welcome

499
Welcome

GetFaceVertices

Method

Version : 6.6

Description :

This method finds the ids of the vertices of a face.

Use

IShape.GetFaceVertices(FaceId, VerticesIds)

Parameters

IN Long FaceId Id of the face you want the vertices.


Variant VerticesIds
OUT Array of the ids of the vertices (array of long).
(array)

Example

Dim BodyIds As Variant

Dim BodyCount As Long

Dim BodyId As Long

Dim FaceIds As Variant

500
Welcome

Dim FaceCount As Long

Dim FaceId As Long

Dim VerticesIds As Variant

Dim VerticesCount As Long

Dim VertexId As Long

Dim i As Integer

Dim j As Integer

Dim k As Integer

...

TopShape.GetBodies BodyIds

BodyCount = UBound(BodyIds, 1)

For i = 0 To BodyCount

BodyId = BodyIds(i)

TopShape.GetBodyFaces BodyId, FaceIds

FaceCount = UBound(FaceIds, 1)

For j = 0 To FaceCount

FaceId = FaceIds(j)

TopShape.GetFaceVertices FaceId, VerticesIds

VerticesCount = UBound(VerticesIds, 1)

501
Welcome

For k = 0 Top VerticesCount

VertexId = VerticesIds(k)

...

Next k

Next j

Next i

502
Welcome

GetIdFromMoniker

Method

Version : 6.6

Description :

This method gets the id and the topology of the object which has the identifier
Moniker.

Use

IShape.GetIdFromMoniker(Moniker, Topology, Id)

Parameters

Moniker of the object you wand the if and the


IN String Moniker
topology
OUT TopTopo Topology Type of the topology of the object.
OUT Long Id Id of the object.

503
Welcome

GetLoopEdges

Method

Version : 6.6

Description :

This method finds the ids of the edges of a loop.

Use

IShape.GetLoopEdges(LoopId, EdgeIds)

Parameters

IN Long LoopId Id of the loop you want the edges.


Variant VerticesIds
OUT Array of the ids of the edges(array of long).
(array)

Remarks

A loop is made of one or more internal edges.

Example

Dim BodyIds As Variant

504
Welcome

Dim BodyCount As Long

Dim BodyId As Long

Dim ShellIds As Variant

Dim ShellCount As Long

Dim ShellId As Long

Dim FaceIds As Variant

Dim FaceCount As Long

Dim FaceId As Long

Dim LoopIds As Variant

Dim LoopCount As Long

Dim LoopId As Long

Dim EdgeIds As Variant

Dim EdgeCount As Long

Dim EdgeId As Long

Dim i As Integer

Dim j As Integer

Dim k As Integer

Dim l As Integer

Dim m As Integer

...

505
Welcome

TopShape.GetBodies BodyIds

BodyCount = UBound(BodyIds, 1)

For i = 0 To BodyCount

BodyId = BodyIds(i)

TopShape.GetBodyShells BodyId, ShellIds

ShellCount = UBound(ShellIds, 1)

For j = 0 To ShellCount

ShellId = ShellIds(j)

TopShape.GetShellFaces ShellId, FaceIds

FaceCount = UBound(FaceIds, 1)

For k = 0 Top FaceCount

FaceId = FaceIds(k)

TopShape.GetFaceLoops FaceId, LoopIds

LoopCount = UBound(LoopIds, 1)

For l = 0 To LoopCount

LoopId = LoopIds(i)

TopShape.GetLoopEdges LoopId, EdgeIds

EdgeCount = UBound(EdgeIds, 1)

506
Welcome

For m = 0 To EdgeCount

EdgeId = EdgeIds(m)

...

Next m

Next l

Next k

Next j

Next i

507
Welcome

GetLoopType

Method

Version : 6.6

Description :

This method gets the type of the loop.

Use

TopLoopType = IShape.GetLoopType(LoopId)

Parameters

IN Long LoopId Id of the loop you want the type.


RET TopLoopType Array of the ids of the edges(array of long).

508
Welcome

GetLoopVertices

Method

Version : 6.6

Description :

This method finds the ids of the vertices of a loop.

Use

IShape.GetLoopVertices(LoopId, VerticesIds)

Parameters

IN Long LoopId Id of the loop you want the vertices.


Variant VerticesIds
OUT Array of the ids of the vertices (array of long).
(array)

509
Welcome

GetMonikerFromId

Method

Version : 6.6

Description :

This method gets a unique and persistent identifier of the object, in a string. This
identifier is persistent until a topological modification on the shape.

Use

String = IShape.GetMonikerFromId(Topology, Id)

Parameters

IN TopTopo Topology Topology of the object.


IN Long Id Id of the object you want the unique identifier.
RET String Unique and persistent identifier of the object.

Remarks

The loops without edges (like topLoopTypeVertex) and the vertices without edges
can't have unique identifier.

510
Welcome

GetShellFaces

Method

Version : 6.6

Description :

This method finds the ids of the faces of a shell.

Use

IShape.GetShellFaces(ShellId, FaceIds)

Parameters

IN Long ShellId Id of the shell you want the faces.


Variant FaceIds
OUT Array of the ids of the faces (array of long).
(array)

Remarks

A shell is made of one or more faces.

Example

Dim BodyIds As Variant

511
Welcome

Dim BodyCount As Long

Dim BodyId As Long

Dim ShellIds As Variant

Dim ShellCount As Long

Dim ShellId As Long

Dim FaceIds As Variant

Dim FaceCount As Long

Dim FaceId As Long

Dim i As Integer

Dim j As Integer

Dim k As Integer

...

TopShape.GetBodies BodyIds

BodyCount = UBound(BodyIds, 1)

For i = 0 To BodyCount

BodyId = BodyIds(i)

TopShape.GetBodyShells BodyId, ShellIds

ShellCount = UBound(ShellIds, 1)

For j = 0 To ShellCount

512
Welcome

ShellId = ShellIds(j)

TopShape.GetShellFaces ShellId, FaceIds

FaceCount = UBound(FaceIds, 1)

For k = 0 Top FaceCount

FaceId = FaceIds(k)

...

Next k

Next j

Next i

513
Welcome

GetVertexPoint

Method

Version : 6.6

Description :

This method gets the geometric point associated to a vertex.

Use

IShape.GetVertexPoint(VertexId, PointX, PointY, PointZ)

Parameters

IN Long VertexId Id of the vertex you want the point.


OUT Double PointX X coordinate of the point.
OUT Double PointY Y coordinate of the point.
OUT Double PointZ Z coordinate of the point.

Example

Dim BodyIds As Variant

Dim BodyCount As Long

Dim BodyId As Long

514
Welcome

Dim ShellIds As Variant

Dim ShellCount As Long

Dim ShellId As Long

Dim FaceIds As Variant

Dim FaceCount As Long

Dim FaceId As Long

Dim LoopIds As Variant

Dim LoopCount As Long

Dim LoopId As Long

Dim EdgeIds As Variant

Dim EdgeCount As Long

Dim EdgeId As Long

Dim SVertexId As Long

Dim TVertexId As Long

Dim PtX As Double

Dim PtY As Double

Dim PtZ As Double

Dim i As Integer

Dim j As Integer

Dim k As Integer

515
Welcome

Dim l As Integer

Dim m As Integer

...

TopShape.GetBodies BodyIds

BodyCount = UBound(BodyIds, 1)

For i = 0 To BodyCount

BodyId = BodyIds(i)

TopShape.GetBodyShells BodyId, ShellIds

ShellCount = UBound(ShellIds, 1)

For j = 0 To ShellCount

ShellId = ShellIds(j)

TopShape.GetShellFaces ShellId, FaceIds

FaceCount = UBound(FaceIds, 1)

For k = 0 Top FaceCount

FaceId = FaceIds(k)

TopShape.GetFaceLoops FaceId, LoopIds

LoopCount = UBound(LoopIds, 1)

For l = 0 To LoopCount

LoopId = LoopIds(i)

TopShape.GetLoopEdges LoopId, EdgeIds

516
Welcome

EdgeCount = UBound(EdgeIds, 1)

For m = 0 To EdgeCount

EdgeId = EdgeIds(m)

TopShape.GetEdgeVertices EdgeId, SVertexId, TVertexId

TopShape.GetVertexPoint SVertexId, PtX, PtY, PtZ

...

Next m

Next l

Next k

Next j

Next i

517
Welcome

IsFaceShellOuter

Method

Version : 6.6

Description :

This method tells if the shell of the face is outer a region.

Use

TopLog = IShape.IsFaceShellOuter(FaceId)

Parameters

IN Long FaceId Id of the face.


True if the shell is outer, False if the shell is
RET TopLog
inner, Unknown if it's other.

518
Welcome

IsLoopOuter

Method

Version : 6.6

Description :

This method tells if a loop is the outer boundary of a face..

Use

TopLog = IShape.IsLoopOuter(LoopId)

Parameters

IN Long LoopId Id of the loop.


True if the loop is outer, False if the loop is
RET TopLog
inner, Unknown if it's other.

519
Welcome

IsSameOrientFinEdge

Method

Version : 6.6

Description :

This method tells if the edge is in the same sense as its fin on the specified face.

Use

Boolean = IShape.IsSameOrientFinEdge(EdgeId, FaceId)

Parameters

IN Long EdgeId Id of the edge.


IN Long FaceId Id of the face.
True if the edge and its fin are in the same
RET Boolean
sense.

520
Welcome

IsShellOuter

Method

Version : 6.6

Description :

This method tells if a shell is outer a region.

Use

TopLog = IShape.IsShellOuter(ShellId)

Parameters

IN Long ShellId Id of the shell.


True if the shell is outer, False if the shell is inner,
RET TopLog
Unknown if it's other.

521
Welcome

Purge

Method

Version : 6.6

Description :

This method purges the shape.

Use

IShape.Purge()

522
Welcome

SimplifyGeometry

Method

Version : 6.6

Description :

This method simplifies the geometry of the shape.

Use

IShape.SimplifyGeometry(LinTol, AngTol)

Parameters

IN Double LinTol Linear tolerance in length program units.


IN Double AngTol Angular tolerance in angle program units.

Remarks

An error is triggered if the shape is not basic.

523
Welcome

Type

Method

Version : 6.6

Description :

This property allows to get the type of the shape.

Use

TopShapeType = IShape.Type

524
Welcome

Transparency

Method

Version : 6.6

Description :

This property allows to get and set the shape transparency.

Use

Integer = IShape.Transparency

IShape.Transparency= Integer

Remarks

Valid transparency values are within [0, 10].

- 0 stands for full opacity

- 10 stands for full transparency

525
Welcome

IShapeOperation

Interface

Version : 6.5

Description :

This interface is implemented in every kind of shape operations elements, and gives
access to the features that are common to all of them.

526
Welcome

IShapeOperations

Interface

Version : 6.5

Description :

This interface gives access to the collection of the operations of a part.

527
Welcome

AddIntersection

Method

Version : 6.5

Description :

This method adds an intersection operation to a part.

Use

IShapeOperation = IShapeOperations.AddIntersection(Tool, Radius, Hide, Follow)

Parameters

IN IElement Tool Tool element to use.


Radius parameter if fillet wanted at
IN IParameter Radius intersection edges, or Nothing if not
(optional, default = Nothing)
IN Boolean Hide Hide tool (optional, default = True).
Follow subsequent operations (optional,
IN Boolean Follow
default = True).
RET IShapeOperation Created shape operation.

Example

Creating a boolean operation.

528
Welcome

AddSubstraction

Method

Version : 6.5

Description :

This method adds a subtraction operation to a part.

Use

IShapeOperation = IShapeOperations.AddSubtraction(Tool, Radius, Hide, Follow)

Parameters

IN IElement Tool Tool element to use.


Radius parameter if fillet wanted at
IN IParameter Radius intersection edges, or Nothing if not
(optional, default = Nothing)
IN Boolean Hide Hide tool (optional, default = True).
Follow subsequent operations (optional,
IN Boolean Follow
default = True).
RET IShapeOperation Created shape operation.

Example

Creating a boolean operation.

529
Welcome

AddUnion

Method

Version : 6.5

Description :

This method adds a union operation to a part.

Use

IShapeOperation = IShapeOperations.AddUnion(Tool, Radius, Hide, Follow)

Parameters

IN IElement Tool Tool element to use.


Radius parameter if fillet wanted at
IN IParameter Radius intersection edges, or Nothing if not
(optional, default = Nothing)
IN Boolean Hide Hide tool (optional, default = True).
Follow subsequent operations (optional,
IN Boolean Follow
default = True).
RET IShapeOperation Created shape operation.

Example

Creating a boolean operation.

530
Welcome

Count

Property

Version : 6.5

Description :

This property allows to get the number of operations in the collection.

Use

Integer = IShapeOperations.Count

531
Welcome

Item

Property

Version : 6.5

Description :

This property allows to get an operation of the collection (1 <= Index <= Count).

Use

IShapeOperation = IShapeOperations.Item(Variant Index)

532
Welcome

IShapePart

Interface

Version : 6.5

Description :

This interface gives access to the parts properties and methods.

533
Welcome

Operations

Property

Version : 6.5

Description :

This property gives access to the collection of operations contained in the part.

Use

IShapeOperations = IShapePart.Operations

534
Welcome

Shape

Property

Version : 6.5

Description :

This property gives access to the IShape interface of the ShapePart object.

Use

IShape = IShapePart.Shape

Remarks

This may me useful to simplify VB code for accessing to the methods/properties of


the base interface (see: Multiple interfaces).

535
Welcome

IShapes

Interface

Version : 6.5

Description :

This interface is a collection that allows to scan through the shapes of the document,
and to create new shapes with the Add* methods.

536
Welcome

AddBasicBlock

Method

Version : 6.5

Description :

This method creates a non associative block.

Use

IShape = IShapes.AddBasicBlock(Cx, Cy, Cz, Xx, Xy, Xz, Yx, Yy, Yz, LengthX, LengthY,
LengthZ)

Parameters

IN Double Cx X coordinate of block center.


IN Double Cy Y coordinate of block center.
IN Double Cz Z coordinate of block center.
IN Double Xx X coordinate of X direction.
IN Double Xy Y coordinate of X direction.
IN Double Xz Z coordinate of X direction.
IN Double Yx X coordinate of Y direction.
IN Double Yy Y coordinate of Y direction.
IN Double Yz Z coordinate of Y direction.
Length along X direction in length program
IN Double LengthX
units.
Length along Y direction in length program
IN Double LengthY
units.
Length along Z direction in length program
IN Double LengthZ
units.

537
Welcome

RET IShape Created shape.

Remarks

The X and Y directions do not need to be exactly perpendicular (the Y direction will
be automatically modified to become perpendicular to the X direction), but they must
not be parallel.

538
Welcome

AddBasicExtruded

Method

Version : 6.5

Description :

This method creates a non associative extruded shape.

Use

IShape = IShapes.AddBasicExtruded(Curve, Dx, Dy, Dz, Length, Angle, Shift,


Centered, Solid)

Parameters

IN ICurve Curve Section curve.


IN Double Dx X coordinate of extrusion direction.
IN Double Dy Y coordinate of extrusion direction.
IN Double Dz Z coordinate of extrusion direction.
IN Double Length Extrusion length in length program units.
Draft angle in angle program units
IN Double Angle
(optional, default = 0).
Shift distance in length program units
IN Double Shift
(optional, default = 0).
Use centered alignment (optional, default
IN Boolean Centered
= False).
Make solid shape (optional, default =
IN Boolean Solid
True).
RET IShape Created shape.

539
Welcome

Remarks

As the produced shape is not associative, the input curve may be deleted once used.

Example

Creating a basic extruded shape.

540
Welcome

AddBasicRevolved

Method

Version : 6.5

Description :

This method creates a non associative revolved shape.

Use

IShape = IShapes.AddBasicRevolved(Curve, Ox, Oy, Oz, Dx, Dy, Dz, Angle, Solid)

Parameters

IN ICurve Curve Section curve.


IN Double Ox X coordinate of revolution axis origin.
IN Double Oy Y coordinate of revolution axis origin.
IN Double Oz Z coordinate of revolution axis origin.
IN Double Dx X coordinate of revolution axis direction.
IN Double Dy Y coordinate of revolution axis direction.
IN Double Dz Z coordinate of revolution axis direction.
Revolution angle in angle program units, or
IN Double Angle
0 for 360° (optional, default = 0).
Make solid shape (optional, default =
IN Boolean Solid
True).
RET IShape Created shape.

Remarks

541
Welcome

As the produced shape is not associative, the input curve may be deleted once used.

542
Welcome

AddBasicRuled

Method

Version : 6.5

Description :

This method creates a non associative ruled shape.

Use

IShape = IShapes.AddBasicRuled(Curve1, Curve2, Segtoseg, Solid, Simplify)

Parameters

IN ICurve Curve1 First curve.


IN ICurve Curve2 Second curve.
Enforce correspondant (optional, default =
IN Boolean Segtoseg
False).
Make solid shape (optional, default =
IN Boolean Solid
True).
IN Boolean Simplify Simplify shape (optional, default = False).
RET IShape Created shape.

Remarks

As the produced shape is not associative, the input curves may be deleted once
used.

543
Welcome

AddExtrudedOnCurve

Method

Version : 6.5

Description :

This method creates an extruded shape defined by a section curve.

Use

IShape = IShapes.AddExtrudedOnCurve(Curve, Direction, Length, Angle, Shift,


Centered, Solid)

Parameters

IN ICurve Curve Section curve.


IRefDirection
IN Extrusion direction.
Direction
IN IParameter Length Extrusion length.
IN IParameter Angle Draft angle (optional, default = Nothing).
Shift distance (optional, default =
IN IParameter Shift
Nothing).
Use centered alignment (optional, default
IN Boolean Centered
= False).
Make solid shape (optional, default =
IN Boolean Solid
True).
RET IShape Created shape.

Example

544
Welcome

Creating an associative extruded shape.

545
Welcome

AddRevolvedOnCurve

Method

Version : 6.5

Description :

This method creates a revolved shape defined by a section curve.

Use

IShape = IShapes.AddRevolvedOnCurve(Curve, Axis, Angle, Solid)

Parameters

IN ICurve Curve Section curve.


IN IRefAxis Axis Revolution axis.
Revolution angle, or Nothing for 360°
IN IParameter Angle
(optional, default = Nothing).
Make solid shape (optional, default =
IN Boolean Solid
True).
RET IShape Created shape.

546
Welcome

AddRuledOnCurve

Method

Version : 6.5

Description :

This method creates a ruled shape defined by two section curves.

Use

IShape = IShapes.AddRuledOnCurve(Curve1, Curve2, InvertCv1, InvertCv2, Intrinsic,


Segtoseg, Solid, Simplify)

Parameters

IN ICurve Curve1 First section curve.


IN ICurve Curve2 Second section curve.
Invert first section curve (optional, default
IN Boolean InvertCv1
= False).
Invert second section curve (optional,
IN Boolean InvertCv2
default = False).
IN Boolean Intrinsic Intrinsic curves (optional, default = False)
Enforce correspondance (optional, default
IN Boolean Segtoseg
= False).
Make solid shape (optional, default =
IN Boolean Solid
True).
IN Boolean Simplify Simplify shape (optional, default = False).
RET IShape Created shape.

547
Welcome

Count

Property

Version : 6.5

Description :

This property allows to get the number of shapes in the collection.

Use

Integer = IShapes.Count

548
Welcome

Item

Property

Version : 6.5

Description :

This property allows to get a shape of the collection (1 <= Index <= Count).

Use

IShape = IShapes.Item(Variant Index)

549
Welcome

Sew

Method

Version : 6.5

Description :

This method sews several sheet shapes together.

Use

IShapes.Sew(Shapes, NbIters, Gap, SewnShapes)

Parameters

IN Variant Shapes Shapes to sew together.


IN Integer NbIters Number of iterations.
Distance between edges to sew together
IN Double Gap
(doubled at every iteration).
Variant
OUT New sewn shapes.
SewnShapes

Remarks

The initial shapes are deleted.

550
Welcome

Example

Sewing shapes together.

551
Welcome

IText

Interface

Version : 6.6

Description :

This interface is implemented in every kind of text elements, and gives access to the
features that are common to all of them.

552
Welcome

Element

Property

Version : 6.6

Description :

This property gives access to the IElement interface of the Text object.

Use

IElement = IText.Element

Remarks

This may me useful to simplify VB code for accessing to the methods/properties of


the base interface (see: Multiple interfaces).

553
Welcome

GetPlane

Method

Version : 6.6

Description :

This method gets the plane of a text.

Use

IText.GetPlane(Ox, Oy, Oz, VXx, VXy, VXz, VYx, VYy, VYz)

Parameters

OUT Double Ox X coordinate of the plane origin.


OUT Double Oy X coordinate of the plane origin.
OUT Double Oz X coordinate of the plane origin.
OUT Double VXx X coordinate of X vector.
OUT Double VXy Y coordinate of X vector.
OUT Double VXz Z coordinate of X vector.
OUT Double VYx X coordinate of Y vector.
OUT Double VYy Y coordinate of Y vector.
OUT Double VYz Z coordinate of Y vector.

554
Welcome

Height

Method

Version : 6.6

Description :

This property allows to get and to set the height of the text.

Use

Double = IText.Height

IText.Height = Double

Remarks

Height must be specified in meter.

555
Welcome

SetPlane

Method

Version : 6.6

Description :

This method gets the plane of a text.

Use

IText.SetPlane(Ox, Oy, Oz, VXx, VXy, VXz, VYx, VYy, VYz)

Parameters

IN Double Ox X coordinate of the plane origin.


IN Double Oy X coordinate of the plane origin.
IN Double Oz X coordinate of the plane origin.
IN Double VXx X coordinate of X vector.
IN Double VXy Y coordinate of X vector.
IN Double VXz Z coordinate of X vector.
IN Double VYx X coordinate of Y vector.
IN Double VYy Y coordinate of Y vector.
IN Double VYz Z coordinate of Y vector.

556
Welcome

String

Method

Version : 6.6

Description :

This property allows to get and to set the string of the text.

Use

String = IText.String

IText.String = String

557
Welcome

ITexts

Interface

Version : 6.56

Description :

This interface is a collection that allows to scan through the texts of the document,
and to create new texts with the Add* methods.

558
Welcome

AddBasic

Method

Version : 6.6

Description :

This method creates a non associative text.

Use

IText = ITexts.AddBasic(String, Ox, Oy, Oz, VXx, VXy, VXz, VYx, VYy, VYz)

Parameters

IN String String The text string.


IN Double Ox X coordinate.
IN Double Oy Y coordinate.
IN Double Oz Z coordinate.
IN Double VXx X coordinate of the X vector.
IN Double VXy Y coordinate of the X vector.
IN Double VXz Z coordinate of the X vector.
IN Double VYx X coordinate of the Y vector.
IN Double VYy Y coordinate of the Y vector.
IN Double VYz Z coordinate of the Y vector.
RET IText Created text

559
Welcome

Count

Property

Version : 6.6

Description :

This property allows to get the number of texts in the collection.

Use

Integer = ITexts.Count

560
Welcome

Item

Property

Version : 6.6

Description :

This property allows to get a text of the collection (1 <= Index <= Count).

Use

IText = ITexts.Item(Variant Index)

561
Welcome

TopAnalyse

Enum

Version : 6.6

Description :

This enum is used to define the type element geometrical analysis.

Constants

topVolume = 0 : Element volume (only with shape).

topArea = 1 : Element area (2D or 3D).

topMass = 2 : Element mass (only with shape).

562
Welcome

TopAskAnswer

Enum

Version : 6.5

Description :

This enum is used to define which kind of answer is received from the user when
asking him a question (see: IAsks interface).

Constants

topAskAnswerNothing = 0 : No answer (for example if the user has left the function
by pressing the escape key).

topAskAnswerOK = 1 : User has correctly answered the question.

topAskAnswerButton = 2 : User has clicked a button within the dialog bar.

topAskAnswerUndo = 3 : User has clicked "Undo".

Example

See Asking question to user example.

563
Welcome

TopBomPropType

Enum

Version : 6.6

Description :

This enum is used to define the type of BOM property value.

Constants

topBomPropUnmanaged = 0 : Type unknown.

topBomPropString = 1 : The value is a string.

topBomPropInteger = 2 : The value is an integer.

topBomPropReal = 3 : The value is a real.

Example

See Getting a BOM example.

564
Welcome

TopCircleType

Enum

Version : 6.6

Description :

This enum is used to define the type of circle when created with 3 points.

Constants

topDefaultArc = 0 : Default arc.

topComplementArc = 1 : Complementary arc.

topComplet = 2 : Complete circle.

565
Welcome

TopColor

Enum

Version : 6.5

Description :

This enum is used to define the standard colors.

Constants

topColorNothing = -2 : No color (value returned by elements that do not support the


color attribute).

topColorCustom = -1 : Custom color (value returned by elements that have a


custom RGB color attribute).

topColorBackground = 0 : Background color (depends on user settings).

topColorBlack = 1 : Black, or white if light colored background.

topColorWhite = 2 : White, or black if light colored background.

topColorDarkWhite = 3 : Gray.

topColorRed = 4 : Red.

topColorDarkRed = 5 : Dark red, or light red if light colored background.

topColorOrange = 6.

topColorDarkOrange = 7.

topColorYellow = 8.

topColorDarkYellow = 9.

topColorGreen = 10.

566
Welcome

topColorDarkGreen = 11.

topColorBlue = 12.

topColorDarkBlue = 13.

topColorViolet = 14.

topColorDarkViolet = 15.

topColorGray = 16.

topColorDarkGray = 17.

topColorOrangeRed = 18.

topColorDarkOrangeRed = 19.

topColorPink = 20.

topColorDarkPink = 21.

topColorGold = 22.

topColorDarkGold = 23.

topColorSpringGreen = 24.

topColorDarkSpringGreen = 25.

topColorCyan = 26.

topColorDarkCyan = 27.

topColorNavy = 28.

topColorDarkNavy = 29.

topColorMagenta = 30.

topColorDarkMagenta = 31.

567
Welcome

TopCurveType

Enum

Version : 6.5

Description :

This enum is used to define the type of geometric curve attached to an edge or a
segment.

Constants

topCurveTypeUnknown = -1 : Unknown type.

topCurveTypeNone = 0 : No geometry.

topCurveTypeLine = 1 : Straight line.

topCurveTypeCircle = 2 : Circular arc.

topCurveTypeEllipse = 3 : Elliptic arc.

topCurveTypeBSpline = 4 : B-spline.

568
Welcome

TopDesignMode

Enum

Version : 6.5

Description :

This enum is used to define the design modes.

Constants

topDesignModeAssociative = 0 : Associative mode.

topDesignModeFree = 1 : Free design mode.

topDesignModeNonAssociativeCurves = 2 : Non associative curves mode.

topDesignModeNonAssociative = 3 : Non associative mode.

569
Welcome

TopDirection

Enum

Version : 6.5

Description :

This enum is used to define some particular directions on a given coordinate system.

Constants

topDirectionX = 0 : Positive X direction.

topDirectionY = 1 : Positive Y direction.

topDirectionZ = 2 : Positive Z direction.

topDirectionNegativeX = 3 : Negative X direction.

topDirectionNegativeY = 4 : Negative Y direction.

topDirectionNegativeZ = 5 : Negative Z direction.

570
Welcome

TopDirection

Enum

Version : 6.6

Description :

This enum is used to define the type of external referenced documents.

Constants

topExtRefUndefined = 0 : Undefined type of link.

topExtRefGenerated = 1 : Link is generated by TopSolid document.

topExtRefUsedData = 2 : Link contains data used in TopSolid document.

topExtRefExchanged = 3 : Link and TopSolid document interact with each other.

571
Welcome

TopInterface

Enum

Version : 6.6

Description :

This enum is used to define the type of interface.

Constants

topInterfaceTop = 0 : TopSolid file format.

topInterfaceView = 1 : TopView interface.

topInterfaceVrml = 1 : Vrml interface.

topInterfaceJpeg = 1 : Jpeg interface.

topInterfacePng = 1 : Png interface.

572
Welcome

TopLevelProperty

Enum

Version : 6.6

Description :

This enum is used to define the property to apply to a level or to a list a level.

Constants

topEnable = 0 : Enable.

topDisable = 1 : Disable.

topFreeze = 2 : Freeze.

topUnfreeze = 3 : Unfreeze.

topGroup = 4 : Group.

topSplit = 5 : Ungroup.

topName = 6 : Name.

573
Welcome

TopLog

Enum

Version : 6.6

Description :

This enum is used as a boolean with 3 types.

Constants

topLogUnknown = -1

topLogBoolean = 0

topLogTrue = 1

574
Welcome

TopLoopType

Enum

Version : 6.6

Description :

This enum is used to define the type of the loop (like the parasolid loop type,
PK_LOOP_type_t).

Constants

topLoopTypeVertex = 0 : Loop is just a vertex without any edges.

topLoopTypeWire = 1 : Loop has no interior.

topLoopTypeOuter = 2 : Simple peripheral loop.

topLoopTypeInner = 3 : Simple hole.

topLoopTypeWinding = 4 : Winding loop on a periodic surface.

topLoopTypeInnerSing = 5 : Hole around the surface singularity.

topLoopTypeLikelyOuter = 6 : An apparently peripheral loop on a doubly closed


surface.

topLoopTypeLikelyInnter = 7 : An apparent hole in a doubly closed surface.

topLoopTypeUnclear = 8 : A loop dividing a periodic degenerate surface in two.

topLoopTypeError = 9 : Invalid loop.

575
Welcome

TopMessageAnswer

Enum

Version : 6.7

Description :

This enum is used to specified which button has been clicked by user in the
messagebox.

Constants

topMessageAnswerOk = 1.

topMessageAnswerCancel = 2.

topMessageAnswerRetry = 4.

topMessageAnswerYes = 6.

topMessageAnswerNo = 7.

576
Welcome

TopMessageButton

Enum

Version : 6.7

Description :

This enum is used to specified which buttons should be displayed in the message box.

Constants

topMessageButtonOk = 0 : Only OK button is displayed.

topMessageButtonOkCancel = 1 : OK and Cancel buttons are displayed.

topMessageButtonRetryCancel = 2 : Retry and Cancel buttons are displayed.

topMessageButtonYesNo = 3 : Yes and No buttons are displayed.

topMessageButtonYesNoCancel = 4 : Yes, No and Cancel buttons are displayed.

577
Welcome

TopMessageIcon

Enum

Version : 6.7

Description :

This enum is used to specified which icon should be displayed in the message box.

Constants

topMessageIconNoIcon = 0 : No icon is displayed.

topMessageIconExclamation = 1 : Exclamation icon is displayed.

topMessageIconInformation = 2 : Information icon is displayed.

topMessageIconQuestion = 3 : Question icon is displayed.

topMessageIconStop = 4 : Stop icon is displayed.

578
Welcome

TopPaperFormat

Enum

Version : 6.5

Description :

This enum is used to define the standard paper formats.

Constants

topPaperFormatCustom = -1 : Custom paper format (value returned by drawings


that have a custom paper format).

topPaperFormatA4H = 0 : Horizontal A4.

topPaperFormatA3H = 1 : Horizontal A3.

topPaperFormatA2H = 2 : Horizontal A2.

topPaperFormatA1H = 3 : Horizontal A1.

topPaperFormatA0H = 4 : Horizontal A0.

topPaperFormatA4V = 5 : Vertical A4.

topPaperFormatA3V = 6 : Vertical A3.

topPaperFormatA2V = 7 : Vertical A2.

topPaperFormatA1V = 8 : Vertical A1.

topPaperFormatA0V = 9 : Vertical A0.

topPaperFormatAH = 10 : Horizontal A.

topPaperFormatBH = 11 : Horizontal B.

topPaperFormatCH = 12 : Horizontal C.

579
Welcome

topPaperFormatDH = 13 : Horizontal D.

topPaperFormatEH = 14 : Horizontal E.

topPaperFormatAV = 15 : Vertical A.

topPaperFormatBV = 16 : Vertical B.

topPaperFormatCV = 17 : Vertical C.

topPaperFormatDV = 18 : Vertical D.

topPaperFormatEV = 19 : Vertical E.

topPaperFormatDinA4V = 20.

topPaperFormatDinA3H = 21.

topPaperFormatDinA2H = 22.

topPaperFormatDinA1H = 23.

topPaperFormatDinA0H = 24.

580
Welcome

TopParamUnitType

Enum

Version : 6.6

Description :

This enum is used to define the unit type of a parameter.

Constants

topParamUnitTypeVoid = 0 : No dimension.

topParamUnitTypeAngle = 1 : Angle.

topParamUnitTypeLength = 2 : Length.

topParamUnitTypeArea = 3 : Surface area.

topParamUnitTypeVolume = 4 : Volume.

topParamUnitTypeMass = 5 : Mass.

topParamUnitTypeTime = 6 : Time.

topParamUnitTypeSpeed = 7 : Speed.

topParamUnitTypeAccel = 8 : Acceleration.

topParamUnitTypeAspeed = 9 : Angular speed.

topParamUnitTypeAaccel = 10 : Angular acceleration.

topParamUnitTypeTemp = 11 : Temperature.

topParamUnitTypeElec = 12 : Electric current intensity.

topParamUnitTypeQmat = 13 : Quantity of matter.

581
Welcome

topParamUnitTypeLight = 14 : Light intensity.

topParamUnitTypePower = 15 : Power.

topParamUnitTypePressure = 16 : Pressure, normal stress, shear stress.

topParamUnitTypeForce = 17 : Force, weight.

topParamUnitTypeCouple = 18 : Couple, torque.

topParamUnitTypeMomentI = 19 : Massic moment of inertia.

topParamUnitTypeMomentQ = 20 : Quadratic moment of inertia.

topParamUnitTypeVMass = 21 : Volumic mass.

topParamUnitTypeFrequency = 22 : Frequency.

topParamUnitTypeEnergy = 23 : Energy.

topParamUnitTypeLMass = 24 : Lineic mass.

topParamUnitTypeDistForce = 25 : Distributed force.

topParamUnitTypeAngRigid = 26 : Angular rigidity.

topParamUnitTypeLinExpans = 27 : Lineic expansion.

topParamUnitTypeThermCond = 28 : Thermic conductivity.

topParamUnitTypeThermCapa = 29 : Thermic capacity.

topParamUnitTypeThermCapaM = 30 : Massic thermic capacity.

topParamUnitTypeThermInert = 31 : Thermic inertia.

topParamUnitTypePotential = 32 : Potential.

topParamUnitTypeElecCond = 33 : Electric conductivity.

topParamUnitTypeResistance = 34 : Resistance.

topParamUnitTypeResistivity = 35 : Resistivity.

topParamUnitTypeMolarMass = 36 : Molar mass.

topParamUnitTypeCurrentDens = 37 : Current density.

topParamUnitTypePotGrad = 38 : Potential gradient.

topParamUnitTypeFluxDens = 39 : Flux density.

582
Welcome

topParamUnitTypeTempGrad = 40 : Temperature gradient.

topParamUnitTypeThermExchg = 41 : Thermic exchange coefficient.

topParamUnitTypeVWeight = 42 : Volumic weight.

topParamUnitTypeSurfIntPower = 43 : Surfacic internal power.

topParamUnitTypeResolution = 44 : Resolution.

topParamUnitTypeInvLength = 45 : Inverse Length.

topParamUnitTypeSMass = 46 : Surfacic mass.

583
Welcome

TopShapeType

Enum

Version : 6.6

Description :

This enum is used to define the type of a shape.

Constants

topShapeTypeUnknown = -1 : Unknown type.

topShapeTypeSheet = 0 : Sheet shape.

topShapeTypeSolid = 1 : Solid shape.

topShapeTypeGeneral = 2 : General topology shape.

584
Welcome

TopSurfaceType

Enum

Version : 6.5

Description :

This enum is used to define the type of geometric surface attached to a face.

Constants

topSurfaceTypeUnknown = -1 : Unknown type.

topSurfaceTypeNone = 0 : No geometry.

topSurfaceTypePlane = 1 : Plane.

topSurfaceTypeCylinder = 2 : Cylinder.

topSurfaceTypeCone = 3 : Cone.

topSurfaceTypeSphere = 4 : Sphere.

topSurfaceTypeTorus = 5 : Torus.

topSurfaceTypeBSpline = 6 : B-spline surface.

topSurfaceTypeExtruded = 7 : Extruded surface.

topSurfaceTypeRevolved = 8 : Revolved surface.

topSurfaceTypeOffset = 9 : Offset surface.

585
Welcome

TopStandard

Enum

Version : 6.5

Description :

This enum is used to define some specific standards.

Constants

topStandardISO = 0 : International standard.

topStandardAFNOR = 1 : French standard.

topStandardANSI = 2 : American standard.

topStandardJIS = 3 : Japanese standard.

topStandardDIN = 4 : German standard.

586
Welcome

TopTopo

Enum

Version : 6.6

Description :

This enum is used to define the type of topology.

Constants

topTopoNone = 0 : Void topology.

topTopoVertex = 1 : Vertex topology.

topTopoEdge = 2 : Edge topology.

topTopoLoop = 3 : Loop topology.

topTopoFace = 4 : Face topology.

topTopoShell = 5 : Shell topology.

topTopoBody = 6 : Body topology.

topTopShape = 7 : Shape topology.

587
Welcome

TopTypeSet

Enum

Version : 6.6

Description :

This enum is used to define the type of set.

Constants

topTypeSetAssembly = 0 : The set is an assembly.

topTypeSetUnit = 1 : The set is unit.

588
Welcome

Introduction

The following examples have been developed and tested using Microsoft Visual
Basic v6, they may not work on other products or different releases of VB.

Please note that most of the examples are code extracts, and cannot be run as such.

In particular, when one or several lines of code are omitted for clarity, they will be
replaced by "...".

589
Welcome

How to start

Example

Version : 6.6

Description :

This example shows how to start with the API Com and Visual Basic.

Declaration of global variables

Option Explicit

Dim TopApp As TopSolid.Application

Dim TopDoc As TopSolid.DocumentDesign

On the form loading, initialize the application and create a new document .top

Private Sub Form_Load()

' connect Visual Basic with TopSolid

' if TopSolid isn't open, it will open a new session of TopSolid

Set TopApp = New TopSolid.Application

590
Welcome

' create a new document *.top

Set TopDoc = TopApp.Documents.Add("top")

End Sub

Creation of a basic circle

Dim TopCircle As TopSolid.Curve

' Create a basic circle

' Centre = 0, 0, 0

' X axis = 1, 0, 0

' Y axis = 0, 1, 0

' Radius = 0.01

Set TopCircle = TopDoc.Curves.AddBasicCircle(0, 0, 0, 1, 0, 0, 0, 1, 0, 0.01)

' Set the name of the circle

TopCircle.Element.Name = "Circle_1"

' Free the memory

Set TopCircle = Nothing

Creation of an extruded shape based on the circle "Circle_1"

591
Welcome

Dim TopShape As TopSolid.Shape

Dim TopElt As TopSolid.Element

Dim TopCircle As TopSolid.Curve

On Error Resume Next

' Search the curve to do the extruded

Set TopElt = TopDoc.Document.SearchElementByName("Circle_1")

' "cast" the element in circle

Set TopCircle = TopElt

If TopCircle Is Nothing Then

'error management

Exit Sub

End If

' Create a basic extruded

' Curve = Circle 1

' Z axis = 0, 0, 1

' Length = 0.02

Set TopShape = TopDoc.Shapes.AddBasicExtruded(TopCircle, 0, 0, 1, 0.02)

' Change the color of the shape

TopShape.Element.Color = topColorBlue

' Free the memory

592
Welcome
Set TopCircle = Nothing

Set TopShape = Nothing

Set TopElt = Nothing

Save of the document

' Save the document with the name how_to_start.top

' If the document is modified, TopSolid must ask the user

TopDoc.Document.SaveAs "d:\projets\how_to_start2.top", True

Close the document

' TopSolid must save the modification(first 'True')

' TopSolid must ask the user (second 'True')

TopDoc.Document.Close True, True

Close TopSolid

' Close TopSolid

TopApp.Quit

593
Welcome

On the form unloading, free memory

Private Sub Form_Unload(Cancel As Integer)

' Free memory

Set TopDoc = Nothing

Set TopApp = Nothing

End Sub

594
Welcome

Checking for version

Example

Version : 6.5

Description :

This example shows how to check for TopSolid version at the beginning of a program.

Dim TopApp As TopSolid.Application

...

Set TopApp = New TopSolid.Application

' cannot run before v6.5.212

If TopApp.Version < 605212 Then

MsgBox "This program cannot run on a TopSolid prior to v6.5.212", vbCritical

End

End If

' cannot run after v6.6

If TopApp.Version >= 606000 Then

MsgBox "This program cannot run on a TopSolid posterior to v6.6", vbCritical

595
Welcome

End

End If

...

596
Welcome

Setting program units

Example

Version : 6.5

Description :

This example shows how to set program units to work in radians for angles and inches
for lengths.

Dim TopApp As TopSolid.Application

...

Set TopApp = New TopSolid.Application

...

TopApp.ProgramUnitAngle = "rad"

TopApp.ProgramUnitLengh = "in"

...

597
Welcome

Opening a document

Example

Version : 6.5

Description :

This example shows how to open an existing document.

Dim TopApp As TopSolid.Application

...

Dim doc As TopSolid.Document

' open document

Set doc = TopApp.Documents.Open("C:\Projects\test.top")

...

598
Welcome

Setting and getting level properties

Example

Version : 6.5

Description :

This example shows how to set level properties.

Dim TopApp As TopSolid.Application

...

Dim TopDoc As TopSolid.Document

Dim levelsname(3) As Long

Dim group1(2) As Long

Dim group2(2) As String

Dim states As

Dim name As String

Dim groupname As String

' set name to levels

599
Welcome

TopDoc.SetLevelProperty topName, 10, "level10"

TopDoc.SetLevelProperty topName, 11, "level11"

TopDoc.SetLevelProperty topName, 12, "level12"

TopDoc.SetLevelProperty topName, 13, "level13"

TopDoc.SetLevelProperty topName, 20, "level20"

TopDoc.SetLevelProperty topName, 21, "level21"

TopDoc.SetLevelProperty topName, 22, "level22"

' set an array of level names

levelsname(0) = "level10"

levelsname(1) = "level11"

levelsname(2) = "level12"

levelsname(3) = "level13"

' set an array of level indexes

group1(0) = 5

group1(1) = 6

group1(2) = 7

' set another array of level names

600
Welcome

group2(0) = "level20"

group2(1) = "level21"

group2(2) = "level22"

' enable levels

TopDoc.SetLevelsPropertyByName topEnable, levelsname

' group levels and name it

TopDoc.SetLevelsProperty topGroup, group1, "Groupe 1"

TopDoc.SetLevelsProperty topGroup, group2, "Groupe 2"

' freeze the group "Groupe 1"

TopDoc.SetLevelPropertyByName topFreeze, "Groupe 1"

'active and freeze "Groupe 2"

TopDoc.SetLevelPropertyByName topEnable, "Groupe 2"

TopDoc.SetLevelPropertyByName topFreeze, "Groupe 2"

' get the properties of the level 5

601
Welcome

TopDoc.GetLevelProperties 5, states, name, groupname

' the result is :

' . states(0) = False (the level is not active)

' . states(1) = True (the level is frozen)

' . states(2) = True (the level is in a group)

' . name = "" (the level doesn't have name)

' . groupname = "Groupe 1"

' get the properties of "level12"

TopDoc.GetLevelPropertiesByName "level12", states, name, groupname

' the result is :

' . states(0) = True (the level is active)

' . states(1) = False (the level is not frozen)

' . states(2) = False (the level is not in a group)

' . states(3) = False (it's not a group)

' . name = "level12"

' . groupname = ""

' get the properties of the level 20

TopDoc.GetLevelProperties 20, states, name, groupname

' the result is :

602
Welcome

' . states(0) = True (the level is active)

' . states(1) = True (the level is frozen)

' . states(2) = True (the level is in a group)

' . states(3) = False (it's not a group)

' . name = "level20"

' . groupname = "Groupe 2" (the level 20 is in the group "Groupe 2")

603
Welcome

Importing an IGES file

Example

Version : 6.5

Description :

This example shows how to import an IGES file, and scan the created documents.

Dim TopApp As TopSolid.Application

...

Dim docs As Variant

Dim doc As TopSolid.Document

Dim vdoc As Variant

' import IGES file

Set doc = TopApp.Documents.Open("C:\IGES\test.igs", "", False, docs)

' scan created documents

For Each vdoc In docs

604
Welcome

Set doc = vdoc

' do something with doc

...

Next

...

605
Welcome

Printing all displayed documents

Example

Version : 6.5

Description :

This example shows how to print all the displayed documents.

Dim TopApp As TopSolid.Application

...

Dim doc As TopSolid.Document

For Each doc In TopApp.Documents

If doc.Visible Then

doc.PrintOut

End If

Next

...

606
Welcome

Creating a new design document

Example

Version : 6.5

Description :

This example shows two ways of creating a new design document.

The first way is the simplest one :

Dim TopApp As TopSolid.Application

...

Dim doc As TopSolid.DocumentDesign

Set doc = TopApp.Documents.Add("top")

...

The second way allows to override the user default choices (as displayed in the final
dialog box presented when using the "File | New" command, in the mode "Without
template") :

Dim TopApp As TopSolid.Application

...

607
Welcome

Dim ctx As TopSolid.ContextDesign

Dim doc As TopSolid.DocumentDesign

Set ctx = TopApp.Contexts("TopSolid.ContextDesign")

Set doc = ctx.CreateDocument(topDesignModeAssociative, True, topStandardAFNOR)

...

608
Welcome

Creating a basic parameter

Example

Version : 6.5

Description :

This example shows how to create a basic parameter.

Dim TopDoc As TopSolid.DocumentDesign

...

Dim pa As TopSolid.Parameter

' make parameter = 10mm

Set pa = TopDoc.Parameters.AddBasic(10, "mm")

...

609
Welcome

Creating a basic line

Example

Version : 6.5

Description :

This example shows how to create a basic line.

Dim TopDoc As TopSolid.DocumentDesign

...

Dim cv As TopSolid.Curve

' make line

Set cv = TopDoc.Curves.AddBasicLine(0, 0, 0, 0.03, 0, 0)

...

610
Welcome

Creating a basic B-spline curve

Example

Version : 6.5

Description :

This example shows how to create a basic B-spline curve.

Dim TopDoc As TopSolid.DocumentDesign

...

Dim pxs(1) As Double

Dim pys(1) As Double

Dim pzs(1) As Double

Dim vpxs As Variant

Dim vpys As Variant

Dim vpzs As Variant

Dim cv As TopSolid.Curve

' make interpolation points

pxs(0) = 0

pys(0) = 0

pzs(0) = 0

611
Welcome

pxs(1) = 0.05

pys(1) = 0

pzs(1) = 0

' make curve

vpxs = pxs

vpys = pys

vpzs = pzs

Set cv = TopDoc.Curves.AddBasicBSplineByInterpolation(vpxs, vpys, vpzs, 0, 0.02, 0,


0, 0, 0)

...

612
Welcome

Creating a basic composit curve

Example

Version : 6.5

Description :

This example shows how to create a basic composite curve.

Dim TopDoc As TopSolid.DocumentDesign

...

Dim cvs(3) As TopSolid.Curve

Dim vcvs As Variant

Dim cv As TopSolid.Curve

' make constituent curves

Set cvs(0) = TopDoc.Curves.AddBasicLine(0, 0, 0, 0.03, 0, 0)

Set cvs(1) = TopDoc.Curves.AddBasicLine(0.03, 0, 0, 0.03, 0.02, 0)

Set cvs(2) = TopDoc.Curves.AddBasicLine(0.03, 0.02, 0, 0, 0.02, 0)

Set cvs(3) = TopDoc.Curves.AddBasicLine(0, 0.02, 0, 0, 0, 0)

' make composite curve

613
Welcome

vcvs = cvs

Set cv = TopDoc.Curves.AddBasicComposite(vcvs)

...

614
Welcome

Creating a basic extruded shape

Example

Version : 6.5

Description :

This example shows how to create a basic extruded shape.

Dim TopDoc As TopSolid.DocumentDesign

...

Dim cv As TopSolid.Curve

Dim sh As TopSolid.Shape

' make curve

Set cv = TopDoc.Curves.AddBasicCircle(0, 0, 0, 1, 0, 0, 0, 1, 0, 0.02, 0)

' make extruded shape

Set sh = TopDoc.Shapes.AddBasicExtruded(cv, 0, 0, 1, 0.05, 0, 0, False, True)

615
Welcome

' delete curve

cv.Element.Delete

Set cv = Nothing

...

616
Welcome

Creating an associative extruded shape

Example

Version : 6.5

Description :

This example shows how to create an associative extruded shape.

Dim TopDoc As TopSolid.DocumentDesign

...

Dim cv As TopSolid.Curve

Dim dir As TopSolid.RefDirection

Dim ln As TopSolid.Parameter

Dim sh As TopSolid.Shape

' make invisible curve

Set cv = TopDoc.Curves.AddBasicCircle(0, 0, 0, 1, 0, 0, 0, 1, 0, 0.02, 0)

cv.Element.Blanked = True

' make direction reference

617
Welcome

Set dir = TopDoc.CurrentCoordinateSystem.MakeRefDirection(topDirectionZ)

' make length parameter

Set ln = TopDoc.Parameters.AddBasic(40, "mm")

' make extruded shape

Set sh = TopDoc.Shapes.AddExtrudedOnCurve(cv, dir, ln, Nothing, Nothing, False,


True)

...

618
Welcome

Creating a boolean operation

Example

Version : 6.5

Description :

This example shows how to create an associative boolean operation on a shape.

Dim TopDoc As TopSolid.DocumentDesign

...

Dim cv As TopSolid.Curve

Dim shpart As TopSolid.ShapePart

Dim shtool As TopSolid.Shape

' make basic extruded shape

Set cv = doc.Curves.AddBasicCircle(0, 0, 0, 1, 0, 0, 0, 1, 0, 0.02, 0)

Set shpart = doc.Shapes.AddBasicExtruded(cv, 0, 0, 1, 0.05, 0, 0, False, True)

cv.Element.Delete

619
Welcome

Set cv = Nothing

' make basic tool extruded shape

Set cv = doc.Curves.AddBasicCircle(0, 0, 0, 1, 0, 0, 0, 1, 0, 0.01, 0)

Set shtool = doc.Shapes.AddBasicExtruded(cv, 0, 0, 1, 0.05, 0, 0, False, True)

cv.Element.Delete

Set cv = Nothing

' make intersection operation

Call shpart.Operations.AddIntersection(shtool)

...

620
Welcome

Creating a component

Example

Version : 6.5

Description :

This example shows how to create a component.

Dim TopDoc As TopSolid.DocumentDesign

...

Dim compo As TopSolid.Component

' create component

Set compo = TopDoc.Components.Add("C:/projects/part1.top", 0.02, 0, 0)

' add to Assembly

Call TopDoc.Assembly.Elements.Add(compo)

' release component

621
Welcome

Set compo = Nothing

...

622
Welcome

Creating a standard component

Example

Version : 6.5

Description :

This example shows how to create a standard component.

Dim TopDoc As TopSolid.DocumentDesign

...

Dim compo As TopSolid.Component

' create component

Set compo = TopDoc.Components.AddStandard("AFNOR", "fastener",

"screw", "25125", "", "", "M6-40", 0.01, 0, 0)

' add to Assembly

Call TopDoc.Assembly.Elements.Add(compo)

623
Welcome

' release component

Set compo = Nothing

...

624
Welcome

Counting invalid elements

Example

Version : 6.5

Description :

This example shows how to find out the number of invalid elements in a TopSolid
document by accessing to the set of invalid elements.

Dim TopApp As TopSolid.Application

Dim TopDoc As TopSolid.DocumentDesign

Dim nbi As Integer ' number of invalid elements to find

Dim docElts As TopSolid.IElements

Dim setInv As TopSolid.Set

Set docElts = TopDoc.Document.Elements

' no set of invalid elements => no invalid element

If Not docElts.NameIsUsed("$SET_INVALIDS") Then

nbi = 0

' count elements in set of invalid elements

Else

' get set of invalid element

Set setInv = docElts("$SET_INVALIDS")

625
Welcome

' get number of elements in set of invalid elements

nbi = setInv.Elements.Count

End If

...

626
Welcome

Getting a BOM

Example

Version : 6.6

Description :

This example shows how to get a BOM of an assembly.

Dim TopDoc As TopSolid.DocumentDesign

Dim TopElt As TopSolid.Element

Dim TopBom As TopSolid.BOM

Dim TopBomLevel As TopSolid.BOMLevel

Dim i As Integer

On Error Resume Next

' Get the element $SET

Set TopElt = TopDoc3D.Assembly.Element

' Get the bom with the bom model 'NbDesRef.bom'

Set TopBom = TopDoc3D.Document.GetBOM(TopElt,


"d:\Missler\V66\bin\NbDesRef.bom")

For i = 1 To TopBom.SubLevels.Count

627
Welcome

Set TopBomLevel = TopBom.SubLevels.Item(i)

BomGetShapes TopBomLevel

Next i

Private Sub BomGetShapes(TopBomLevel As TopSolid.BOMLevel)

Dim i As Integer

Dim TopBomSubLevel As TopSolid.BOMLevel

Dim TopShapes As Variant

Dim TopShapeCount As Long

Dim TopShape As TopSolid.Shape

Dim TopShapeName As String

On Error Resume Next

If TopBomLevel.SubLevels.Count <> 0 Then

' if there are sublevels, we get them

For i = 1 To TopBomLevel.SubLevels.Count

Set TopBomSubLevel = TopBomLevel.SubLevels.Item(i)

BomGetShapes TopBomSubLevel

Next i

628
Welcome

Else

' if there are no sublevels, we can get the shapes of the sublevel and analyze them

TopShapes = TopBomLevel.GetShapes

TopShapeCount = UBound(TopShapes, 1)

For i = 0 To TopShapeCount

Set TopShape = TopShapes(i)

If TopShape Is Nothing Then

' error management

' it isn't normal

Exit Sub

End If

' what you want to do with the shape

...

Next i

End If

End Sub

629
Welcome

Sewing shapes together

Example

Version : 6.5

Description :

This example shows how to sew several shapes together.

Dim TopDoc As TopSolid.DocumentDesign

...

Dim nshs As Integer

Dim ish As Integer

Dim ix As Integer

Dim sh As TopSolid.Shape

Dim vsh As Variant

Dim shs() As TopSolid.Shape

Dim vshs As Variant

Dim vsewnshs As Variant

' get document sheet shapes

nshs = TopDoc.Shapes.Count

630
Welcome

ReDim shs(nshs - 1)

ish = 0

For ix = 1 To TopDoc.Shapes.Count

Set sh = TopDoc.Shapes(ix)

If sh.Type = topShapeTypeSheet Then

Set shs(ish) = sh

ish = ish + 1

Else

nshs = nshs - 1

End If

Next ix

ReDim Preserve shs(nshs - 1)

' sew shapes together

vshs = shs

Call doc.Shapes.Sew(vshs, 2, 0.00001, vsewnshs)

' clean + simplify shapes

For Each vsh In vsewnshs

631
Welcome

Set sh = vsh

Call sh.CleanGeometry(0.00001, 0.001)

Call sh.SimplifyGeometry(0.00001, 0.001)

Next

...

632
Welcome

Introduction

This chapter contains the API release notes of each TopSolid version.

Before migrating an Automation application from one version of TopSolid to the


next, you should read the release notes of the new version first, and modify your code
if needed.

633
Welcome

Introduction

This section describes the changes of the API that appeared in the v6.8 release.

634
Welcome

Creations

Enums

Events

Interfaces

Properties

IApplication.GetInterfaceExportOption : Export option of the specified interface


provider.

IApplication.GetInterfaceImportOption : Import option of the specified interface


provider.

IApplication.SetInterfaceExportOption : Export option of the specified interface


provider.

IApplication.SetInterfaceExportOption : Import option of the specified interface


provider.

Methods

Collections

635
Welcome

Examples

636
Welcome

Introduction

This section describes the changes of the API that appeared in the v6.7 release.

637
Welcome

Creations

Enums

TopMessageButton : Buttons to be displayed in the message box.

TopMessageIcon : Icon to be displayed in the message box.

TopMessageAnswer : Button clicked by the user in the message box..

Events

_IApplicationEvents.NotifyBeforeDocIndexModification : Event before the document


index modification.

_IApplicationEvents.NotifyDocumentPasswordsAsked : Event during document


loading for asked passwords.

Interfaces

Properties

IApplication.InterfaceProviders : List of interface providers.

IBOMLevel.ElementDesignation : Designation of the element of the level.

638
Welcome

IBOMLevel.ElementReference : Reference of the element of the level.

IDocument.FactorySuffix : Suffix of the document.

IDocument.Identifier : Identifier of the document.

IDocument.PaperFormat : Paper format.

IDrawing.ScaleFactor : Scale factor.

Methods

IApplication.ExecuteMacroKeepStack : Execute lip macro keeping stack.

IApplication.GetDoubleFromStack : Pop a double from the lip stack..

IApplication.GetElementFromStack : Pop an element from the lip stack.

IApplication.GetIntegerFromStack : Pop an integer from the lip stack.

IApplication.GetStringFromStack : Pop a string from the lip stack.

IApplication.PushDoubleOnStack : Push a double on the lip stack.

IApplication.PushElementOnStack : Push a double on the lip stack.

IApplication.PushIntegerOnStack : Push a double on the lip stack.

IApplication.PushStringOnStack : Push a double on the lip stack.

IApplication.TileTwoDocuments : Tile two documents.

IDocument.Export : Export the document with the specified interface provider.

IDocument.SetPasswords : Set passwords of the document.

IDocument.Undisplay : Undisplay the document.

639
Welcome

IDocuments.Import : Imports a document.

IDocument.Load : Load a document.

IElement.GetConstituents : Constituents of an element.

IElement.SetTexture : Texture of the element.

Collections

Examples

640
Welcome

Introduction

This section describes the changes of the API that appeared in the v6.6 release.

641
Welcome

Creations

Enums

TopShapeType : Type of shape.

Interfaces

IBOM : BOM element

IBOMLevel : BOM level management

IBOMLevels : BOM levels collection

IBOMProperty : BOM property management

IBOMProperties : BOM property collection

IDimension : Dimension object management

IDimensions : Dimensions collection

IText : Text object management

ITexts : Texts collection

Properties

642
Welcome

IApplication.DefaultPrinterName : Name of default printer.

IApplication.MainWindow : Main window handle.

IApplication.TranslatorsCount : Number of available translators.

IShape.Type : Type of the shape.

IShape.Transparency : Transparency of the shape.

Methods

IApplication.GetTranslatorInfo : Gets some info about a translator.

IApplication.GetReferencedDocuments : Get list of referenced documents for a file.

IApplication.MoveDocumentsAndReferences : Move files and change referenced


files.

IApplication.Regenerate : Regenerate all opened documents.

IDocument.BreakAllGroups : Break all groups in document

IDocument.GetProperty : Get value of a property in document

IDocument.SetProperty : Set value of a property in document

IDocument.Regenerate : Regenerate document

IShape.CheckGeometry : Checks the geometry of the shape.

IShape.CleanGeometry : Cleans the geometry of the shape.

IShape.SimplifyGeometry : Simplifies the geometry of the shape.

IShapes.Sew : Sew sheet shapes together.

Collections

643
Welcome

IDocumentDraft.Dimensions : Collection of dimensions of document

Examples

Sewing shapes together.

644
Welcome

Introduction

This API has been first created in this version.

A rather confidential limited Automation API was previously available, and has been
maintained in this version, it is accessible through the TopSolid.PDM object.

Do not use this object for new developments, as it is only there to allow the
migration of the existing applications : this part of the API is obsolete and will be
removed in a future version of TopSolid.

645

You might also like