Skip to end of metadata
Go to start of metadata

Introduction

The Web Export module can be used to generate a static HTML export of an arKItect project. The module uses the Scalable Vector Graphics (SVG) technology to render diagrams in web pages.

Basic Usage

You can run HTML export with the Import/Export menu, Export to Html.

This will open a simple window inside which you can specify the output directory and the projections and variants you want to export. The output will be inside a subdirectory named after your project. (Suffix will be added if the directory already exists).

Advanced Usage

It is possible to greatly customize the result of the export. You need to bypass the GUI and call the export function directly:

The output path is the only mandatory parameter for the export. There are also 8 other optional parameters:

  • animatedFlows (boolean) : Indicates whether the flows will twinkle or not in the SVG corresponding to the project's diagrams.
  • stopRecursionPredicate (function) : This is a function that takes an ArkObjRef and returns either True or False. Returning True will result in stopping the generation recursion from the object (i.e. its children won't be exported). By default, the predicates stops at objects without children or with children that are all flows.
  • additionalHeaderContent : It can either be a string or a xml.dom.Node. The content of this variable will be added in the <head> tag of the main HTML page.
  • treeViews : A list of string containing filter names. Only the projections whose names are in the list will be exported unless the list is empty, in which case every projection will be exported.
  • variants : A list of string containing variant names. This behaves like treeViews.
  • visualObjectCallBack (function) : This function will be called with a webExport.VisualObject as parameter
  • visualLinkCallBack (function) : This function will be called with a webExport.VisualLink as parameter
  • progressCallBack (function) : This function is called when a pair of (treeview, variant) has finished exporting. It is called with 4 parameters which correspond respectively to the current exported treeview index, the current exported variant index, the total of treeviews to export and the total of variants to export.

Custom Recursion Predicates

The predicate system allows you to export specific chunks of your project. It requires a little bit of coding but it is also very potent and it can do things that couldn't be easily represented in a graphical interface.

Case 1: Exporting Absolutely Everything

As said before, the default behavior of the function is to ignore objects which have no children or have only flows as children. In most cases, the inner view of these objects is not really interesting and this is why I chose this particular behavior.
However, you might find yourself in a situation where you want to export every single object in your project. Here is the approach to follow:

By always returning 'False', the recursion never stops and will export the whole tree.

Case 2: Using Attributes to Stop the Recursion

It is possible to use arKItect attributes to filter your export. For example, you can define a Boolean as an object's attribute to stop the recursion from that object. The predicate can then be defined as follows (assuming that the attribute's name is "Stop"):

When the attribute 'Stop' of an object is set to 'True', the function returns 'True' and therefore the recursion stops.

Case 3: Using graphical properties to stop the recursion

As an ArkObjRef is passed to the predicate function, you can use every possibility that the API offers to filter your export. In this case, I will define a predicate that blocks the recursion when the object is visually expanded in its parent's diagram (children diagrams might then be irrelevant). The information about the expanded state can be found in the XML of a diagram that you can retrieve using the GetGraphXML member function.

Custom Callbacks on Graphical Objects

In construction...

Execution Time

Depending on the size of your project (and the recursion predicate), the script will take more or less time to compute. Bear in mind that a project containing variants will take a lot more time to export. If a project  contains no variant and is exported in x minutes, the same project with n variants will be exported in approximately (n+1) * x minutes.

Administration

IIS Configuration

When uploading an export on IIS, it might not deliver the svg files correctly and throw 404 exceptions. In order to fix this :

  1. Open IIS manager
  2. Right click the website and select "Properties"
  3. Click the "HTTP Headers" tab
  4. Click the "MIME types" button on the bottom of the dialog
  5. Add ".svg" extension and its type in the "Registered file types" list

See also

Web export is available to user via graphical interface, see page Export to HTML.

 

  • No labels