ParallelGraphics  
Home  »  Developer Zone  »  Products  »  VrmlPad  »  References  »  Protos
Protos

Protos Collection

 
Add
 
Count
 
Item
 
_NewEnum

See also: Using collections.
 
Add method, ( TypeName As String, [URL], [Before] ) As Object.

Adds a new PROTO or EXTERNPROTO declaration to the specified Protos collection. Returns a Proto object that represents the PROTO declaration to be added.

TypeName
A String, that represents the typename of a new PROTO or EXTERNPROTO declaration. A typename must be unique at the point of insertion of the PROTO, otherwise the method fails.

URL (Optional)
If specified and nonEmpty, a new EXTERNPROTO declaration will be created. URL defines the external prototype's definition.

If a string expression, URL is full or relative URL or pathname to an existing local VRML file with the appropriate PROTO implementation. If the specified URL ends with "#name", the name PROTO statement is used to define the external prototype's definition. Otherwise the first PROTO statement found in the file (excluding EXTERNPROTOs) is used.

If an object expression, URL is Proto object, that represents the external definition of a new EXTERNPROTO declaration.

If an empty string, a new EXTERNPROTO will be created with an empty interface declaration and empty URL.

Before (Optional)
An index of a new item in the collection. The PROTO declaration to be added is inserted in the collection before the PROTO identified by the Before argument.
If a numeric expression, Before must be a number from 1 to Count.
If a string expression, Before is a PROTO name that can be used instead of the positional index.
If an object expression, Before is a PROTO object from the collection or any Entity object with the same owner.
By default, a new PROTO declaration is inserted at the end of the collection.

The following example creates a PROTO declaration and an EXTERNPROTO declaration, that uses the PROTO as an external definition.

Dim SubDoc As Document
Set SubDoc = Document.NewSubdocument
Dim p As Proto
Set p = SubDoc.Protos.Add("MyProto")
SubDoc.Save "protos.wrl"
Document.Protos.Add "MyExtProto", p




 
Count property, read-only, Long.

Returns the number of items in the specified collection.




 
Item property, default, read-only, ( IndexOrName ) As Object.

Returns a Proto object that represents a member of the collection, either by position or by name.

IndexOrName
The name or index number of a member of the collection. The index can be a numeric expression (a number from 1 to the value of the collection's Count property), a constant, or a string, that represents the name of an existing PROTO or EXTERNPROTO declaration from the collection.
If the value provided as IndexOrName doesn't match any existing member of the collection, an error occurs.

The following example prompts the count of PROTO-instances of some PROTO declaration.

MsgBox Document.Protos("MyProto").Instances.Count




 
_NewEnum property, read-only.

References protos in the specified collection.

With C++, you can browse a collection to find a particular item by using the _NewEnum or the Item properties. In Visual Basic and VBScript, you do not need to use the _NewEnum property, because it is automatically used in the implementation of For Each ... Next or in For ... in statement in JavaScript.

The following example in Visual Basic prints all standard node typenames to the Immediate pane.

Dim p As Proto
For Each p In Document.StdProtos
  Debug.Print p.Name
Next n






Last updated: Sun, 12 Feb 2012
© 2000-2008 ParallelGraphics. All rights reserved.