Example #1
0
# Draw mesh

cfv.figure()
cfv.drawMesh(coords=coords,
             edof=edof,
             dofsPerNode=dofsPerNode,
             elType=elType,
             filled=True)

# Add a text in world space

cfv.addText("This is a Text", pos=(1, 0.5, 0.5), angle=45)

# Add a label in the screen space

ourLabel = cfv.addLabel("This is a Label", pos=(20, 30), angle=-45)

# We can change the attributes of labels and texts, such as color and position.

ourLabel.text = "Label, changed."

# Make it red. (1,0,0) would also have worked.

ourLabel.textColor = 'r'

# Matlab style axes (three axes in the background instead of a cube)

cfv.gca().axis.showBox = 0

#Change the limits of the axes.
Example #2
0
# Draw geometry

cfv.drawGeometry(g, drawPoints=False)

# Draw mesh

vv.figure()
cfv.drawMesh(coords=coords, edof=edof, dofsPerNode=dofsPerNode, elType=elType, filled=True)

# Add a text in world space

cfv.addText("This is a Text", pos=(1, 0.5, 0.5), angle=45)  

# Add a label in the screen space

ourLabel = cfv.addLabel("This is a Label", pos=(20,30), angle=-45) 

# We can change the attributes of labels and texts, such as color and position.

ourLabel.text = "Label, changed." 

# Make it red. (1,0,0) would also have worked.

ourLabel.textColor = 'r'  

# Matlab style axes (three axes in the background instead of a cube)

vv.gca().axis.showBox = 0 

#Change the limits of the axes.
Example #3
0
#  marker of a given element (index).

coords, edof, dofs, bdofs, elementmarkers = meshGen.create()

# ---- Visualise mesh -------------------------------------------------------

# Hold left mouse button to pan.
# Hold right mouse button to zoom.

# Draw the geometry. Note that surfaces and volumes are not drawn at all by 
# this function.

cfv.drawGeometry(g)

# New figure window

vv.figure() 

cfv.drawMesh(coords=coords, edof=edof, dofsPerNode=dofsPerNode, elType=elType, filled=True, title="Example 01") #Draws the mesh.

cfv.addText("This is a Text", pos=(1, -0.3), angle=45)  #Adds a text in world space

ourLabel = cfv.addLabel("This is a Label", pos=(100,200), angle=-45) #Adds a label in the screen space
ourLabel.text = "Label, changed." #We can change the attributes of labels and texts, such as color, text, and position.
ourLabel.textColor = 'r'  #Make it red. (1,0,0) would also have worked.
ourLabel.position = (20,30)

# Enter main loop:
app = vv.use()
app.Create()
app.Run()