You are here: HomeProducts and ServicesArchitectureObject TechnologyDeveloper Zone

Programming GDL Web Control


Table of Contents


Naming Conventions
  • GDL Web Control
      Internet Explorer on Windows; ActiveX technology

  • GDL Web Plug-in
      All other supported browsers; Netscape plug-in technology

    This document uses 'plug-in' in both cases, when discussing GDL programming in general.
Platforms and Browsers Supported
      MacOS X
    (PowerPC version)
    MacOS X
    (Intel version)
    Windows 2000, XP

    Internet Explorer

    -

    -

    supported

    Safari

    supported

    supported*

    -

    * Only the latest version (10) of the GDL Web Control supporting that platform-browser pair.

Operation
    When a GDL object is displayed on an HMTL page, the browser loads the plug-in and passes the attributes set for the plug-in and the GDL object.

    In order to display the object correctly, 3 files have to be available on the server. The files, in order of download, are: the GDL object, gdllist.txt and master.gdl.

    • GDL object file: can be standalone or assembly (macros used).

    • gdllist.txt: The catalog file. This lists all the files needed to display the object. This file is created by GDL Publisher.

    • master.gdl: this contains default material and texture definitions. If not found, the file installed on the client machine is used. The path to this file can be set via the Preferences dialog box.

    After loading these files, the plug-in starts interpreting the object. At this stage, further files might be needed from the server.

    It is important to note that only those files needed to display the object using the current parameter values are downloaded.
Embedding into HTML
    As shown earlier, two kinds of technology are used to display GDL objects in web browsers. Both types require somewhat different HTML code for embedding.

    • GDL Web Control


    • GDL Web Plug-in
Setting Default Parameter Values at Loading
  • Required Parameters

    • classid: Used by the system to identify GDL ActiveX Control.
    • codebase: To use automatic installation and update.
    • id: To make the object instance available to Javascript.

    • type: This is used by the browser to identify GDL objects.
    • name: To make the object instance available to Javascript.

    • width, height: To set the size of the view rectangle.
    • src: The path to the GDL object on the server.
        (Set relative to the path of the HTML page displayed.)
    • gdllisttxt: The path to the GDL catalog file, gdllist.txt on the server.
        (Set relative to the embedded GDL object .)
    • mastergdl: The path to master.gdl file on the server.
        (Set relative to the embedded GDL object.)

  • Optional Parameters

    To find the complete list of optional parameters, go to the Web Plug-in Reference page.

      - disablemenus: When the user right-clicks or ctrl-clicks (Mac) over the plug-in area on the HTML page, a pop-up menu appears. It is possible to ban the use of the menu items listed. The parameter is a four digit hexadecimal number. When the ith bit of the parameter is set to 1, this means the ith menu item is disabled in the list; e.g.: disablemenus=#2000 value will disable the 14th menu item. (When counting the menu items, take into account that the separators are also considered as menu items.)

      - lengthunitformat:
      Value Description
      1mm
      2cm
      3m
      4km
      5decimal feet
      6feet & decimal inches
      7decimal inches
      8feet & fractional inches
      9fractional inches

      - projectioncode:
      ValueDescription
      0Front view
      1Back view
      2Over view
      3Top view
      4Left view
      5Right view
      6Frontal axonometry
      7Isometric axonometry
      8Monometric axonometry
      9Dimetric axonometry
      10Perspective projection
      11Bottom axonometry
      12Frontal bottom axonometry
      13Isometric bottom axonometry
      14Monometric bottom axonometry
      15Dimetric bottom axonometry

      - setplugincode: To enable CAD connectivity on the web server, i.e. the ability to save GDL objects in different CAD formats, a code file is needed. This code file contains the formats licensed and can be requested from GDL Technology at . The license is tied to the web server's IP address.

      - showtype:
      ValueDescription
      WIREFRAMEDraws the object in wireframe, shows all lines
      HIDDENLINEwireframe + invisible lines hidden
      SHADINGhiddenline + color
      PHOTORENDERINGPhotorealistic view of the object
      DRAWING2DDraws the object in 2D
      PREVIEWDraws the preview picture of the object

      - similar: When this parameter is set to YES, the plug-in will search for other instances of itself that are showing the same object inside the page. Then it will use the same parameter values for each instance. When the user changes any values, all instances will be updated automatically.

  • GDL Object Parameters

    It is possible to set the GDL parameters of objects to override their default values, i.e. the ones with which the objects were saved in the authoring tool.

    Parameters can be either strings or numbers in the world of GDL. When setting a string type parameter, start with the prefix 's'. When setting number type parameters, start with 'r' followed by the name of the parameter.

  • Example I - Embedding

    This example embeds a GDL object into an HTML page.

    View Example I
Communicating with the Plug-in

  • Important note for Internet Explorer on Mac OS X

    It is important to note that the GDL Object WebControl 2.00 and later versions don't support the JavaScript communication under Internet Explorer on Mac OS X.
  • Checking Load Status

    It is very important to check the status of the embedded objects, before starting any communication with the plug-in.

    This code snippet uses the page's onload event to call the check function. Once the plug-in has finished displaying the object, it can accept commands or handle queries.

  • Sending Commands

    Commands are tasks which the plug-in can execute and there is no return value: e.g. setting view modes.

    To send commands: GDL_Control.CallPlugin ("Command", "Parameter")

  • Query/Response

    If return values are expected from the plug-in:

      1. Send the query to the object's instance:
        GDL_Control.CallPlugin ("Command", "Parameter")

      2. Request the result from the instance:
        myVariable = GDL_Control.sResult

  • Setting Parameter Values

    GDL_Control.CallPlugin ("SetParameter", "sMyParam=1&rMyParam2=2.000")

    To set more than one parameter at a time, join the commands with the '&' sign.

  • Getting Parameter Values

    GDL objects can have 1024 parameters. To get a parameter value, you should know its index in the parameter list of the object in question. The index starts with 1.

    GDL_Control.CallPlugin ("GetParameter", i)

    A loop can be used to get all the parameters at a time:

  • Example II - Communication

    This example embeds a GDL object into the page by changing parameter 'myParam' from its default value 0 to 1.

    It also changes the parameter 'Radius' to 45 degrees and sets the axonometry angle to 180 degrees at load time.

    To change this parameter, click on the 'Set Parameter' button included on the example page.

    View Example II

  • Example III - Plug-in Interface Functions

    • Accessing the interface: CallPlugin ("MenuCommand", "Parameter")

        Parameter:
        • Preferences, ParameterSettings, SaveObject, ...
        • Preview, Drawing2D, Shading, Photorendering, ...

    • Setting Interface Modes: CallPlugin ("UI_MODE", "Parameter")

        Parameter:
        • Pan_Mode,
          Zoom_In_Mode, Zoom_Out_Mode,
          Fit_In_Mode,
          Reset_Mode

    • Setting zoom: CallPlugin ("SETZOOM", "scaleX, scaleY, origoX, origoY")

    • Getting zoom: CallPlugin ("GETZOOM", "")

        Get the result by checking .sResult = scaleX, scaleY, origoX, origoY.

    View Example III

Copyright © 2008 - Graphisoft R&D Zrt. All rights reserved worldwide. Terms of Use | Privacy Policy