0022088: EDF 1631 GEOM : 2D sketcher interface

This commit is contained in:
vsr 2013-05-29 16:27:24 +00:00
parent d331308a89
commit e4a31d66fd
10 changed files with 3072 additions and 619 deletions

View File

@ -32,10 +32,29 @@ sketcher1 = geompy.MakeSketcher("Sketcher:F -100 -100:TT 250 -100:R 0:C 100 150:
# create a sketcher (wire) on the given face
sketcher2 = geompy.MakeSketcherOnPlane("Sketcher:F 10 -30:R 10:C 20 180:R 15:L 50:WW", face)
# Create the same 2D sketchers with Sketcher2D interface
sk = geompy.Sketcher2D()
sk.addPoint(-100, -100)
sk.addSegmentAbsolute(250, -100)
sk.addArcAngleRadiusLength(0, 100, 150)
sk.addSegmentAngleLength(0, 300)
sk.close()
sketcher3 = sk.face([100, 0, 0, 1, 1, 1, -1, 1, 0])
sk = geompy.Sketcher2D()
sk.addPoint(10, -30)
sk.addArcAngleRadiusLength(10, 20, 180)
sk.addSegmentAngleLength(15, 50)
sk.close()
sketcher4 = sk.wire(face)
# add objects in the study
id_face = geompy.addToStudy(face,"Face")
id_sketcher1 = geompy.addToStudy(sketcher1,"Sketcher1")
id_sketcher2 = geompy.addToStudy(sketcher2,"Sketcher2")
id_sketcher3 = geompy.addToStudy(sketcher3, 'Sketcher3' )
id_sketcher4 = geompy.addToStudy(sketcher4, 'Sketcher4' )
# display the first sketcher and the second sketcher with its planar face
gg.createAndDisplayGO(id_face)
@ -43,3 +62,6 @@ gg.setDisplayMode(id_face,1)
gg.setTransparency(id_face,0.5)
gg.createAndDisplayGO(id_sketcher1)
gg.createAndDisplayGO(id_sketcher2)
gg.createAndDisplayGO(id_sketcher3)
gg.createAndDisplayGO(id_sketcher4)

View File

@ -155,12 +155,16 @@ segments.
points in the current LCS.
\n <em>WorkingPlane</em> can be a Local CS, a plane, or a planar face.
\n Another way to create the 2D Sketcher in TUI is using Sketcher2D
interface.
<b>TUI Command:</b> <em>sk = geompy.Sketcher2D()</em>
Returns an instance of Sketcher2D interface <i>sk</i>.
Use the below examples and see the \ref gsketcher.Sketcher2D "Sketcher2D"
interface documentation for more information.
Our <b>TUI Scripts</b> provide you with useful examples of the use of
\ref tui_sketcher_page "Sketcher".
There is also a wrapper that can help in the construction of a sketcher using simple commands.
The description of this wrapper can be found in the <a class="el" target="_new" href="../../tui/GEOM/docutils/docapi.html#module-salome.geom.sketcher">
dedicated page</a> of the <a class="el" target="_new" href="../../tui/GEOM/docutils/index.html">salome.geom python package</a>.
\ref tui_sketcher_page "2D Sketcher".
*/

View File

@ -1141,18 +1141,14 @@ void EntityGUI_SketcherDlg::ClickOnEnd()
return;
}
QString Parameters;
QString Command = myCommand.join( "" ) + GetNewCommand( Parameters );
Sketcher_Profile aProfile( Command.toAscii() );
Command = myCommand.join( "" );
aProfile = Sketcher_Profile( Command.toAscii() );
TopoDS_Shape myShape;
if ( aProfile.IsDone() )
myShape = aProfile.GetShape();
if ( myShape.ShapeType() != TopAbs_VERTEX )
myCommand.append( ":WW" );
QString Command = myCommand.join( "" );
Sketcher_Profile aProfile = Sketcher_Profile( Command.toAscii() );
bool isDone = false;
TopoDS_Shape myShape = aProfile.GetShape( &isDone );
if ( isDone ) {
if ( myShape.ShapeType() != TopAbs_VERTEX )
myCommand.append( ":WW" );
}
}
else {
/*// PAL16008 (Sketcher Validation should be equal to Apply&Close)
@ -2336,6 +2332,8 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
else {
//Test if the current point is the same as the last one
TopoDS_Shape myShape1, myShape2;
bool isDone = false;
double error = 0.;
// Set "C" numeric locale
Kernel_Utils::Localizer loc;
@ -2343,18 +2341,18 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
//Last Shape
QString Command1 = myCommand.join( "" );
Sketcher_Profile aProfile1( Command1.toAscii() );
if ( aProfile1.IsDone() )
myShape1 = aProfile1.GetShape();
myShape1 = aProfile1.GetShape();
//Current Shape
QString Command2 = Command1 + GetNewCommand( aParameters );
Sketcher_Profile aProfile2( Command2.toAscii() );
myShape2 = aProfile2.GetShape( &isDone, &error );
//Error Message
if ( mySketchType == PT_ABS_CENTER || mySketchType == PT_REL_CENTER ){
if (aProfile2.Error() > Precision::Confusion()){
if (error > Precision::Confusion()){
Group4Spin->label->show();
Group4Spin->label->setText( tr("GEOM_SKETCHER_WARNING") + QString::number( aProfile2.Error(), Format, DigNum));
Group4Spin->label->setText( tr("GEOM_SKETCHER_WARNING") + QString::number( error, Format, DigNum));
}
else{
Group4Spin->label->hide();
@ -2363,9 +2361,9 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
else
Group4Spin->label->hide();
if ( mySketchType == PT_SEL_CENTER ){
if (aProfile2.Error() > Precision::Confusion()){
if (error > Precision::Confusion()){
Group2Sel->label->show();
Group2Sel->label->setText( tr("GEOM_SKETCHER_WARNING") + QString::number( aProfile2.Error(), Format, DigNum));
Group2Sel->label->setText( tr("GEOM_SKETCHER_WARNING") + QString::number( error, Format, DigNum));
}
else{
Group2Sel->label->hide();
@ -2374,9 +2372,6 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
else
Group2Sel->label->hide();
if ( aProfile2.IsDone() )
myShape2 = aProfile2.GetShape();
if ( myShape2.IsNull() ) {
//the current point is the same as the last one
myLastX2 = myLastX1;

View File

@ -32,6 +32,7 @@
#include "GEOM_SubShapeDriver.hxx"
#include "GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient.hxx"
#include "GEOM_PythonDump.hxx"
#include "Sketcher_Profile.hxx"
#include <Basics_OCCTVersion.hxx>
@ -154,6 +155,7 @@ void PublishObject (TObjectData& theObjectData,
namespace
{
//================================================================================
/*!
* \brief Fix up the name of python variable
@ -959,6 +961,107 @@ std::list<int> GEOM_Engine::getAllTextures(int theDocID)
// Internal functions
//===========================================================================
//=============================================================================
/*!
* MakeCommandfor3DSketcher: Make new command for 3DSketcher
*/
//=============================================================================
TCollection_AsciiString MakeCommandfor3DSketcher (const TCollection_AsciiString& theDescr )
{
TCollection_AsciiString aNewDescr;
int i = 1;
TCollection_AsciiString aSubStr = theDescr.Token("\n\t", i);
for (; !aSubStr.IsEmpty(); aSubStr = theDescr.Token("\n\t", i)) {
if (aSubStr.Search( "Make3DSketcherCommand" ) != -1) {
TCollection_AsciiString aResult = aSubStr.Token(" ", 1);
// "3DSketcher:CMD[:CMD[:CMD...]]"
TCollection_AsciiString aCommand = aSubStr.Token("\"", 2);
// Split the command string to separate CMDs
int icmd = 2;
TColStd_SequenceOfAsciiString aSequence;
if (aCommand.Length()) {
TCollection_AsciiString aToken = aCommand.Token(":", icmd);
while (aToken.Length() > 0) {
aSequence.Append(aToken);
aToken = aCommand.Token(":", ++icmd);
}
}
if (aSequence.Length() > 0) {
if (i > 1)
aNewDescr += "\n\t";
aNewDescr += "\nsk = geompy.Sketcher3D()";
int nbCMDs = aSequence.Length();
for (icmd = 1; icmd <= nbCMDs; icmd++) {
aNewDescr += "\n\t";
TCollection_AsciiString aCMD = aSequence.Value(icmd);
// Split the CMD into string values
TColStd_SequenceOfAsciiString aStrVals;
int ival = 1;
TCollection_AsciiString aToken = aCMD.Token(" ", ival);
while (aToken.Length() > 0) {
aStrVals.Append(aToken);
aToken = aCMD.Token(" ", ++ival);
}
TCollection_AsciiString aCMDpref = aStrVals.Value(1);
if (aCMDpref == "TT") {
aNewDescr += "sk.addPointsAbsolute(";
aNewDescr += aStrVals.Value(2) + ", " + aStrVals.Value(3) + ", " + aStrVals.Value(4) + ")";
}
else if (aCMDpref == "T") {
aNewDescr += "sk.addPointsRelative(";
aNewDescr += aStrVals.Value(2) + ", " + aStrVals.Value(3) + ", " + aStrVals.Value(4) + ")";
}
else if (aCMDpref == "WW") {
aNewDescr += "sk.close()";
}
else if (aCMDpref.Value(1) == 'O'){
TCollection_AsciiString aCMDtrunc = aStrVals.Value(1);
aCMDtrunc.Trunc(3);
if (aCMDpref.Value(4) == 'C')
aNewDescr += "sk.addPointRadiusAngleH";
else
aNewDescr += "sk.addPointRadiusAngles";
if (aCMDpref.Value(5) == 'A')
aNewDescr += "Absolute(";
else
aNewDescr += "Relative(";
aNewDescr += aStrVals.Value(4) + ", " +
aStrVals.Value(2) + ", " + aStrVals.Value(3) + ", " + "\""+aCMDtrunc+"\"" + ")";
}
}
aNewDescr += "\n\t";
aNewDescr += aResult + " = sk.wire()";
}
} // Make3DSketcherCommand
else if (aSubStr.Search( "Make3DSketcher" ) != -1) {
TCollection_AsciiString aResult = aSubStr.Token(" ", 1);
TCollection_AsciiString aCommand = aSubStr.Token("[", 2);
aCommand = aCommand.Token("]", 1);
if (i > 1)
aNewDescr += "\n\t";
aNewDescr += "\nsk = geompy.Sketcher3D()";
aNewDescr += "\n\t";
aNewDescr += "sk.addPointsAbsolute(";
aNewDescr += aCommand + ")";
aNewDescr += "\n\t";
aNewDescr += aResult + " = sk.wire()";
}
else {
if (i > 1)
aNewDescr += "\n\t";
aNewDescr += aSubStr;
}
i++;
}
return aNewDescr;
}
//=============================================================================
/*!
* ProcessFunction: Dump function description into script
@ -1048,100 +1151,13 @@ bool ProcessFunction(Handle(GEOM_Function)& theFunction,
ReplaceVariables(aDescr,theVariables);
//Process sketcher functions, replacing string command by calls to Sketcher interface
if ( ( aDescr.Search( "MakeSketcherOnPlane" ) != -1 ) || ( aDescr.Search( "MakeSketcher" ) != -1 ) ) {
Sketcher_Profile aProfile( aDescr.ToCString());
// Make new command for SketcherOnPlane and for Sketcher
aDescr = aProfile.GetDump();
}
if (aDescr.Search( "Make3DSketcher" ) != -1) {
TCollection_AsciiString aNewDescr;
int i = 1;
TCollection_AsciiString aSubStr = aDescr.Token("\n\t", i);
for (; !aSubStr.IsEmpty(); aSubStr = aDescr.Token("\n\t", i)) {
if (aSubStr.Search( "Make3DSketcherCommand" ) != -1) {
TCollection_AsciiString aResult = aSubStr.Token(" ", 1);
// "3DSketcher:CMD[:CMD[:CMD...]]"
TCollection_AsciiString aCommand = aSubStr.Token("\"", 2);
// Split the command string to separate CMDs
int icmd = 2;
TColStd_SequenceOfAsciiString aSequence;
if (aCommand.Length()) {
TCollection_AsciiString aToken = aCommand.Token(":", icmd);
while (aToken.Length() > 0) {
aSequence.Append(aToken);
aToken = aCommand.Token(":", ++icmd);
}
}
if (aSequence.Length() > 0) {
if (i > 1)
aNewDescr += "\n\t";
aNewDescr += "sk = geompy.Sketcher3D()";
int nbCMDs = aSequence.Length();
for (icmd = 1; icmd <= nbCMDs; icmd++) {
aNewDescr += "\n\t";
TCollection_AsciiString aCMD = aSequence.Value(icmd);
// Split the CMD into string values
TColStd_SequenceOfAsciiString aStrVals;
int ival = 1;
TCollection_AsciiString aToken = aCMD.Token(" ", ival);
while (aToken.Length() > 0) {
aStrVals.Append(aToken);
aToken = aCMD.Token(" ", ++ival);
}
TCollection_AsciiString aCMDpref = aStrVals.Value(1);
if (aCMDpref == "TT") {
aNewDescr += "sk.addPointsAbsolute(";
aNewDescr += aStrVals.Value(2) + ", " + aStrVals.Value(3) + ", " + aStrVals.Value(4) + ")";
}
else if (aCMDpref == "T") {
aNewDescr += "sk.addPointsRelative(";
aNewDescr += aStrVals.Value(2) + ", " + aStrVals.Value(3) + ", " + aStrVals.Value(4) + ")";
}
else if (aCMDpref == "WW") {
aNewDescr += "sk.close()";
}
else if (aCMDpref.Value(1) == 'O'){
TCollection_AsciiString aCMDtrunc = aStrVals.Value(1);
aCMDtrunc.Trunc(3);
if (aCMDpref.Value(4) == 'C')
aNewDescr += "sk.addPointRadiusAngleH";
else
aNewDescr += "sk.addPointRadiusAngles";
if (aCMDpref.Value(5) == 'A')
aNewDescr += "Absolute(";
else
aNewDescr += "Relative(";
aNewDescr += aStrVals.Value(4) + ", " +
aStrVals.Value(2) + ", " + aStrVals.Value(3) + ", " + "\""+aCMDtrunc+"\"" + ")";
}
}
aNewDescr += "\n\t";
aNewDescr += aResult + " = sk.wire()";
}
} // Make3DSketcherCommand
else if (aSubStr.Search( "Make3DSketcher" ) != -1) {
TCollection_AsciiString aResult = aSubStr.Token(" ", 1);
TCollection_AsciiString aCommand = aSubStr.Token("[", 2);
aCommand = aCommand.Token("]", 1);
if (i > 1)
aNewDescr += "\n\t";
aNewDescr += "sk = geompy.Sketcher3D()";
aNewDescr += "\n\t";
aNewDescr += "sk.addPointsAbsolute(";
aNewDescr += aCommand + ")";
aNewDescr += "\n\t";
aNewDescr += aResult + " = sk.wire()";
}
else {
if (i > 1)
aNewDescr += "\n\t";
aNewDescr += aSubStr;
}
i++;
}
aDescr = aNewDescr;
aDescr = MakeCommandfor3DSketcher ( aDescr );
}
if ( theIsDumpCollected ) {

View File

@ -66,9 +66,11 @@ libGEOMbasic_la_CPPFLAGS = \
$(CAS_CPPFLAGS) \
$(KERNEL_CXXFLAGS) \
$(BOOST_CPPFLAGS) \
-I$(srcdir)/../SKETCHER \
-I$(top_builddir)/idl
libGEOMbasic_la_LDFLAGS = \
../SKETCHER/libGEOMSketcher.la \
$(KERNEL_LDFLAGS) -lSALOMELocalTrace -lSALOMEBasics \
$(STDLIB) \
$(CAS_LDPATH) -lTKXSBase -lTKG3d \

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Standard_Stream.hxx>
@ -26,8 +25,8 @@
#include <GEOMImpl_ISketcher.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_Function.hxx>
#include <GEOMUtils.hxx>
#include <Sketcher_Profile.hxx>
#include <Basics_Utils.hxx>
@ -38,9 +37,6 @@
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <gp_Pln.hxx>
#include <Sketcher_Profile.hxx>
#include <Standard_ConstructionError.hxx>
//=======================================================================
@ -79,19 +75,18 @@ Standard_Integer GEOMImpl_SketcherDriver::Execute(TFunction_Logbook& log) const
if (aCommand.IsEmpty())
return 0;
TopoDS_Shape aShape;
// Set "C" numeric locale to save numbers correctly
Kernel_Utils::Localizer loc;
// create sketcher
Sketcher_Profile aProfile (aCommand.ToCString());
Sketcher_Profile aProfile( aCommand.ToCString() );
bool isDone = false;
TopoDS_Shape aShape = aProfile.GetShape( &isDone );
if (!aProfile.IsDone()) {
if ( !isDone ) {
Standard_ConstructionError::Raise("Sketcher creation failed");
}
aShape = aProfile.GetShape();
if (aShape.IsNull())
return 0;

View File

@ -210,7 +210,7 @@ import GEOM
import math
import os
from salome.geom.gsketcher import Sketcher3D
from salome.geom.gsketcher import Sketcher3D, Sketcher2D
# service function
def _toListOfNames(_names, _size=-1):
@ -2405,6 +2405,26 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
self._autoPublish(anObj, theName, "wire")
return anObj
## Obtain a 2D sketcher interface
# @return An instance of @ref gsketcher.Sketcher2D "Sketcher2D" interface
def Sketcher2D (self):
"""
Obtain a 2D sketcher interface.
Example of usage:
sk = geompy.Sketcher2D()
sk.addPoint(20, 20)
sk.addSegmentRelative(15, 70)
sk.addSegmentPerpY(50)
sk.addArcRadiusRelative(25, 15, 14.5, 0)
sk.addArcCenterAbsolute(1, 1, 50, 50, 0, 0)
sk.addArcDirectionRadiusLength(20, 20, 101, 162.13)
sk.close()
Sketch_1 = sk.wire(geomObj_1)
"""
sk = Sketcher2D (self)
return sk
## Create a sketcher wire, following the numerical description,
# passed through <VAR>theCoordinates</VAR> argument. \n
# @param theCoordinates double values, defining points to create a wire,

View File

@ -23,7 +23,7 @@
"""
\namespace geompy
\brief 3D Sketcher interface
\brief 2D and 3D Sketcher interfaces
"""
# This method is used by 3D Sketcher functionality
@ -283,3 +283,898 @@ class Sketcher3D:
wire.SetParameters(Parameters)
self.geompyD._autoPublish(wire, theName, "wire")
return wire
# An interface to build a 2D Sketcher step-by-step.
# Use geompy.Sketcher2D() method to obtain an instance of this class.
class Sketcher2D:
"""
2D sketcher interface.
Example of usage:
sk = geompy.Sketcher2D()
sk.addPoint(20, 20)
sk.addSegmentRelative(15, 70)
sk.addSegmentPerpY(50)
sk.addArcRadiusRelative(25, 15, 14.5, 0)
sk.addArcCenterAbsolute(1, 1, 50, 50, 0, 0)
sk.addArcDirectionRadiusLength(20, 20, 101, 162.13)
sk.close()
Sketch_1 = sk.wire(geomObj_1)
"""
def __init__(self, geompyD):
self.geompyD = geompyD
self.myCommand = "Sketcher"
self.closed = False
pass
## Add one point.
# Used to set the starting point
#
# @param x, y - Coordinates of point
def addPoint (self, x, y):
"""
Add one point.
Used to set the starting point
Parameters:
x, y - Coordinates of point
Example of usage:
sk = geompy.Sketcher2D()
sk.addPoint(20, 20)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":F %s %s" % (printVar(x), printVar(y))
pass
## Add angle.
# Used to set the angle for further building
#
# @param angle - angle in a plane
def addAngle (self, angle):
"""
Add angle.
Used to set the angle for further building
Parameters:
angle - angle in a plane
Example of usage:
sk = geompy.Sketcher2D()
sk.addAngle(70)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":RR %s" % (printVar(angle))
pass
# Commands for creation of segment
## Add segment, which sequentially connects the previous point
# with a point lying on a line parallel to the axis Ox and the value x = param x.
# The current point will be the previous value to the coordinate y and
# new value to the coordinate x.
# Coordinate is considered relative to the previous point.
#
# @param x - Coordinate of point on axis Ox
def addSegmentParalX(self, x):
"""
Add segment, which sequentially connects the previous point
with a point lying on a line parallel to the axis Ox and the value x = param x.
The current point will be the previous value to the coordinate y and
new value to the coordinate x.
Coordinate is considered relative to the previous point.
Parameters:
x - Coordinate of point on axis Ox
Example of usage:
sk = geompy.Sketcher2D()
sk.addSegmentParalX(40)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":X %s" % (printVar(x))
pass
## Add segment, which sequentially connects the previous point
# with a point lying on a line parallel to the axis Ox and the value x = 0
# The current point will be the previous value to the coordinate y.
def addSegmentParalXToZero(self):
"""
Add segment, which sequentially connects the previous point
with a point lying on a line parallel to the axis Ox and the value x = 0
The current point will be the previous value to the coordinate y.
Example of usage:
sk = geompy.Sketcher2D()
sk.addSegmentParalXToZero()
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":XX"
pass
## Add segment, which sequentially connects the previous point
# with a point lying on a line parallel to the axis Oy and the value y = param y.
# The current point will be the previous value to the coordinate x and
# new value to the coordinate y.
# Coordinate is considered relative to the previous point.
#
# @param y - Coordinate of point on axis Oy
def addSegmentParalY(self, y):
"""
Add segment, which sequentially connects the previous point
with a point lying on a line parallel to the axis Oy and the value y = param y.
The current point will be the previous value to the coordinate x and
new value to the coordinate y.
Coordinate is considered relative to the previous point.
Parameters:
y - Coordinate of point on axis Oy
Example of usage:
sk = geompy.Sketcher2D()
sk.addSegmentParalY(80)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":Y %s" % (printVar(y))
pass
## Add segment, which sequentially connects the previous point
# with a point lying on a line parallel to the axis Ox and the value x = 0
# The current point will be the previous value to the coordinate y.
def addSegmentParalYToZero(self):
"""
Add segment, which sequentially connects the previous point
with a point lying on a line parallel to the axis Oy and the value y = 0
The current point will be the previous value to the coordinate x.
Example of usage:
sk = geompy.Sketcher2D()
sk.addSegmentParalYToZero()
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":YY"
pass
## Add segment, which sequentially connects the given point with previous point
#
# Coordinates are considered as absolute.
# @param x, y - Coordinates of point
def addSegmentAbsolute (self, x, y):
"""
Add segment, which sequentially connects the starting point with the given point
Coordinates are considered as absolute.
Parameters:
x, y - Coordinates of point
Example of usage:
sk = geompy.Sketcher2D()
sk.addSegmentAbsolute(30, 50)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":TT %s %s" % (printVar(x), printVar(y))
pass
## Add segment, which sequentially connects the given point with previous point
# Coordinates are considered relative to the previous point.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
#
# @param dx, dy - Coordinates of point relative a previous point
def addSegmentRelative (self, dx, dy):
"""
Add segment, which sequentially connects the given point with previous point
Coordinates are considered relative to the previous point.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
Parameters:
dx, dy - Coordinates of point relative a previous point
Example of usage:
sk = geompy.Sketcher2D()
sk.addSegmentRelative(60, 10)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":T %s %s" % (printVar(dx), printVar(dy))
pass
## Add one straight segment, defined by angle and length.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
# The angle and length coordinates are defined
# in a local coordinate system which origin is the last point of the sketch
#
# @param angle - angle in a plane
# @param length - length of the segment
def addSegmentAngleLength (self, angle, length ):
"""
Add one straight segment, defined by angle and length.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
The radius and angles coordinates are defined
in a local coordinate system which origin is the last point of the sketch
Parameters:
angle - angle in a plane
length - length of the segment
Example of usage:
sk = geompy.Sketcher2D()
sk.addSegmentAngleLength(10, 30)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":R %s:L %s" % (printVar(angle), printVar(length))
pass
## Add one straight segment, defined by angle and intersect straight x= param x.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
# The angle and point's coordinates are defined
# in a local coordinate system which origin is the last point of the sketch
#
# @param angle - angle in a plane
# @param x - value on the axis Ox
def addSegmentAngleX (self, angle, x ):
"""
Add one straight segment, defined by angle and intersect straight x= param x.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
The angle and point's coordinates are defined
in a local coordinate system which origin is the last point of the sketch
Parameters:
angle - angle in a plane
x - value on the axis Ox
Example of usage:
sk = geompy.Sketcher2D()
sk.addSegmentAngleX(25, 90)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":R %s:IX %s" % (printVar(angle), printVar(x))
pass
## Add one straight segment, defined by angle and intersect straight y= param y.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
# The angle and point's coordinates are defined
# in a local coordinate system which origin is the last point of the sketch
#
# @param angle - angle in a plane
# @param y - value on the axis Oy
def addSegmentAngleY (self, angle, y ):
"""
Add one straight segment, defined by angle and intersect straight y= param y.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
The angle and point's coordinates are defined
in a local coordinate system which origin is the last point of the sketch
Parameters:
angle - angle in a plane
y - value on the axis Oy
Example of usage:
sk = geompy.Sketcher2D()
sk.addSegmentAngleY(40, 0)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":R %s:IY %s" % (printVar(angle), printVar(y))
pass
## Add one straight segment, defined by perpendicular(angle=90) and length.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
# The length coordinates are defined
# in a local coordinate system which origin is the last point of the sketch
#
# @param length - length of the segment
def addSegmentPerpLength (self, length ):
"""
Add one straight segment, defined by perpendicular and length.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
The length coordinates are defined
in a local coordinate system which origin is the last point of the sketch
Parameters:
length - length of the segment
Example of usage:
sk = geompy.Sketcher2D()
sk.addSegmentPerpLength(100)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":R 90:L %s" % (printVar(length))
pass
## Add one straight segment, defined by perpendicular(angle=90) and intersect straight x= param x.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
# The point's coordinates are defined
# in a local coordinate system which origin is the last point of the sketch
#
# @param x - value on the axis Ox
def addSegmentPerpX (self, x ):
"""
Add one straight segment, defined by perpendicular(angle=90) and intersect straight x= param x.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
The point's coordinates are defined
in a local coordinate system which origin is the last point of the sketch
Parameters:
x - value on the axis Ox
Example of usage:
sk = geompy.Sketcher2D()
sk.addSegmentPerpX(30)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":R 90:IX %s" % (printVar(x))
pass
## Add one straight segment, defined by perpendicular(angle=90) and intersect straight y= param y.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
# The point's coordinates are defined
# in a local coordinate system which origin is the last point of the sketch
#
# @param y - value on the axis Oy
def addSegmentPerpY (self, y ):
"""
Add one straight segment, defined by perpendicular(angle=90) and intersect straight y= param y.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
The point's coordinates are defined
in a local coordinate system which origin is the last point of the sketch
Parameters:
y - value on the axis Oy
Example of usage:
sk = geompy.Sketcher2D()
sk.addSegmentPerpY(10)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":R 90:IY %s" % (printVar(y))
pass
## Add one straight segment, defined by previous direction and length.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
# The length coordinates are defined
# in a local coordinate system which origin is the last point of the sketch
#
# @param length - length of the segment
def addSegmentLength (self, length ):
"""
Add one straight segment, defined by previous direction and length.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
The length coordinates are defined
in a local coordinate system which origin is the last point of the sketch
Parameters:
length - length of the segment
Example of usage:
sk = geompy.Sketcher2D()
sk.addSegmentLength(100)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":L %s" % (printVar(length))
pass
## Add one straight segment, defined by previous direction and intersect straight x= param x.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
# The point's coordinates are defined
# in a local coordinate system which origin is the last point of the sketch
#
# @param x - value on the axis Ox
def addSegmentX (self, x ):
"""
Add one straight segment, defined by previous direction and intersect straight x= param x.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
The point's coordinates are defined
in a local coordinate system which origin is the last point of the sketch
Parameters:
x - value on the axis Ox
Example of usage:
sk = geompy.Sketcher2D()
sk.addSegmentX(30)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":IX %s" % (printVar(x))
pass
## Add one straight segment, defined by previous direction and intersect straight y= param y.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
# The point's coordinates are defined
# in a local coordinate system which origin is the last point of the sketch
#
# @param y - value on the axis Oy
def addSegmentY (self, y ):
"""
Add one straight segment, defined by previous direction and intersect straight y= param y.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
The point's coordinates are defined
in a local coordinate system which origin is the last point of the sketch
Parameters:
y - value on the axis Oy
Example of usage:
sk = geompy.Sketcher2D()
sk.addSegmentY(10)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":IY %s" % (printVar(y))
pass
## Add one straight segment, defined by direction and length.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
# The direction and length coordinates are defined
# in a local coordinate system which origin is the last point of the sketch
#
# @param dx, dy - direction of the segment
# @param length - length of the segment
def addSegmentDirectionLength (self, dx, dy, length ):
"""
Add one straight segment, defined by direction and length.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
The direction and length coordinates are defined
in a local coordinate system which origin is the last point of the sketch
Parameters:
dx, dy - direction of the segment
length - length of the segment
Example of usage:
sk = geompy.Sketcher2D()
sk.addSegmentDirectionLength(20, 40, 30)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":D %s %s:L %s" % (printVar(dx), printVar(dy), printVar(length))
pass
## Add one straight segment, defined by direction and intersect straight x= param x.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
# The direction and point's coordinates are defined
# in a local coordinate system which origin is the last point of the sketch
#
# @param dx, dy - direction of the segment
# @param x - value on the axis Ox
def addSegmentDirectionX (self, dx, dy, x ):
"""
Add one straight segment, defined by direction and intersect straight x= param x.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
The direction and point's coordinates are defined
in a local coordinate system which origin is the last point of the sketch
Parameters:
dx, dy - direction of the segment
x - value on the axis Ox
Example of usage:
sk = geompy.Sketcher2D()
sk.addSegmentDirectionX(10, -40, 20)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":D %s %s:IX %s" % (printVar(dx), printVar(dy), printVar(x))
pass
## Add one straight segment, defined by direction and intersect straight y= param y.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
# The direction and point's coordinates are defined
# in a local coordinate system which origin is the last point of the sketch
#
# @param dx, dy - direction of the segment
# @param y - value on the axis Oy
def addSegmentDirectionY (self, dx, dy, y ):
"""
Add one straight segment, defined by direction and intersect straight y= param y.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
The direction and point's coordinates are defined
in a local coordinate system which origin is the last point of the sketch
Parameters:
dx, dy - direction of the segment
y - value on the axis Oy
Example of usage:
sk = geompy.Sketcher2D()
sk.addSegmentDirectionY(-10, -50, 20)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":D %s %s:IY %s" % (printVar(dx), printVar(dy), printVar(y))
pass
# Commands for creation of arc
## Add arc, which connects the given point with previous point
# Coordinates are considered as absolute.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
#
# @param x, y - Coordinates of second point of arc
def addArcAbsolute (self, x, y ):
"""
Add arc, which connects the given point with previous point
Coordinates are considered as absolute.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
Parameters:
param x, y - Coordinates of second point of arc
Example of usage:
sk = geompy.Sketcher2D()
sk.addArcAbsolute(50, 10)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":AA %s %s" % (printVar(x), printVar(y))
pass
## Add arc, which connects the given point with previous point
# Coordinates are considered relative to the previous point.
#
# @param dx, dy - Coordinates of second point of arc relative to the previous point
def addArcRelative (self, dx, dy ):
"""
Add arc, which connects the given point with previous point
Coordinates are considered relative to the previous point.
Parameters:
param dx, dy - Coordinates of second point of arc
Example of usage:
sk = geompy.Sketcher2D()
sk.addArcRelative(50, 10)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":A %s %s" % (printVar(dx), printVar(dy))
pass
## Add arc, defined by radius and coordinates of next point.
# Coordinates are considered as absolute.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
#
# @param x, y - Coordinates of second point of arc
# @param radius - radius of arc
# @param flag - is 0 or 2
# if 0 the drawn arc is the one of lower angle (<Pi)
# if 2 the drawn arc is the one of greater angle (>Pi)
def addArcRadiusAbsolute (self, x, y, radius, flag ):
"""
Add arc, defined by radius and coordinates of next point.
Coordinates are considered as absolute.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
Parameters:
param x, y - Coordinates of second point of arc
param radius - radius of arc
param flag - is 0 or 2
if 0 the drawn arc is the one of lower angle (<Pi)
if 2 the drawn arc is the one of greater angle (>Pi)
Example of usage:
sk = geompy.Sketcher2D()
sk.addArcRadiusAbsolute(50, 10, 20, 0)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":UU %s %s %s %s" % (printVar(x), printVar(y), printVar(radius), printVar(flag))
pass
## Add arc, defined by radius and coordinates of next point.
# Coordinates are considered relative to the previous point.
#
# @param dx, dy - Coordinates of second point of arc
# @param radius - radius of arc
# @param flag - is 0 or 2
# if 0 the drawn arc is the one of lower angle (<Pi)
# if 2 the drawn arc is the one of greater angle (>Pi)
def addArcRadiusRelative (self, dx, dy, radius, flag ):
"""
Add arc, defined by radius and coordinates of next point.
Coordinates are considered relative to the previous point.
Parameters:
param dx, dy - Coordinates of second point of arc
param radius - radius of arc
param flag - is 0 or 2
if 0 the drawn arc is the one of lower angle (<Pi)
if 2 the drawn arc is the one of greater angle (>Pi)
Example of usage:
sk = geompy.Sketcher2D()
sk.addArcRadiusRelative(-30, -15, 20, 2)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":U %s %s %s %s" % (printVar(dx), printVar(dy), printVar(radius), printVar(flag))
pass
## Add arc, defined by coordinates of next point and coordinates of center.
# Coordinates are considered as absolute.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
#
# @param x, y - Coordinates of second point of arc
# @param xc, yc - Coordinates of center
# @param flag1 - (reverse) is 0 or 2
# if 0 the drawn arc is the one of lower angle (<Pi)
# if 2 the drawn arc is the one of greater angle (>Pi)
# @param flag2 - (control tolerance) is 0 or 1
# if 0 the specified end point can be at a distance of the arc
def addArcCenterAbsolute (self, x, y, xc, yc, flag1, flag2 ):
"""
Add arc, defined by coordinates of next point and coordinates of center.
Coordinates are considered as absolute.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
Parameters:
param x, y - Coordinates of second point of arc
param xc, yc - Coordinates of center
param flag1 - is 0 or 2
if 0 the drawn arc is the one of lower angle (<Pi)
if 2 the drawn arc is the one of greater angle (>Pi)
param flag2 - (control tolerance) is 0 or 1
if 0 the specified end point can be at a distance of the arc
Example of usage:
sk = geompy.Sketcher2D()
sk.addArcCenterAbsolute(-30, -15, 20, 10, 0, 0)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":EE %s %s %s %s %s %s" % (printVar(xc), printVar(yc), printVar(x), printVar(y),
printVar(flag1), printVar(flag2))
pass
## Add arc, defined by coordinates of next point and coordinates of center.
# Coordinates are considered relative to the previous point.
#
# @param dx, dy - Coordinates of second point of arc
# @param xc, yc - Coordinates of center
# @param flag1 - (reverse) is 0 or 2
# if 0 the drawn arc is the one of lower angle (<Pi)
# if 2 the drawn arc is the one of greater angle (>Pi)
# @param flag2 - (control tolerance) is 0 or 1
# if 0 the specified end point can be at a distance of the arc
def addArcCenterRelative (self, dx, dy, xc, yc, flag1, flag2 ):
"""
Add arc, defined by coordinates of next point and coordinates of center.
Coordinates are considered relative to the previous point.
Parameters:
param dx, dy - Coordinates of second point of arc
param xc, yc - Coordinates of center
param flag1 - is 0 or 2
if 0 the drawn arc is the one of lower angle (<Pi)
if 2 the drawn arc is the one of greater angle (>Pi)
param flag2 - (control tolerance) is 0 or 1
if 0 the specified end point can be at a distance of the arc
Example of usage:
sk = geompy.Sketcher2D()
sk.addArcCenterRelative(-30, -15, 20, 10, 2, 1)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":E %s %s %s %s %s %s" % (printVar(xc), printVar(yc), printVar(dx), printVar(dy),
printVar(flag1), printVar(flag2))
pass
## Add arc, defined by angle, radius and length.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
#
# @param angle - angle in a plane
# @param radius - radius of the arc
# @param length - length of the arc
def addArcAngleRadiusLength (self, angle, radius, length ):
"""
Add arc, defined by angle, radius and length.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
Parameters:
param angle - angle in a plane
param radius - radius of the arc
param length - length of the arc
Example of usage:
sk = geompy.Sketcher2D()
sk.addArcAngleRadiusLength(30, 15, 40)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":R %s:C %s %s" % (printVar(angle), printVar(radius), printVar(length))
pass
## Add arc, defined by perpendicular(angle=90), radius and length.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
#
# @param radius - radius of the arc
# @param length - length of the arc
def addArcPerpRadiusLength (self, radius, length ):
"""
Add arc, defined by perpendicular(angle=90), radius and length.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
Parameters:
param radius - radius of the arc
param length - length of the arc
Example of usage:
sk = geompy.Sketcher2D()
sk.addArcPerpRadiusLength(15, 40)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":R 90:C %s %s" % (printVar(radius), printVar(length))
pass
## Add arc, defined by previous direction, radius and length.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
#
# @param radius - radius of the arc
# @param length - length of the arc
def addArcRadiusLength (self, radius, length ):
"""
Add arc, defined by previous direction, radius and length.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
Parameters:
param radius - radius of the arc
param length - length of the arc
Example of usage:
sk = geompy.Sketcher2D()
sk.addArcRadiusLength(15, 40)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":C %s %s" % (printVar(radius), printVar(length))
pass
## Add arc, defined by direction, radius and length.
# If the first point of sketcher is not yet defined, the
# origin (0, 0) will become the first sketcher point.
#
# @param dx, dy - direction of the arc
# @param radius - radius of the arc
# @param length - length of the arc
def addArcDirectionRadiusLength (self, dx, dy, radius, length ):
"""
Add arc, defined by direction, radius and length.
If the first point of sketcher is not yet defined, the
origin (0, 0) will become the first sketcher point.
Parameters:
param dx, dy - direction of the arc
param radius - radius of the arc
param length - length of the arc
Example of usage:
sk = geompy.Sketcher2D()
sk.addArcDirectionRadiusLength(-50, 40, 20, 3.5)
Sketcher_1 = sk.wire(geomObj_1)
"""
self.myCommand = self.myCommand + ":D %s %s:C %s %s" % (printVar(dx), printVar(dy), printVar(radius), printVar(length))
pass
## Set to close the wire
def close (self):
"""
Set to close the wire
Example of usage:
sk = geompy.Sketcher2D()
sk.addPoint(15, 85.6)
sk.close()
Sketcher_1 = sk.wire(geomObj_1)
"""
self.closed = True
pass
## Obtain the sketcher result as a wire.
#
# @param WorkingPlane - current Working Plane used for this 2DSketcher
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM_Object, containing the created wire
def wire (self, WorkingPlane=[0, 0, 0, 0, 0, 1, 1, 0, 0], theName=None):
"""
Obtain the sketcher result as a wire.
Parameters:
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name
param WorkingPlane - current Working Plane used for this 2DSketcher
Returns:
New GEOM_Object, containing the created wire.
Example of usage:
sk = geompy.Sketcher2D()
sk.addPoint(30, 70)
a3D_Sketcher_1 = sk.wire(geomObj_1)
"""
if self.closed:
self.myCommand = self.myCommand + ":WW"
import GEOM
if isinstance(WorkingPlane, list): wire = self.geompyD.CurvesOp.MakeSketcher(self.myCommand, WorkingPlane)
if isinstance(WorkingPlane, GEOM._objref_GEOM_Object): wire = self.geompyD.CurvesOp.MakeSketcherOnPlane(self.myCommand, WorkingPlane)
self.myCommand = "Sketcher"
self.geompyD._autoPublish(wire, theName, "wire")
return wire
## Obtain the sketcher result as a face.
#
# @param WorkingPlane - current Working Plane used for this 2DSketcher
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM_Object, containing the created face
def face (self, WorkingPlane=[0, 0, 0, 0, 0, 1, 1, 0, 0], theName=None):
"""
Obtain the sketcher result as a face.
Parameters:
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name
param WorkingPlane - current Working Plane used for this 2DSketcher
Returns:
New GEOM_Object, containing the created face.
Example of usage:
sk = geompy.Sketcher2D()
sk.addPoint(0, 0)
sk.addSegment(100, 0)
sk.addSegment(100, 100)
sk.addSegment(0, 100)
sk.close()
a3D_Sketcher_1 = sk.face(geomObj_1)
"""
if self.closed:
self.myCommand = self.myCommand + ":WF"
else:
raise RuntimeError, "Sketcher2D.close() : can't build face on unclosed wire"
import GEOM
if isinstance(WorkingPlane, list): face = self.geompyD.CurvesOp.MakeSketcher(self.myCommand, WorkingPlane)
if isinstance(WorkingPlane, GEOM._objref_GEOM_Object): face = self.geompyD.CurvesOp.MakeSketcherOnPlane(self.myCommand, WorkingPlane)
self.myCommand = "Sketcher"
self.geompyD._autoPublish(face, theName, "face")
return face

File diff suppressed because it is too large Load Diff

View File

@ -20,39 +20,46 @@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM SKETCHER : basic sketcher
// File : Sketcher_Profile.h
// Author : Damien COQUERET
// Module : GEOM
//
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#if defined WIN32
# if defined SKETCHER_SALOME_EXPORTS || defined SKETCHER_EXPORTS
# define SKETCHER_SALOME_EXPORT _declspec( dllexport )
# else
# define SKETCHER_SALOME_EXPORT _declspec( dllimport )
# endif
#else
# define SKETCHER_SALOME_EXPORT
#endif
#include <TopoDS_Shape.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_Array1OfAsciiString.hxx>
#include <string>
class Sketcher_Profile
class SKETCHER_SALOME_EXPORT Sketcher_Profile
{
class Functor;
class ShapeFunctor;
class DumpFunctor;
public:
Standard_EXPORT Sketcher_Profile();
Standard_EXPORT Sketcher_Profile(const char* aCmd);
Sketcher_Profile();
Sketcher_Profile( const char* );
void SetCommand( const char* );
TopoDS_Shape GetShape( bool* = 0, double* = 0 );
TCollection_AsciiString GetDump( bool* = 0 );
private:
gp_Pnt myLastPoint;
gp_Dir myLastDir;
TopoDS_Shape myShape;
bool myOK;
std::string myErrMsg;
double myError;
public:
Standard_EXPORT gp_Pnt GetLastPoint(){return myLastPoint;};
Standard_EXPORT gp_Dir GetLastDir(){return myLastDir;};
Standard_EXPORT const TopoDS_Shape& GetShape(){return myShape;};
Standard_EXPORT bool IsDone(){return myOK;};
Standard_EXPORT std::string ErrMsg(){return myErrMsg;};
Standard_EXPORT double Error(){return myError;};
void parse( const TCollection_AsciiString&, Functor* );
void badArgs();
void findNextCommand( const TColStd_Array1OfAsciiString&, TColStd_Array1OfAsciiString&, int, int& );
TCollection_AsciiString extractCommand( const TCollection_AsciiString& );
private:
TCollection_AsciiString myCommand;
};