Interface Classes OpenCASCADE Sketcher

Class Sketcher get event from outside and handle it. Let’s briefly review the process entering object. User choose entering object method, sketcher get this data, select corresponding comand from command list, switch it to waiting input data state with method:

void Sketcher_Command::Action();

 

To input point and douse moving point with cursor coordinates transmit to this command

Standard_Boolean Sketcher_Command::MouseInputEvent(const gp_Pnt2d& thePnt2d);
void Sketcher_Command::MouseMoveEvent(const gp_Pnt2d& thePnt2d);

 

After that point transmit to Sketcher_AnalyserSnap to find snap point

gp_Pnt2d Sketcher_AnalyserSnap::MouseInput(const gp_Pnt2d& thePnt2d);
gp_Pnt2d Sketcher_AnalyserSnap::MouseMove(const gp_Pnt2d& thePnt2d);

 

Some snaps cannot be founded without additional data. It’s parallel, perpendicular, tangent. It’s necessary to have first point of line to find this snaps. In that case calls following methods:

gp_Pnt2d Sketcher_AnalyserSnap::MouseInputException(const gp_Pnt2d& p1, const gp_Pnt2d& thePnt2d, TangentType CType, Standard_Boolean TangentOnly);
gp_Pnt2d Sketcher_AnalyserSnap::MouseMoveException(const gp_Pnt2d& p1, const gp_Pnt2d& thePnt2d, TangentType CType, Standard_Boolean TangentOnly);

 

Sketcher_AnalyserSnap transmit point for snap class with methods:

gp_Pnt2d Sketcher_Snap::MouseInputEvent(const gp_Pnt2d& tempPnt2d);
gp_Pnt2d Sketcher_Snap::MouseMoveEvent(const gp_Pnt2d& tempPnt2d);

 

Additional data transmit with:

void Sketcher_Snap::setFirstPnt(const gp_Pnt2d& p);
void Sketcher_Snap::setFirstPnt(const gp_Pnt2d& p,TangentType ct);

 

Also, following methods uses at analyser mode to get distance and snap method:

Standard_Boolean Sketcher_Snap::AnalyserEvent(const gp_Pnt2d& tempPnt2d, gp_Pnt2d& newPnt2d, Standard_Real& dist,Standard_Integer& type);

 

It’s necessary to supply continuity input objects at polyline mode. Point is a connecting-link of arc and line. It’s transmit between two classes: Sketcher_CommandArc3P and Sketcher_CommandLine2P with two methods:

void Sketcher_Command::SetPolylineFirstPnt(const gp_Pnt2d& p1);
Standard_Boolean Sketcher_Command::GetPolylineFirstPnt(gp_Pnt2d& p1);

Function call realize at class Sketcher.


Cancel event transmit to current entering command and snap manager:

void Sketcher_Command::CancelEvent();
void Sketcher_AnalyserSnap::Cancel();

 

Snap manager erase all snaps:

void Sketcher_Snap::EraseSnap();

 

Object edit realizing with properties classes. Sketcher_Property is a base class of it. Sketcher determine object to show it’s properties, transmit this object to class Sketcher_GUI, with manage properties classes:

void Sketcher_GUI::SetSketcher_Object(Handle(Sketcher_Object)& CurObject)

 

After that object trasmith to class editing correspondingly object:

void Sketcher_Property::SetObject(Handle(Sketcher_Object)& CurObject);

 

Numerous classes uses context, coordinate system and object list.

OpenCASCADE Sketcher

www.laduga.com

www.laduga.ru