Jump to content

OCCT DRAW

From FreeCAD Documentation

Overview

This page is a cheat sheet for the OpenCASCADE Draw tool. Important links:

Cheat sheet

Initialization

Load all modules:

pload ALL

Load a Draw/tcl file (for example test.tcl):

source test.tcl

Find files in your system:

pwd
cd ..
ls

Restore a BREP file

Restore file model.brep into variable model:

restore model.brep model

Display a model

Display model model:

vdisplay model
vfit

Find an edge or face in the model

Display the model first.

For edges, choose selection mode 2, for faces selection mode 4:

vselmod 2 on

Pick an edge or face in the window and find the number of the edge or face:

vstate

It will say something like this:

Locally selected sub-shapes within model:
       Edge #4

Explode model model with e for edges or f for faces:

explode model e

You can access edge #4 with model_4, for example displaying it:

vdisplay model_4

Get a subshape of a model model directly, face 3 and display it:

subshape model f 3
vdisplay model_3

Checking shapes

Various commands to check shape shape:

checkshape shape
bopcheck shape
whatis shape
nbshapes shape

Tolerances

Investigate the tolerances of shape shape:

toler shape
dump shape

Set the tolerance of a shape shape:

dset tolerance 0.0001
settolerance shape tolerance

Fillets and chamfers

Create a fillet with radius 0.5 or a chamfer with distance 0.5 on the first edge of model and store it in shape result. Notice that the position of the radius and distance is reversed for the two different calls, for fillet:

blend result model 0.5 model_1

For chamfer:

chamf result model model_1 0.5

Create a box

Create a box b

box b 0 0 0 1 2 3

Background information

Installation

The Draw program is typically installed together with your OpenCASCADE distribution. On Linux, you can typically find the program in your path under DRAWEXE.

If you followed Compile with OCCT, you can find the Draw tool of the custom version in your distribution directory, in the bin directory of your distribution.

To make sure that I load an OCCT Draw from a particular distribution, I have the following function in my $HOME/.bashrc:

function set-occt() {
    if [ -z "$1" ]; then
	echo "Usage: set-occt <dir>"
	return 1
    fi
    if [ ! -d "$1" ]; then
	echo "Error: Directory $1 does not exist"
	return 1
    fi
    pushd "$1" > /dev/null
    export CASROOT=
    export CSF_OCCTResourcePath=$PWD/share/opencascade/resources
    export LD_LIBRARY_PATH=$PWD/lib:$LD_LIBRARY_PATH
    export PATH=$PWD/bin:$PATH
    source ./bin/env.sh
    popd > /dev/null
}

Suppose I want to make use of the OCCT version that is in the following installation directory /scratch/dist-occt-main, I execute the following in my bash shell:

set-occt /scratch/dist-occt-main

I verify whether the correct Draw program is really in my path:

which DRAWEXE

This should print:

/scratch/dist-occt-main/bin/DRAWEXE

You can verify the version number with:

DRAWEXE --help