arc_face = geompy.MakeFaceWires([Arc, Add_line], 1)
p_on_face1 = geompy.MakeVertexOnSurface(arc_face, 0.5, 0.5)
p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(arc_face, 35, 35, 35)
+p_on_face3 = geompy.MakeVertexInsideFace(arc_face)
# add objects in the study
id_p_inter = geompy.addToStudy(p_inter, "Vertex on Lines Intersection")
id_p_on_face1 = geompy.addToStudy(p_on_face1, "Vertex on face by parameter")
id_p_on_face2 = geompy.addToStudy(p_on_face2, "Vertex on face by point projection")
+id_p_on_face3 = geompy.addToStudy(p_on_face3, "Vertex inside face")
# display vertices
gg.createAndDisplayGO(id_p0)
\anchor swig_MakeVertexOnSurfaceByCoord
\until p_on_face2
+\anchor swig_MakeVertexInsideFace
+\until p_on_face3
+
\until S = geompy.MakeRotation
\anchor swig_MakeLineTwoFaces
in double theYParameter,
in double theZParameter);
+ /*!
+ * \brief Create a point, which lays on the given face.
+ * The point will lay in arbitrary place of the face.
+ * The only condition on it is a non-zero distance to the face boundary.
+ * Such point can be used to uniquely identify the face inside any
+ * shape in case, when the shape does not contain overlapped faces.
+ * \param theFace The referenced face.
+ * \return New GEOM_Object, containing the created point.
+ */
+ GEOM_Object MakePointOnFace (in GEOM_Object theFace);
/*!
* \brief Create a point, on two lines intersection.
// 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>
case PointOn_CurveByCoord: fType = POINT_CURVE_COORD; break;
case PointOn_SurfaceByParam: fType = POINT_SURFACE_PAR; break;
case PointOn_SurfaceByCoord: fType = POINT_SURFACE_COORD; break;
+ case PointOn_Face: fType = POINT_FACE_ANY; break;
default: break;
}
Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), fType);
aPI.SetX(theParam1);
aPI.SetY(theParam2);
aPI.SetZ(theParam3);
+ break;
+ case PointOn_Face:
+ aPI.SetSurface(aRefFunction);
+ break;
default: break;
}
<< theGeomObj << ", " << theParam1 << ", " << theRefPoint << ")";
break;
case PointOn_CurveByCoord:
- GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByCoord("
- << theGeomObj << ", " << theParam1
- << ", " << theParam2 << ", " << theParam3 << ")";
+ GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByCoord("
+ << theGeomObj << ", " << theParam1
+ << ", " << theParam2 << ", " << theParam3 << ")";
break;
case PointOn_SurfaceByParam:
- GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurface("
- << theGeomObj << ", " << theParam1
- << ", " << theParam2 << ")";
+ GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurface("
+ << theGeomObj << ", " << theParam1
+ << ", " << theParam2 << ")";
break;
case PointOn_SurfaceByCoord:
- GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurfaceByCoord("
- << theGeomObj << ", " << theParam1
- << ", " << theParam2 << ", " << theParam3 << ")";
+ GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurfaceByCoord("
+ << theGeomObj << ", " << theParam1
+ << ", " << theParam2 << ", " << theParam3 << ")";
+ break;
+ case PointOn_Face:
+ GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexInsideFace("
+ << theGeomObj << ")";
+ break;
default: break;
}
return makePointOnGeom(theSurface, theXParam, theYParam, theZParam, PointOn_SurfaceByCoord);
}
+//=============================================================================
+/*!
+ * MakePointOnFace
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnFace (Handle(GEOM_Object) theFace)
+{
+ return makePointOnGeom(theFace, 0., 0., 0., PointOn_Face);
+}
//=============================================================================
/*!
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#ifndef _GEOMImpl_IBasicOperations_HXX_
#define _GEOMImpl_IBasicOperations_HXX_
double theYParam,
double theZParam);
+ Standard_EXPORT Handle(GEOM_Object) MakePointOnFace (Handle(GEOM_Object) theFace);
+
// Vector
Standard_EXPORT Handle(GEOM_Object) MakeVectorDXDYDZ (double theDX, double theDY, double theDZ);
PointOn_CurveByCoord,
PointOn_CurveByLength,
PointOn_SurfaceByParam,
- PointOn_SurfaceByCoord
+ PointOn_SurfaceByCoord,
+ PointOn_Face
};
Handle(GEOM_Object) makePointOnGeom (Handle(GEOM_Object) theGeomObj,
// 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>
#include <GEOMImpl_IPoint.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_Function.hxx>
+#include <GEOMAlgo_Tools3D.hxx>
#include <ShapeAnalysis.hxx>
aPnt = gp_Pnt(aPI.GetX(), aPI.GetY(), aPI.GetZ());
}
else if (aType == POINT_XYZ_REF) {
- Handle(GEOM_Function) aRefPoint = aPI.GetRef();
- TopoDS_Shape aRefShape = aRefPoint->GetValue();
+ Handle(GEOM_Function) aRefFunc = aPI.GetRef();
+ TopoDS_Shape aRefShape = aRefFunc->GetValue();
if (aRefShape.ShapeType() != TopAbs_VERTEX) {
Standard_TypeMismatch::Raise
("Point creation aborted : referenced shape is not a vertex");
aPnt = gp_Pnt(P.X() + aPI.GetX(), P.Y() + aPI.GetY(), P.Z() + aPI.GetZ());
}
else if (aType == POINT_CURVE_PAR) {
- Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
- TopoDS_Shape aRefShape = aRefCurve->GetValue();
+ Handle(GEOM_Function) aRefFunc = aPI.GetCurve();
+ TopoDS_Shape aRefShape = aRefFunc->GetValue();
if (aRefShape.ShapeType() != TopAbs_EDGE) {
Standard_TypeMismatch::Raise
("Point On Curve creation aborted : curve shape is not an edge");
aPnt = aCurve->Value(aP);
}
else if (aType == POINT_CURVE_COORD) {
- Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
- TopoDS_Shape aRefShape = aRefCurve->GetValue();
+ Handle(GEOM_Function) aRefFunc = aPI.GetCurve();
+ TopoDS_Shape aRefShape = aRefFunc->GetValue();
if (aRefShape.ShapeType() != TopAbs_EDGE) {
Standard_TypeMismatch::Raise
("Point On Curve creation aborted : curve shape is not an edge");
}
else if (aType == POINT_CURVE_LENGTH) {
// RefCurve
- Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
- if (aRefCurve.IsNull()) {
+ Handle(GEOM_Function) aRefFunc = aPI.GetCurve();
+ if (aRefFunc.IsNull()) {
Standard_NullObject::Raise
("Point On Curve creation aborted : curve object is null");
}
- TopoDS_Shape aRefShape1 = aRefCurve->GetValue();
+ TopoDS_Shape aRefShape1 = aRefFunc->GetValue();
if (aRefShape1.ShapeType() != TopAbs_EDGE) {
Standard_TypeMismatch::Raise
("Point On Curve creation aborted : curve shape is not an edge");
aPnt = AdapCurve.Value(aParam);
}
else if (aType == POINT_SURFACE_PAR) {
- Handle(GEOM_Function) aRefCurve = aPI.GetSurface();
- TopoDS_Shape aRefShape = aRefCurve->GetValue();
+ Handle(GEOM_Function) aRefFunc = aPI.GetSurface();
+ TopoDS_Shape aRefShape = aRefFunc->GetValue();
if (aRefShape.ShapeType() != TopAbs_FACE) {
Standard_TypeMismatch::Raise
("Point On Surface creation aborted : surface shape is not a face");
aPnt = aSurf->Value(U,V);
}
else if (aType == POINT_SURFACE_COORD) {
- Handle(GEOM_Function) aRefCurve = aPI.GetSurface();
- TopoDS_Shape aRefShape = aRefCurve->GetValue();
+ Handle(GEOM_Function) aRefFunc = aPI.GetSurface();
+ TopoDS_Shape aRefShape = aRefFunc->GetValue();
if (aRefShape.ShapeType() != TopAbs_FACE) {
Standard_TypeMismatch::Raise
("Point On Surface creation aborted : surface shape is not a face");
("Point On Surface creation aborted : cannot project point");
}
}
+ else if (aType == POINT_FACE_ANY) {
+ Handle(GEOM_Function) aRefFunc = aPI.GetSurface();
+ TopoDS_Shape aRefShape = aRefFunc->GetValue();
+ if (aRefShape.ShapeType() != TopAbs_FACE) {
+ Standard_TypeMismatch::Raise
+ ("Point On Surface creation aborted : surface shape is not a face");
+ }
+ TopoDS_Face F = TopoDS::Face(aRefShape);
+ gp_Pnt2d aP2d;
+ GEOMAlgo_Tools3D::PntInFace(F, aPnt, aP2d);
+ }
else if (aType == POINT_LINES_INTERSECTION) {
Handle(GEOM_Function) aRef1 = aPI.GetLine1();
Handle(GEOM_Function) aRef2 = aPI.GetLine2();
#define POINT_SURFACE_PAR 5
#define POINT_CURVE_COORD 6
#define POINT_SURFACE_COORD 7
-#define POINT_CURVE_LENGTH 8
+#define POINT_CURVE_LENGTH 8
+#define POINT_FACE_ANY 9
// Vector
#define VECTOR_TWO_PNT 1
// 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>
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakePointOnFace
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnFace (GEOM::GEOM_Object_ptr theFace)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference face
+ Handle(GEOM_Object) aReference = GetObjectImpl(theFace);
+ if (aReference.IsNull()) return aGEOMObject._retn();
+
+ //Create the point
+ Handle(GEOM_Object) anObject = GetOperations()->MakePointOnFace(aReference);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
//=============================================================================
/*!
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#ifndef _GEOM_IBasicOperations_i_HeaderFile
#define _GEOM_IBasicOperations_i_HeaderFile
CORBA::Double theYParameter,
CORBA::Double theZParameter);
+ GEOM::GEOM_Object_ptr MakePointOnFace (GEOM::GEOM_Object_ptr theFace);
+
GEOM::GEOM_Object_ptr MakePointOnLinesIntersection (GEOM::GEOM_Object_ptr theLine1,
GEOM::GEOM_Object_ptr theLine2);
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
# GEOM GEOM_SWIG : binding of C++ omplementaion with Python
# File : GEOM_usinggeom.py
#Test point on surface creation
p_on_face = geompy.MakeVertexOnSurface(Face, 0.1, 0.8) #(GEOM_Object, Double, Double)->GEOM_Object
p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(Face, 0., 0., 0.) #(GEOM_Object, Double, Double, Double)->GEOM_Object
+ p_on_face3 = geompy.MakeVertexInsideFace(Face) #(GEOM_Object)->GEOM_Object
# Test plane from existing face creation
Plane2 = geompy.MakePlaneFace(Face, trimsize) #(GEOM_Object, Double)->GEOM_Object
id_p_on_face = geompy.addToStudy(p_on_face, "Vertex on Face (0.1, 0.8)")
id_p_on_face2 = geompy.addToStudy(p_on_face2, "Vertex on Face at(0., 0., 0.)")
+ id_p_on_face3 = geompy.addToStudy(p_on_face3, "Vertex inside Face")
id_Prism1 = geompy.addToStudy(Prism1, "Prism by Two Pnt")
id_Shell1 = geompy.addToStudy(Shell1, "Shell from Prism1 faces")
New GEOM.GEOM_Object, containing the created point.
Example of usage:
- p_on_face = geompy.MakeVertexOnSurface(Face, 0.1, 0.8) #(GEOM_Object, Double, Double)->GEOM_Object
+ p_on_face = geompy.MakeVertexOnSurface(Face, 0.1, 0.8)
"""
theUParameter, theVParameter, Parameters = ParseParameters(theUParameter, theVParameter)
# Example: see GEOM_TestAll.py
New GEOM.GEOM_Object, containing the created point.
Example of usage:
- p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(Face, 0., 0., 0.) #(GEOM_Object, Double, Double, Double)->GEOM_Object
+ p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(Face, 0., 0., 0.)
"""
theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
# Example: see GEOM_TestAll.py
anObj.SetParameters(Parameters);
return anObj
+ ## Create a point, which lays on the given face.
+ # The point will lay in arbitrary place of the face.
+ # The only condition on it is a non-zero distance to the face boundary.
+ # Such point can be used to uniquely identify the face inside any
+ # shape in case, when the shape does not contain overlapped faces.
+ # @param theFace The referenced face.
+ # @return New GEOM.GEOM_Object, containing the created point.
+ #
+ # @ref swig_MakeVertexInsideFace "Example"
+ def MakeVertexInsideFace (self, theFace):
+ """
+ Create a point, which lays on the given face.
+ The point will lay in arbitrary place of the face.
+ The only condition on it is a non-zero distance to the face boundary.
+ Such point can be used to uniquely identify the face inside any
+ shape in case, when the shape does not contain overlapped faces.
+
+ Parameters:
+ theFace The referenced face.
+
+ Returns:
+ New GEOM.GEOM_Object, containing the created point.
+
+ Example of usage:
+ p_on_face = geompy.MakeVertexInsideFace(Face)
+ """
+ # Example: see GEOM_TestAll.py
+ anObj = self.BasicOp.MakePointOnFace(theFace)
+ RaiseIfFailed("MakeVertexInsideFace", self.BasicOp)
+ return anObj
+
## Create a point on intersection of two lines.
# @param theRefLine1, theRefLine2 The referenced lines.
# @return New GEOM.GEOM_Object, containing the created point.
New GEOM.GEOM_Object, containing the created tangent.
Example of usage:
- tan_on_arc = geompy.MakeTangentOnCurve(Arc, 0.7) #(GEOM_Object, Double)->GEOM_Object
+ tan_on_arc = geompy.MakeTangentOnCurve(Arc, 0.7)
"""
anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
RaiseIfFailed("MakeTangentOnCurve", self.BasicOp)
New GEOM.GEOM_Object, containing the created disk.
Example of usage:
- Disk3 = geompy.MakeDiskR(100., 1) #(1 Doubles, 1 Int)->GEOM_Object
+ Disk3 = geompy.MakeDiskR(100., 1)
"""
# Example: see GEOM_TestAll.py
theR,Parameters = ParseParameters(theR)