9.4. Interfacing Anableps and using external data

Easy interfacing is in the core of anableps philosophy. Anableps is specially coded to work with other programming languages and

9.4.1. Putting external data into anableps

9.4.1.1. Tables

Data can be taken from tables. to do that, the simplest way is to create a table

Example:

table t: .from file2.txt .colHeaders true
            # so it takes names from first row
cube c{}: .size t.size
          # creates as many cubes as rows has the table

If only a few x are used, it can be done inline:

cube c1: .size <file2.txt>.cell(4,3)

Tables are a powerful tool. See the reference Table

9.4.2. calling other languages from bleps

9.4.2.1. The script keyword

At any point a script can be invoked, that returns some object that anableps needs.

Example:

cube c: .size @bash(./calcSize.out)

9.4.2.2. data sources

Datasources provide data input for anableps The extern keyword

Example:

datasource.xmlrpc s: .address 192.168.1.3
cube c: side s.get d.size         # d.size is passed as parameter to the function

9.4.3. Bleps from other languages

Finally, yo may want to call bleps from other languages. there are, again several options, corresponding to several levels of integration

9.4.3.1. From bash

9.4.3.1.1. Accessing data inside a bleps script:

Example::
bleps myscript.bl –eval pyramid2.base

May be, you want to get all the data from a script, or changing things in it:

bleps serve myscript.bl .as <name>

and from other programming languages call

bleps eval <name>.<object>

this has the advantage that, as long as the bleps server is running, all the objects are there

9.4.3.2. python bindings

There are several wrappers for anableps, being the most common, blewrapy:

Example::
from anableps import * c = Circle(size=3)

Note that, in order to use units there must be defined first?:

from anableps import *
c = Circle(size = 3 * cm)

Sometimes, is a bit risky to spew all the names in the root namespace…:

import anableps as ab
c = ab.Circle(radius = 4 * cm, material = "wood.chestnut"

9.4.3.3. ruby bindings

9.4.3.4. dlang bindings

being written in Dlang, it should be easy. Just exposed classes

9.4.4. Using Anableps drawings with other programs

asdf asdf asdf .. ###############################################################