View operations of OCAF document

Hello everyone,

How can I implement an OCAF tree of operations into an application? (I have already set up OCAF)
The advanced OCAF sample implements this (Under Value-added software).
Does anyone have any documentation or code for this? Or even better part of advanced OCAF sample?

Thank you!

Forum supervisor's picture

Dear Daniel,
I suggest you to start from "OCAF User's Guide" available with release (see occt_ocaf.pdf).
Best regards

AP's picture

Hi Daniel

you can begin by using the Draw Test Harness, to learn to interact with OCAF:

for example on poencascade version 6.7.0, load the draw test harness application, paste the following into the Draw Test Harness command prompt after it loads:

pload ALL
NewDocument D
NewChild D 0:1
NewChild D 0:1:1
NewChild D 0:1:1
NewChild D 0:1:1
NewChild D 0:1:1
SetReal D 0:1:1:1 10
SetReal D 0:1:1:2 30
SetReal D 0:1:1:3 40
NewChild D 0:1:1:4
NewChild D 0:1:1:4
NewChild D 0:1:1:4
SetReference D 0:1:1:4:1 0:1:1:1
SetReference D 0:1:1:4:2 0:1:1:2
SetReference D 0:1:1:4:3 0:1:1:3
set reflab1 0:1:1:4:1
set reflab2 0:1:1:4:2
set reflab3 0:1:1:4:3
GetReal D [GetReference D ${reflab1}] ref1val
puts ref1val
GetReal D [GetReference D ${reflab2}] ref2val
puts ref2val
GetReal D [GetReference D ${reflab3}] ref3val
puts ref3val
NewChild D 0:1:1:4
box b ref1val ref2val ref3val
NewShape D 0:1:1:4:4 b
NewChild D 0:1
CopyDF D 0:1:1 D 0:1:2
NewChild D 0:1
CopyDF D 0:1:1 D 0:1:3
NewChild D 0:1
CopyDF D 0:1:1 D 0:1:4
NewChild D 0:1
CopyDF D 0:1:1 D 0:1:5
NewChild D 0:1
CopyDF D 0:1:1 D 0:1:6
DFBrowse D


this is going to create a Data Tree

with three parameters and then a fourth label will contain 3 references to the first parameters, than a box is built using the values from the referenced parameters.

than the entire dataframe is copied many times into different locations making copies of the object.
when the DF browser loads double click the Browser_D tree item and resize the window to fit the tree.

Look at the DrawTest Harness User Guide and search for OCAF commands...

After you get a feel for how to create data frames and interact with the using the DFBrowse command.

Then go to the OpenCascade Source code and you can see how each command in Draw has been implemented, then copy paste the code into your app until you can replicate exactly what you did in DRAW.

look in src code:


for example:

the NewChild command is DDF_BasicCommands.cxx and its mapped as DDF_NewChild
the CopyDF command is in DDF_DataCommands.cxx and its mapped as CopyDF
the SetReference command is in DDataStd_BasicCommands.cxx and is mapped as DDataStd_SetReference

use grep to search for each command or windows grep if your on windows.

Hope this helps



Daniel Park's picture

Hello Alex,

Thank you for your detailed reply.
It is very useful

Daniel Neander