|
 |  | Field
|
Field Object
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.
|


| |

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


| |

 |
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.
| Type | Get Results | Set Results |
 |
| SFBool | Gets a Boolean field value. | Sets a Boolean field value. |
 |
| SFColor | Returns a SFColor object. | Sets an array of three Single (or compatible) numbers, that represents the Red, Green and Blue components of the field value. |
 |
| SFFloat | Gets a Single field value. | Sets a Single (or compatible) field value. |
 |
| SFImage | Returns a MFValue object, that is collection of a Integer values. | Sets an array of N Integer (or compatible) numbers. |
 |
| SFInt32 | Gets a Long field value. | Sets a Long (or compatible) field value. |
 |
| SFNode | Returns 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. |
 |
| SFRotation | Returns 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. |
 |
| SFString | Gets a String field value. | Sets a String field value. |
 |
| SFTime | Gets a Double field value. | Sets a Double (or compatible) field value. |
 |
| SFVec2f | Returns a SFVec2f object. | Sets an array of two Single (or compatible) numbers, that represents the X and Y components of the field value. |
 |
| SFVec3f | Returns a SFVec3f object. | Sets an array of three Single (or compatible) numbers, that represents the X, Y and Z components of the field value. |
 |
| MFColor | Returns 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. |
 |
| MFFloat | Returns a MFValue object, that is collection of a Single values. | Sets an array of N Single (or compatible) numbers. |
 |
| MFInt32 | Returns a MFValue object, that is collection of Long values. | Sets an array of N Long (or compatible) numbers. |
 |
| MFNode | Returns a MFValue object, that is collection of Node objects. |
 |
| MFRotation | Returns 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. |
 |
| MFString | Returns a MFValue object, that is collection of String values. | Sets an array of N String values. |
 |
| MFTime | Returns a MFValue object, that is collection of a Double values. | Sets an array of N Double (or compatible) numbers. |
 |
| MFVec2f | Returns 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. |
 |
| MFVec3f | Returns 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")
|
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"
|
|

|
|
|