ParallelGraphics
Home  »  Developer Zone  »  Products  »  VrmlPad  »  References  »  Field
Up to References

Document 

Documents 

Entity 

Field 

Fields 

MFValue 

Node 

Nodes 

Proto 

Protos 

Range 

Route 

Routes 

SFColor 

SFRotation 

SFVec2f 

SFVec3f 

VrmlMatrix 

Window 


Subscribe to Newsletter
 


Google Searchsite search:

 

%(domain)s %(domain)s
Install Cortona VRML Client!

Outline 3D

Try RobinZone!


Field

Field Object

 
Category
 
EntityType
 
Owner
 
TypeName
 
CategoryName
 
Expose
 
Precision
 
Value
 
Context
 
Implements
 
Range
 
ValueRange
 
Declaration
 
Implicit
 
RouteTo
 
Delete
 
Interface
 
Standard
 
Document
 
Name
 
Type

See also: Entity object.
 
Category property, read-only, VpFieldCategory.

Returns the category of the specified field from the enum of type VpFieldCategory.
Following are the possible values, which have the Long type:

vpcUnknown = 0
vpcField = 1
vpcEventIn = 2
vpcEventOut = 3
vpcExposedField = 4




 
CategoryName property, read-only, String.

Gets the name of the field category.

The following example prints the name, category and type of a field.

Dim f As Field
Set f = ...
Debug.Print f.CategoryName & " " & f.TypeName & " " & f.Name




 
Context property, read-only, Object.

Returns a Proto object that represents the PROTO context (namespace) for the specified field. Returns Nothing, if the field is in the global context (isn't part of a PROTO declaration).

See also: Context property of the Entity object.




 
Declaration property, read-only, Object.

Returns a Field object that represents the declaration of the specified field in a PROTO or standard node interface.
Returns the same object in the case of the field declaration in a PROTO or a Script node interface.

The following example checks a nature of a field.

Dim f As Field
Set f = ...
If f.Declaration = f Then
  MsgBox f.Name & " is a field declaration"
ElseIf f.Declaration.Standard Then
  MsgBox f.Name & " is a standard field implementation"
Else
  MsgBox f.Name & " is a PROTO field implementation"
End If




 
Delete method.

Deletes the specified field.

In the case of the field declaration, all references to the field will also be deleted. If the field's value contains declarations that have references outside the specified field, all such references will be deleted as well.

See also: Delete method of the Entity object.




 
Document property, read-only, Object.

Returns a Document object that represents the VRML file contains the specified field.




 
EntityType property, read-only, VpEntityType.

Returns the actual type of the specified field from the enum of type VpEntityType.

Following are the possible values, which have the Long type:

EntityTypeVRML object
vpField = 5Node's field definition
vpFieldDecl = 6Script's or PROTO's field declaration
vpProtoURL = 7URL of EXTERNPROTO's declaration
vpExpired = 0Corresponding VRML object has been removed

See also: EntityType property of the Entity object.




 
Expose method, ( [Category] ) As Object.

Exposes the specified field to a PROTO interface with the same name, type and field value. Returns a Field object of an exposed interface field.

The method will fail, if the field is in the global context (is not part of a PROTO declaration) or a field with the same name already exist in a PROTO interface.

Category (Optional)
An enum of type VpFieldCategory that indicates the category of the field to be created.
Following are the possible values, which have the Long type:

vpcField = 1
vpcEventIn = 2
vpcEventOut = 3
vpcExposedField = 4

By default, the category of the specified field is using.




 
Implements property, read-only, Object.

Returns a Fields collection of fields that implement the specified PROTO field declaration by using the IS syntax.

The following example clears the implementation of a PROTO field declaration.

Dim f As Field
Set f = Document.Protos(1).Fields("enabled")
For Each i In f.Implements
  i.Interface = Nothing
Next

See also: Interface property.




 
Implicit property, read/write, Boolean.

Return True if the specified node's field is not explicitly defined in a node interface. In the case of implicit fields most properties and methods still work as if the field is explicitly defined with the same name, type, category and value (if any) as in the field declaration. Assigning a value to an implicit field makes it explicit (adds a field definition to a node interface).

Sets False to the property adds an explicit field definition to a node interface for the specified implicit field with a value as in the field declaration.

Sets True to the property deletes the explicit definition of the field if the field value is the same as in the field declaration (i.e. if the field has a default field value). Otherwise assigning to the property does nothing.

The following example explicitly defines all fields in a node.

Dim f As Field
For Each f In Document.RootNodes(1).Fields
  f.Implicit = False
Next




 
Interface property, read/write, Object.

Gets or sets a Field object that represents the interface of the specified field in a PROTO declaration (by means of the IS syntax).

Returns Nothing if the field has no exposed interface.

Assigning Nothing to the property breaks the link between the field and a PROTO interface.

See also: Implements property.




 
Name property, read/write, String.

Gets the name of the field or sets the name of the field declaration.

See also: Name property of the Entity object.




 
Owner property, read-only, Object.

Returns an Entity object that represents the immediate owner of the specified field.

It's a Node object for the field definiton, a Script Node object or a Proto object for the field declaration or a Proto object for the EXTERNPROTO pseudo-field.

See also: Owner property of the Entity object.




 
Precision property, read/write, Long.

Gets or sets a floating-point precision specifies the maximum number of significant digits printed for the field value. By default, six significant digits are printed, with any trailing zeros truncated.

The following VBScript macro adds three subvalues to a MFVec3f field with different precisions.

Set f = RootNodes.Add("NormalInterpolator")("keyValue")
val = Array(1.789123456789e-6, 0.123, -30.1213)
f.Add val  'Results: 1.78912e-6 .123 -30.1213,
f.Precision = 12
f.Add val  'Results: 1.78912345679e-6 .123 -30.1213,
f.Precision = 1
f.Add val  'Results: 2e-6 .1 -30




 
Range property, read-only, ( [Flags] ) As Object.

Returns a Range object that represents the portion of a document that's contained in the specified field, including the field value.

Flags (Optional)
Specifies the part of the field text to include. Can be a combination of the following values from the enum of type VpEntityRange:

ValuePart of the field
vprnAll = 0 (default)All field text with some whitespace padding
vprnId = 1
vprnName = 2
Name of the field
vprnBody = 4The field value
vprnDecl = 8Type of the field declaration
vprnKeyword = 16field, exposedField, eventIn, and eventOut keywords

For information about Range objects, see Using the Range Object.




 
RouteTo method, ( Field As Object ) As Object.

Adds a route from the specified field to an another field. Returns a Route object that represents the created route.

Field
A Field object that represents the destination field route to.

The following example creates a route between two fields and selects it.

Dim n1 As Node
Dim n2 As Node
Dim r As Route
Set n1 = Document.StdProtos("TimeSensor").Instances(1)
Set n2 = Document.StdProtos("ScalarInterpolator").Instances(1)
Set r = n1("fraction_changed").RouteTo(n2("set_fraction"))
r.Range.Select




 
Standard property, read-only, Object.

Returns True if the specified field is a field of a standard VRML node declaration.

See also: Standard property of the Entity object.




 
Type property, read-only, VpFieldType.

Returns the type of the specified field from the enum of type VpFieldType.                     
Following are the possible values, which have the Long type:

vpfSFBool = 1 vpfSFNode = 6 vpfSFVec3f = 11 vpfMFRotation = 16
vpfSFColor = 2 vpfSFRotation = 7 vpfMFColor = 12 vpfMFString = 17
vpfSFFloat = 3 vpfSFString = 8 vpfMFFloat = 13 vpfMFTime = 18
vpfSFImage = 4 vpfSFTime = 9 vpfMFInt32 = 14 vpfMFVec2f = 19
vpfSFInt32 = 5 vpfSFVec2f = 10 vpfMFNode = 15 vpfMFVec3f = 20
vpfUnknown = 0




 
TypeName property, read/write, String.

Gets the name of the field type.

See also: CategoryName property.




 
Value property, default, read/write, Variant.

Gets or sets a value of the specified field.

The following table summarizes the results of using the Value property depending on a field type of the Field object.

TypeGet ResultsSet Results
SFBoolGets a Boolean field value.Sets a Boolean field value.
SFColorReturns a SFColor object.Sets an array of three Single (or compatible) numbers, that represents the Red, Green and Blue components of the field value.
SFFloatGets a Single field value.Sets a Single (or compatible) field value.
SFImageReturns a MFValue object, that is collection of a Integer values.Sets an array of N Integer (or compatible) numbers.
SFInt32Gets a Long field value.Sets a Long (or compatible) field value.
SFNodeReturns a Node object or Nothing.Sets a String value, that represents the typename of a new node,
or a Proto object, that represents a template for a new node,
or a Node object, that represents the definition for a new node (by means of the DEF/USE syntax),
or Nothing or Null.
SFRotationReturns a SFRotation object.Sets an array of four Single (or compatible) numbers, that represents the X, Y, Z and Angle components of the field value.
SFStringGets a String field value.Sets a String field value.
SFTimeGets a Double field value.Sets a Double (or compatible) field value.
SFVec2fReturns a SFVec2f object.Sets an array of two Single (or compatible) numbers, that represents the X and Y components of the field value.
SFVec3fReturns a SFVec3f object.Sets an array of three Single (or compatible) numbers, that represents the X, Y and Z components of the field value.
MFColorReturns a MFValue object, that is collection of SFColor objects.Sets a two-dimensional array of N x 3 Single (or compatible) numbers, that represents the Red, Green and Blue components of the field value.
MFFloatReturns a MFValue object, that is collection of a Single values.Sets an array of N Single (or compatible) numbers.
MFInt32Returns a MFValue object, that is collection of Long values.Sets an array of N Long (or compatible) numbers.
MFNodeReturns a MFValue object, that is collection of Node objects.
MFRotationReturns a MFValue object, that is collection of SFRotation objects.Sets a two-dimensional array of N x 4 Single (or compatible) numbers, that represents the X, Y, Z and Angle components of the field value.
MFStringReturns a MFValue object, that is collection of String values.Sets an array of N String values.
MFTimeReturns a MFValue object, that is collection of a Double values.Sets an array of N Double (or compatible) numbers.
MFVec2fReturns a MFValue object, that is collection of SFVec2f objects.Sets a two-dimensional array of N x 2 Single (or compatible) numbers, that represents the X and Y components of the field value.
MFVec3fReturns a MFValue object, that is collection of SFVec3f objects.Sets a two-dimensional array of N x 3 Single (or compatible) numbers, that represents the X, Y and Z components of the field value.

Assigning Empty to the Value property sets a value of the specified field to the initial value, that is [ ] for all multiple-valued fields, 0 0 1 0 for SFRotation fields, "" for SFString and so on.

To set a single value to a multiple-valued field, you can use single-valued fields assignment semantic. For example, the following examples lead to identical results:

url.Clear
url.Add "pic.gif"

url.Value = Array("pic.gif")

url.Value = "pic.gif"

See also: Using field value objects.




 
ValueRange property, read-only, ( [Index] ) As Object.

Returns a Range object that represents the portion of a document that's contained in a value of the specified field.

Index (Optional)
A one-based index of the subvalue of a multiple-valued field.
By default, a range for the whole field value is returning.

The following VBScript example checks all document IndexedFaceSets for an invalid coordIndex value.

Dim n
Dim f
Dim Count
For Each n In StdProtos("IndexedFaceSet").Instances
  Count = n("coord")("point").Count
  Set f = n("coordIndex")
  For i = 1 To f.Count
    If f(i) >= Count Then
      f.ValueRange(i).Select
      MsgBox "Invalid value found"
      Exit Sub
    End If
  Next
Next
MsgBox "OK"





Last updated: Thu, 28 Aug 2008
© 2000-2008 ParallelGraphics. All rights reserved. Terms of use.