For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

TDF_Label Problem

yeon cheol Kang's picture

hi. i make a edge object which structure is below.

+ ------
+ -------- ----> TDataStd_Name : Edge1
| |
| + ---------- ------> TDataStd_Name : Vertex1
| | |
| | + -------> TDataStd_Real : X
| | |
| | + -------> TDataStd_Real : Y
| | |
| | + -------> TDataStd_Real : Z
| |
| |
| + ---------- ------> TDataStd_Name : Vertex2
| |
| + -------> TDataStd_Real : X
| |
| + -------> TDataStd_Real : Y
| |
| + -------> TDataStd_Real : Z
+ -------- ----> TDataStd_Name : Edge2
+ ---------- ------> TDataStd_Name : Vertex3
| |
| + -------> TDataStd_Real : X
| |
| + -------> TDataStd_Real : Y
| |
| + -------> TDataStd_Real : Z
+ ---------- ------> TDataStd_Name : Vertex4
+ -------> TDataStd_Real : X
+ -------> TDataStd_Real : Y
+ -------> TDataStd_Real : Z

it's no problem if i make edge which has independent vertex.
But i want to make a Edge which have same vertex.


but i don't know how to link the vertex in label and TFunction..

could you help me?

yeon cheol Kang's picture

sorry, figure is broken

Edge1 tag is 0:1
Edge2 tag is 0:2

and Vertex1,2 is Child of Edge1. and Vertex3,4 is Child of Edge2. also X,Y,Z Attribute is child of each vertex.


Forum supervisor's picture

Dear yeon cheol,
I hope "Application Framework User’s Guide" and
can help you to find the solution.

yeon cheol Kang's picture

Hi. Supervisor. i'm sorry too late to reply your recommendation.

I already read that. But I can't understand about implementation relate to TDF_Reference.

But i sucess to apply my application. Of course, i can't sucess if there is no advice.

I appreciate your kinds.

I hope that if this guide is pressed at next time, there are more detail explain in

there. :-)

Have a nice day~

Forum supervisor's picture

We are glad you have succeeded with your application. If you want to get a more detailed explanation (and professional assistance) you may contact us via the Contact Form We will be pleased to discuss all relevant details with you.

Yuriy Sinithin's picture

Hi, you may set only coordinates of your point,
something like this:

TDF_Label level1 = L.FindChild(1,Standard_True);
TDataStd_Real::Set(level1.FindChild(1), x1);
TDataStd_Real::Set(level1.FindChild(2), y1);
TDataStd_Real::Set(level1.FindChild(3), z1);
TDataStd_Real::Set(level1.FindChild(4), x2);
TDataStd_Real::Set(level1.FindChild(5), y2);
TDataStd_Real::Set(level1.FindChild(6), z2);

Or you can add the geometry point in your shape with Brep::Add:

static uint aErrorCode;

TopoDS_Shape EdgeBuild::MakeEdge(const double &myX1 , const double &myY1 , const double &myZ1,
const double &myX2 , const double &myY2 , const double &myZ2)
aErrorCode = 0;
TopoDS_Shape ResultShape;
const double myDist = sqrt(pow(myX2-myX1,2.0)+pow(myY2-myY1,2.0)+pow(myZ2-myZ1,2.0));
if (myDist {
aErrorCode = 1;
return ResultShape;

gp_Pnt P1(myX1,myY1,myZ1);
gp_Pnt P2(myX2,myY2,myZ2);
gp_Lin Lin(P1,gp_Vec(P1,P2));
Handle(Geom_Line) GL = new Geom_Line(Lin);

TopoDS_Edge& E = TopoDS::Edge(ResultShape);

BRep_Builder Brep;

Brep.Range(E,0,myDist); //limit length

//First and last
TopoDS_Vertex V1,V2;



return ResultShape;

yeon cheol Kang's picture

Thanks!! your kind. I can success to make Edge object.

this is tip about how to use TDF_Reference.

when you use already existed object information, you use upper object.

TDF_Reference is descendant class of TDF_Attribute.

Some example is below code.

Assume there is a Vertex in your view. you want to use that like below.

Vertex1 Vertex2

# : Existed Object
+ : New object.

and Assume Vertex entry is 0:1 and Vertex have TDataStd_Real Attribute to store the position x,y,z. also Vertex1 is it's lable name. Each Entry is 0:1:1, 0:1:2, 0:1:3. and then, I make Edge Label have Reference information about Vertex1, new information about Vertex2.

TDF_Label EdgeLabel = TDF_TagSource(anyLabel);
TDF_Label VertexLabel1 = EdgeLabel.FindChild(1);
TDF_Label VertexLabel2 = EdgeLabel.FindChild(2);

and then You use the TDF_Reference to link between VertexLabel1 and Vertex1.

TDF_Reference::Set(VertexLabel1, Vertex1) // If you want to reference the Attribute about Vertex1
TDF_Reference::Set(VertexLabel1.FindChild(1), Vertex1.FindChild(1)) // reference the x
TDF_Reference::Set(VertexLabel1.FindChild(2), Vertex1.FindChild(2)) // reference the y
TDF_Reference::Set(VertexLabel1.FindChild(3), Vertex1.FindChild(3)) // reference the z

finally, In virtual method Excute() your descendant class of TFunction_Driver, You get Reference Value about Vertex1.

Handle(TDataStd_Real) TSR;
Handle(TDF_Reference) Ref;
Standard_Real x1,y1,z1,x2,y2,z2;

// Vertex 1;
if(Label().FindChild(1,Standard_False).FindChild(1,Standard_False).FindAttribute(TDataStd_Real::GetID(), TSR ))
else if(Label().FindChild(1,Standard_False).FindChild(1,Standard_False).FindAttribute(TDF_Reference::GetID(), Ref))
if(Ref->Get().FindAttribute(TDataStd_Real::GetID(), TSR))
return 1;

same procedure

this code is helpful your application.

Yuriy Sinithin's picture

Hi, YeonCheol.
After any transformations of object you have only value that you input in TDF_Label... or you can modify this attribute on any transform operations, like translate, scale .... I'm use Brep::Add method to define this points like a part of geometrical object and after transformation this point is modified too.

yeon cheol Kang's picture

Hi. I'm sorry too late to read your reply. I arrived my office last night.

i read your reply then find to check what does it function. (BRep::Add)

But i don't understand about exactly function of Add.

if you explain more detail about add, i'm really appriciate your kinds.

could you explain it and show some example code??

have a nice day :-)

yeon cheol Kang's picture

Sorry, I find that in the end of your code.

But I have a question about mechanism of Your recommendation.

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.