ParallelGraphics
Home  »  Developer Zone  »  Products  »  VrmlPad  »  References  »  Entity
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!


Entity

Entity Object

 
Context
 
Document
 
Name
 
Range
 
Delete
 
EntityType
 
Owner
 
Standard

See also: Using entity objects.
 
Context property, read-only, Object.

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




 
Delete method.

Deletes the specified entity.

If the entity is a named node, PROTO or field declaration, all references to the entity will also be deleted. If the entity definition contains declarations that have references outside the specified entity, all such references will be deleted as well.

The following Visual Basic example removes all routes to a node labeled "L1".

Dim r As Route
For Each r In Document.Routes
  If r.ToNode.Name = "L1" Then r.Delete
Next




 
Document property, read-only, Object.

Returns a Document object that represents the VRML file contains the entity.




 
EntityType property, read-only, VpEntityType.

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

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

EntityTypeVRML objectActual Type
vpNode = 1Node definitionThe Node object
vpNodeRef = 2Node reference (USE)The Node object
vpProto = 3PROTO declarationThe Proto object
vpExternProto = 4EXTERNPROTO declarationThe Proto object
vpField = 5Node's field definitionThe Field object
vpFieldDecl = 6Script's or PROTO's field declarationThe Field object
vpProtoURL = 7URL of EXTERNPROTO's declarationThe Field object
vpRoute = 8ROUTE definitionThe Route object
vpExpired = 0Corresponding VRML object has been removed 

When you need to cast an Entity object to a particular object type, you can use the Set statement in Visual Basic to set a variable of required type equal to the Entity object.

Dim ent As Entity
Dim node As Node
Set ent = Document.CurrentEntity
If Not ent Is Nothing Then
  If ent.EntityType = vpNode Then
    Set node = ent
    MsgBox node.TypeName
  End If
End If

In C++, you can use QueryInterface to get required interface.

Entity *pEnt;
if (SUCCEEDED(pDoc->get_CurrentEntity(&pEnt)) && pEnt != NULL) {
  Node *pNode;
  if (SUCCEEDED(pEnt->QueryInterface(IID_Node, (void**) &pNode))) {
    pNode->get_TypeName(&bstrName);
    ...
    pNode->Release();
  }
  pEnt->Release();
}

VBScript and JavaScript is typeless languages, so you don't have to do such conversion.

Dim ent
Set ent = CurrentEntity
If Not ent Is Nothing Then
  If ent.EntityType = vpNode Then MsgBox ent.TypeName
End If




 
Name property, read/write, String.

Gets or sets the name of the entity.

The following table summarizes the results of using the Name property depending on value of the EntityType.

EntityTypeGet ResultsSet Results
vpNodeGets the name of the node (by means of the DEF syntax). Returns empty string for the unnamed node.Sets or changes the name of the node (and all references (USEs) of the node). The name must be unique in a PROTO context of the node. An empty string unnames the node.
vpNodeRefGets the name of the node (by means of the USE syntax).inapplicable
vpProto
vpExternProto
Gets the name of the PROTO or EXTERNPROTO declaration.Renames the PROTO or EXTERNPROTO declaration.
vpFieldGets the name of the field definition.inapplicable
vpFieldDeclGets the name of the script's or PROTO's field declaration.Renames the field declaration (and all references of the field). The name must be unique in a scope of the node or PROTO header.
vpProtoURLGets the name of the EXTERNPROTO declaration.inapplicable
vpRouteinapplicableinapplicable




 
Owner property, read-only, Object.

Returns an Entity object that represents the immediate owner of the specified entity. Returns Nothing for the toplevel entities (root nodes and PROTOs).

The following example checks that two fields have the same scope.

Set field1 = ...
Set field2 = ...
If field1.Owner Is field2.Owner Then MsgBox "Same scope"




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

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

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

ValuePart of the entity
vprnAll = 0 (default)All entity text with some whitespace padding
vprnId = 1Typename of node, name of prototype declaration or field definition, source routed field name
vprnName = 2Name of node (DEF), name of prototype declaration or field definition, source routed node name
vprnBody = 4Body of node definition or prototype declaration (within braces), field value
vprnDecl = 8Interface part (within square brackets) of prototype declaration, type of field declaration
vprnKeyword = 16PROTO, DEF, USE, ROUTE, field, exposedField, eventIn, and eventOut keywords
vprnId2 = 32Target routed field name
vprnName2 = 64Target routed node name

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




 
Standard property, read-only, Boolean.

Returns True if the specified entity is a standard VRML node type declaration or a field of that node.

A standard entity is a read-only object - you can't change name, delete or modify by other ways standard entities. You can't also get text range for the standard entity, because it has no associated text.

The following example checks that a node has a user-defined type (is a PROTO-instance).

Dim node As Node
Set node = Document.Nodes("SomeNode")
If Not node.Prototype.Standard Then
  MsgBox node.Name & " is a PROTO instance"
End If





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