Objective: At the end of this tutorial you will understand how to run, manipulate and mesh 2D objects.

You can launch CAID by running


or giving the wkl session file

caid mysession.wkl

or adding the xml geometry file

caid mygeometry.xml

or giving the pfl field file, only for visualization

caid myfield.pfl

CAID is based on some fundomental windows that are:






When you run CAID without any argument, you can only see the workgroup window. You can then create a new workgroup, or open a stored one.

  • Run CAID without any argument (Fig caid_fig0).
  • Create a new Project (Workgroup) (Fig caid_fig1).

    In the File menu, click on new

  • An empty geometry object is already created. When you select a geometry object, you can see the corresponding list of buttons, in the Inspector (Fig caid_fig2)
  • CAID offers some predefined geometries (Fig caid_fig3)
  • Click on the circle button. This will create a circle domain, using one single patch. You need to specify its radius (Fig caid_fig4)
  • When you select a patch object, you can see the corresponding list of buttons, in the Inspector (Fig caid_fig5)
  • By expanding a patch object, you can see its attributs in the Inspector (Fig caid_fig6). These attributs are:
    • rational if the patch is a rational B-spline (NURBS)
    • dimension this is the parametric dimension: 1 for curves, 2 for surfaces and 3 for volumes
    • shape number of control points in each parametric direction
    • degree B-splines degrees for each direction
    • points Control Points
    • weights weights of the NURBS. Default value for B-splines patchs is an array of ones
    • orientation this is the orientation of the outward normal vectors to the patch boundary, given for each face of the parametric domain.
    • faces The faces of a patch are viewed as geometries objects. This is very useful when we want to specify boundary conditions. A face object can be extracted by clicking on the right mouse button.

Another useful description of the circle, is given with 5 patchs. Select any geometry object to get access to geometries actions. Then click on the new button, and the circle5mp button. (Fig caid_fig7)


The corresponding object is shown in (Fig caid_fig8_)


By expanding the geometry object, you get access to the external faces (Fig caid_fig8a_)


the internal faces (Fig caid_fig8b_)


and the inter-patch connectivity (Fig caid_fig8c_)


When selecting a patch from a geometry* object, it is automatically highlighted. You can also specify a color for each patch, by selecting it and right click.(Fig caid_fig9)


After selecting colors, we get the final plot (Fig caid_fig10)

  • Editing a Control Point, can be done by selecting a patch, right-click on edit control points. A new window is opend that lists all control points and their weights. When selecting a control point, it is automatically highlighted in the Viewer (Fig caid_fig11a)

Select the control point of interest, and right-click on edit. A new window opens, and you need to set the new values for the selected control point (Fig caid_fig11b)


After modification, the new geometry is (Fig caid_fig11c)



Geometry Actions

Patch Actions


Can be done by moving the mouse wheel or its equivalent on laptop.

To change the camera position maintain the left button pressed while mouving the mouse.

Shows the Viewer Preferences window which is a notebook containing the following pages

1- The grid page (Fig. viewer_actions_fig_preferences_grid).


Viewer Preferences: The grid page.

2- The colors page (Fig. viewer_actions_fig_preferences_colors).


Viewer Preferences: The colors page.

3- The viewer page (Fig. viewer_actions_fig_preferences_viewer).


Viewer Preferences: The viewer page.


a rajouter

  • 2D view

    Puts and fixes the camera perpendicular to the 2D plan

  • 3D view

    Unclampes the camera in order to have a 3D view

  • Show Grid

    Shows the grid (needs a 2D view)

  • Hide Grid

    Hides the grid

  • Grid as Points

    Sets the grid as points rather than lines

  • Grid as Lines

    Sets the grid as lines

  • Clear Markers

    Clears the Marker list points

  • Clear Selected Points

    Clears the Selected list points

  • Fixed Markers

    Uses the nearest point to the grid when selecting it from the viewer

  • Floating Markers

    Uses a Floating Marker (the opposite of Fixed Markers action)

  • Add Marker

    Edits and adds a new Marker

  • Import Markers

    Imports Markers from a given file

  • Export Markers

    Exports and save the Markers points list

  • Print

    Prints the current viewer

  • Preferences

    See Viewer Preferences for more details.


CAID can be used to visualize B-spline/NURBS objects defined on a given geometry. These objects can be the result of you own B-spline based solver, or using pigasus. For the moment, only the pfl extension, which is based on XML format, is allowed. The solution must be defined as a couple (geometry,geometry_v) where geometry describes the mapping and geometry_v the B-spline/NURBS objects. In igakit and CAID, this is known as a field.

An example of use is the following:

caid U.pfl

You can find in caid/models/fields some examples of such fields. In figures (Fig. inspector_field_poisson_circle Fig. inspector_field_neumann_quart_circle) we show some of them:


Plot of the numerical solution of the Poisson equation on a circle.


Plot of the numerical solution of the Laplace equation, with Neumann boundaries conditions, on a quart-circle.


The actual version in CAID uses a Python loop to evaluate and draw all Bezier surfaces. A new version based on OpenGL shaders has been implemented, which uses GPU capabilities. This is a work under progress.

  • Zoom In/Out

Can be done by moving the mouse wheel or its equivalent on laptop.

  • Camera Position

To change the camera position maintain the left button pressed while mouving the mouse.

Here are given the list keybord shortcuts.

  • m or M

    Access the Viewer Preferences window

  • ESC

    Closes the Viewer window

Shows the Viewer Preferences window which is a notebook containing the following pages

1- The Menu page (Fig. inspector_field_viewer_fig_preferences_grid).


Viewer Preferences: The Menu page.

2- The colors page (Fig. inspector_field_viewer_fig_preferences_colors).


Viewer Preferences: The colormap page.

3- The viewer page (Fig. inspector_field_viewer_fig_preferences_viewer).


Viewer Preferences: The colorbar page.

Vectorial Spaces

In this section, we show how to construct a discrete vectorial space for a given geometry after scpecifying the boundary conditions.

1- In the geometry inspector window, select the geometry that you want to use.

2- Press the Mouse Right-button and click on Set Boundary Conditions

3- Navigate through the geometry in the inspector, and choose a boundary condition for each face of interest. This is done by a Right-button mouse click as shown in (Fig. inspector_spaces_set_boundary_condition).


Choose a boundary condition on a specific face

4- If you want to have Dirichlet boundary condition on the whole domain, skip the last point and right-click on the geometry. Then choose Dirichlet Boundary Condition (see Fig. inspector_spaces_set_boundary_condition_final)

5- When you have finished the last remaining step is to save these bondary conditions as shown in (Fig. inspector_spaces_set_boundary_condition_final)


Choose Dirichlet boundary conditions or save them.

6- Finally, create the vectorial space with a right-click on the geometry as shown in (Fig. inspector_spaces_create_vectorial_space)


Create the vectorial space after specifying the boundary conditions.

A new window appears which contains a space inspector (see Fig. inspector_spaces). As you can see, you have access to the geometry and a new object: the connectivity.


The space inspector.

The connectivity is defined using two arrays:

  • ID which maps the global id of a basis function with its position in the discrete matrix.
  • LM given a patch and an element tuple (or an element global index), this array maps the local index of the basis function to its id in ID

The user can export these arrays by a right-click on the connectivity and then press Export, as shown in (Fig. inspector_spaces_connectivity_export)


Export the connectivity (ID and LM arrays) of the current vectorial space.


CAID offers the possibility of using command lines and manipulating geometries directly from a Python Shell. First select the current workgroup and then click on Start Command Line in the Tools menu (or press keyboard shortcut F9). The Python Shell window appears, which look likes (Fig. )


The internal Python Shell.

In the current example, in order to access to the list of geometries of the current workgroup, type:

>>> geometries
[<geometry.geometry object at 0x497cad0>, <geometry.geometry object at 0x497ca90>, <geometry.geometry object at 0x497ce50>]

While the workgroup can be accessed via:

>>> workgroup

You can for example, run a poisson solver on a given geometry:

>>> geo = geometries[2]
>>> f = lambda x,y:[x*y]
>>> run_poisson(geo, AllDirichlet=True, f=f)

as shown in figure (Fig. pyshell_run_poisson)


Runing the Poisson solver on a given geometry.


This work is under progress. In the future, the user will be able to access the geometry by given its name. We will add other solvers too.

When a workgroup is selected in the workgroup tree inspector, it can be accessed using:

>>> wk = workgroup

A geometry object can be accessed by given its id using:

>>> geo = geometries[0]


access geometry by name

You can make your own plugin visible inside PyShell by adding it:

gvim $CAID_SRC/

and adding your import and modifying the setVisibleVariables function:

>>> def setVisibleVariables(self):
>>>     wk = self.parent.tree.currentWorkGroup
>>>     # ... workgroup
>>>     __main__.__dict__["workgroup"]  = wk
>>>     # ... geometry elements
>>>      __main__.__dict__["geometries"]  = wk.list_geo

Macro Recording

Macro Recording is a capability that allows users to record almost in action (both geometry and patch actions) and generate the equivalent Python script (macro).

To activate the Macro Recording capability, press Macro Recording in Tools menu, or press F4 if the current workgroup is selected in the workgroup inspector tree.

Once you finish, press again on F4 or Stop Macro Recording in Tools menu. A Python Editor window will open with the recorded actions. You can modify the file and save it somewhere.

You can open and edit your macro by pressing Python Editor in Tools menu or F3 if the current workgroup is selected in the workgroup inspector tree.

In order to run the generated macro press on the execute button in the Python Editor.

Python Editor

CAID embeeds a Python Editor. You can interact with CAID via the editor by executing your own Python commands.

To open the Python Editor, press Python Editor in Tools menu, or press F3 if the current workgroup is selected in the workgroup inspector tree.

You can open and edit your macro or script by pressing Python Editor in Tools menu or F3 if the current workgroup is selected in the workgroup inspector tree.

In order to execute your macro or script press on the execute button in the Python Editor.

The following example shows how to create a nem geometry object and add it into the workgroup. Let us consider the following python script:

import numpy as np
from igakit.nurbs import NURBS
from igakit.cad_geometry import *
from geometry import geometry

def make_crv():
    C = [[ 6.0, 0.0, 6.0],
         [-5.5, 0.5, 5.5],
         [-5.0, 1.0,-5.0],
         [ 4.5, 1.5,-4.5],
         [ 4.0, 2.0, 4.0],
         [-3.5, 2.5, 3.5],
         [-3.0, 3.0,-3.0],
         [ 2.5, 3.5,-2.5],
         [ 2.0, 4.0, 2.0],
         [-1.5, 4.5, 1.5],
         [-1.0, 5.0,-1.0],
         [ 0.5, 5.5,-0.5],
         [ 0.0, 6.0, 0.0],]
    U = [0, 0, 0, 0,
         .1, .2, .3, .4, .5, .6, .7, .8, .9,
         1, 1, 1, 1,]
    nrb = NURBS([U], C)
    return nrb

nrb = make_crv()
cad_nrb = cad_nurbs(nrb.knots, nrb.points)
geo = cad_geometry()

wk = workgroup

save and store it somewhere, and then run CAID. Press F3 and open it in the Python Editor.


The Python Editor using the previous script.

press execute, you’ll see the following curve in the viewer


The result of the previous script.

Macros and Plugins