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

VrmlPad Objects 

VrmlPad Add-Ins and Macros 

References 

Samples 


Subscribe to Newsletter
 


Google Searchsite search:

 

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

Outline 3D

Try RobinZone!


VrmlPad

Introduction to the VrmlPad Automation

The VrmlPad Automation provides application programming interface (API) that enables authors and developers to manipulate the program from external applications using the C/C++, Visual Basic®, Delphi, and scripts within HTML pages.

In addition, power users can now create add-ins, VBScript and JavaScript macros and execute them from within the VrmlPad environment, automating custom tasks. VrmlPad macros are procedures you write in the VBScript or JavaScript language, and add-ins are in-process ActiveX components (DLLs) you write in C, C++, Pascal or Visual Basic. Each add-in can add one or more commands, and each command can perform one or more tasks. The number of commands and tasks is up to you.

If your tasks are routine or repetitive, you can benefit from automating them. Through Automation (formerly OLE Automation), you can reduce the time spent on these tasks, and you can prevent errors that often result from performing the tasks manually. Also, you can add visual support for editing some VRML nodes in addition to text editing provided by VrmlPad.

With Automation, you perform tasks by manipulating VrmlPad and its components as objects. For example, you open, edit, and close a document by manipulating it as an object. Similarly, you get or edit a VRML node's properties by manipulating it as an object. Each VrmlPad object implements a dual interface through which you can manipulate the object.

You manipulate objects by using methods, properties, and events associated with the objects. Methods represent actions you take against the objects. Properties represent characteristics of the objects, such as their type or size. And, events represent conditions under which actions are taken against the objects.

Suppose you want to create a VRML file, containing WorldInfo node, quickly — by simply choosing a menu item. Start by writing a VBScript macro that will create the file. The macro looks like this:

Sub CreateNew
  Document.NewFile
  Document.Selection = "#Created by the Author" + vbCrLf
  Set node = Document.RootNodes.Add("WorldInfo")
  node.Fields("info").Add "Powered by VrmlPad"
End Sub

This macro does the following:

 
The Sub statement begins the macro, which has the name CreateNew. The name is arbitrary, you can use whatever name you choose.
 
The first line of the macro clears the file, using the NewFile method of the Document object.
 
The second line of the macro adds a comment string and moves the caret to the next line, using the Selection property of the Document object.
 
The next line of the macro adds an empty WorldInfo node, using the RootNodes collection of the Document object.
 
The next line of the macro adds the info field to the node, using the Fields collection of the Node object, and sets field's value, using the Add method of the Field object.
 
The End Sub statement ends the macro.

After writing the macro, copy the macro file to the AddIns directory. Then, select the menu item CreateNew from the Tools menu to run the macro.

For more information about writing add-ins and VBScript macros, see add-ins section.


Last updated: Sat, 17 May 2008
© 2000-2008 ParallelGraphics. All rights reserved. Terms of use.