mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-24 16:30:35 +05:00
0020628: EDF 1144 GEOM : In TUI, need a function to know the orientation of an edge or a wire
This commit is contained in:
parent
3a7cecdb25
commit
af9f05e2cf
@ -71,6 +71,35 @@ else:
|
|||||||
print "But must be (50, 15, 50)"
|
print "But must be (50, 15, 50)"
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
|
<br><h2>Get vertex by index</h2>
|
||||||
|
|
||||||
|
\code
|
||||||
|
import geompy
|
||||||
|
|
||||||
|
# Create auxiliary objects
|
||||||
|
Vertex_1 = geompy.MakeVertex(0, 0, 0)
|
||||||
|
Vertex_2 = geompy.MakeVertex(10, 20, 0)
|
||||||
|
Vertex_3 = geompy.MakeVertex(0, 40, 0)
|
||||||
|
Vertex_4 = geompy.MakeVertex(-10, 60, 0)
|
||||||
|
Vertex_5 = geompy.MakeVertex(0, 80, 0)
|
||||||
|
Curve_1 = geompy.MakeInterpol([Vertex_1, Vertex_2, Vertex_3])
|
||||||
|
Curve_2 = geompy.MakeInterpol([Vertex_5, Vertex_4, Vertex_3])
|
||||||
|
Wire_1 = geompy.MakeWire([Curve_1, Curve_2])
|
||||||
|
Reversed_Wire = geompy.ChangeOrientationShellCopy(Wire_1)
|
||||||
|
|
||||||
|
# Get The vertexes from Reversed Wire by different functions
|
||||||
|
vertex_0 = geompy.GetFirstVertex(Reversed_Wire)
|
||||||
|
vertex_1 = geompy.GetVertexByIndex(Reversed_Wire, 1)
|
||||||
|
vertex_2 = geompy.GetLastVertex(Reversed_Wire)
|
||||||
|
|
||||||
|
# Publish objects in study
|
||||||
|
geompy.addToStudy( Wire_1, "Wire_1" )
|
||||||
|
geompy.addToStudy( Reversed_Wire, "Reversed_Wire" )
|
||||||
|
geompy.addToStudy( vertex_0, "vertex_0" )
|
||||||
|
geompy.addToStudy( vertex_1, "vertex_1" )
|
||||||
|
geompy.addToStudy( vertex_2, "vertex_2" )
|
||||||
|
\endcode
|
||||||
|
|
||||||
<br><h2>Inertia</h2>
|
<br><h2>Inertia</h2>
|
||||||
|
|
||||||
\code
|
\code
|
||||||
|
@ -8,7 +8,8 @@ concerning created or imported geometrical objects. They are:
|
|||||||
<ul>
|
<ul>
|
||||||
<li>\ref point_coord_anchor "Point coordinates"</li>
|
<li>\ref point_coord_anchor "Point coordinates"</li>
|
||||||
<li>\ref basic_prop_anchor "Basic properties"</li>
|
<li>\ref basic_prop_anchor "Basic properties"</li>
|
||||||
<li>\ref center_mass_anchor "Center of mass"</li>
|
<li>\ref center_mass_anchor "Center of mass"</li>
|
||||||
|
<li>\ref vertex_by_index "Get Vertex By Index"</li>
|
||||||
<li>\ref inertia_anchor "Inertia"</li>
|
<li>\ref inertia_anchor "Inertia"</li>
|
||||||
<li>\ref normale_anchor "Normal to a Face"</li>
|
<li>\ref normale_anchor "Normal to a Face"</li>
|
||||||
<li>\ref boundaries_anchor "Check Free Boundaries"</li>
|
<li>\ref boundaries_anchor "Check Free Boundaries"</li>
|
||||||
@ -53,39 +54,51 @@ Python Tuple.
|
|||||||
\em Shape is a shape whose properties are inquired.
|
\em Shape is a shape whose properties are inquired.
|
||||||
|
|
||||||
\image html neo-basicprop.png
|
\image html neo-basicprop.png
|
||||||
|
|
||||||
\anchor center_mass_anchor
|
\anchor center_mass_anchor
|
||||||
<br><h2>Center of mass</h2>
|
<br><h2>Center of mass</h2>
|
||||||
|
|
||||||
\n Calculates and returns the coordinates of the gravity center for
|
\n Calculates and returns the coordinates of the gravity center for
|
||||||
the selected geometrical object.
|
the selected geometrical object.
|
||||||
|
|
||||||
\n <b>Result:</b> GEOM_Object (vertex).
|
\n <b>Result:</b> GEOM_Object (vertex).
|
||||||
\n <b>TUI Command:</b> <em> geompy.MakeCDG(Shape),</em> where \em Shape is
|
\n <b>TUI Command:</b> <em> geompy.MakeCDG(Shape),</em> where \em Shape is
|
||||||
the shape for which a center of gravity is computed.
|
the shape for which a center of gravity is computed.
|
||||||
|
|
||||||
\image html measures3.png
|
\image html measures3.png
|
||||||
|
|
||||||
\anchor inertia_anchor
|
\anchor vertex_by_index
|
||||||
<br><h2>Inertia</h2>
|
<br><h2>Get Vertex by Index</h2>
|
||||||
|
|
||||||
Returns the axial moments of inertia for the selected geometrical object.
|
\n It is possible to get the first or the last vertex from an edge or a wire, depending on
|
||||||
|
its direction (orientation), or to find the vertex by the index inside the wire.
|
||||||
\n <b>Result:</b> Displays the matrix of the own moments of inertia and
|
The numeration of vertexes starts from 0. This function has only a TUI implementation)
|
||||||
the relative moments of inertia in the form of Python Tuple
|
|
||||||
<center>(I11, I12, I13,</center>
|
\n <b>Result:</b> GEOM_Object (vertex).
|
||||||
<center>I21, I22, I23,</center>
|
\n <b>TUI Command:</b> <em> geompy.GetVertexByIndex(Shape, Index),</em>
|
||||||
<center>I31, I32, I33,</center>
|
<em> geompy.GetFirstVertex(Shape),</em>
|
||||||
<center>Ix, Iy, Iz).</center>
|
<em> geompy.GetLastVertex(Shape),</em> where \em Shape must be Wire or Edge.
|
||||||
\n <b>TUI Command:</b> <em>geompy.Inertia(Shape),</em> where \em Shape is
|
|
||||||
a shape for which the own matrix of inertia and the relative moments of inertia are
|
\anchor inertia_anchor
|
||||||
returned.
|
<br><h2>Inertia</h2>
|
||||||
|
|
||||||
\image html measures4.png
|
Returns the axial moments of inertia for the selected geometrical object.
|
||||||
|
|
||||||
\anchor normale_anchor
|
\n <b>Result:</b> Displays the matrix of the own moments of inertia and
|
||||||
<br><h2>Normal to a Face</h2>
|
the relative moments of inertia in the form of Python Tuple
|
||||||
|
<center>(I11, I12, I13,</center>
|
||||||
|
<center>I21, I22, I23,</center>
|
||||||
|
<center>I31, I32, I33,</center>
|
||||||
|
<center>Ix, Iy, Iz).</center>
|
||||||
|
\n <b>TUI Command:</b> <em>geompy.Inertia(Shape),</em> where \em Shape is
|
||||||
|
a shape for which the own matrix of inertia and the relative moments of inertia are
|
||||||
|
returned.
|
||||||
|
|
||||||
|
\image html measures4.png
|
||||||
|
|
||||||
|
\anchor normale_anchor
|
||||||
|
<br><h2>Normal to a Face</h2>
|
||||||
|
|
||||||
\n Calculates the normal vector to the selected \b Face. The \b Point
|
\n Calculates the normal vector to the selected \b Face. The \b Point
|
||||||
is a point of the \b Face, where the Normal should be calculated.
|
is a point of the \b Face, where the Normal should be calculated.
|
||||||
|
|
||||||
|
@ -2885,6 +2885,15 @@ module GEOM
|
|||||||
* \return New GEOM_Object, containing the created point.
|
* \return New GEOM_Object, containing the created point.
|
||||||
*/
|
*/
|
||||||
GEOM_Object GetCentreOfMass (in GEOM_Object theShape);
|
GEOM_Object GetCentreOfMass (in GEOM_Object theShape);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the vertex by index for 1D objects depends the edge/wire orientation
|
||||||
|
* \param theShape Shape (wire or edge) to find the vertex on it
|
||||||
|
* \param theIndex Index of vertex subshape
|
||||||
|
* \return New GEOM_Object, vertex.
|
||||||
|
*/
|
||||||
|
GEOM_Object GetVertexByIndex( in GEOM_Object theShape, in long index );
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get a vector, representing the normal of theFace.
|
* Get a vector, representing the normal of theFace.
|
||||||
|
@ -30,7 +30,8 @@ class GEOMImpl_IMeasure
|
|||||||
{
|
{
|
||||||
enum {
|
enum {
|
||||||
MEASURE_ARG_BASE = 1,
|
MEASURE_ARG_BASE = 1,
|
||||||
MEASURE_ARG_POINT = 2
|
MEASURE_ARG_POINT = 2,
|
||||||
|
MEASURE_INDEX = 3
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -45,6 +46,10 @@ class GEOMImpl_IMeasure
|
|||||||
{ _func->SetReference(MEASURE_ARG_POINT, thePnt); }
|
{ _func->SetReference(MEASURE_ARG_POINT, thePnt); }
|
||||||
|
|
||||||
Handle(GEOM_Function) GetPoint() { return _func->GetReference(MEASURE_ARG_POINT); }
|
Handle(GEOM_Function) GetPoint() { return _func->GetReference(MEASURE_ARG_POINT); }
|
||||||
|
|
||||||
|
void SetIndex(int theIndex) { _func->SetInteger(MEASURE_INDEX, theIndex); }
|
||||||
|
|
||||||
|
int GetIndex() { return _func->GetInteger(MEASURE_INDEX); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -895,6 +895,60 @@ Handle(GEOM_Object) GEOMImpl_IMeasureOperations::GetCentreOfMass
|
|||||||
return aCDG;
|
return aCDG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* GetVertexByIndex
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
Handle(GEOM_Object) GEOMImpl_IMeasureOperations::GetVertexByIndex
|
||||||
|
(Handle(GEOM_Object) theShape,
|
||||||
|
Standard_Integer theIndex)
|
||||||
|
{
|
||||||
|
SetErrorCode(KO);
|
||||||
|
|
||||||
|
if (theShape.IsNull()) return NULL;
|
||||||
|
|
||||||
|
Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
|
||||||
|
if (aRefShape.IsNull()) return NULL;
|
||||||
|
|
||||||
|
//Add a new Vertex object
|
||||||
|
Handle(GEOM_Object) aVertex = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
|
||||||
|
|
||||||
|
//Add a function
|
||||||
|
Handle(GEOM_Function) aFunction =
|
||||||
|
aVertex->AddFunction(GEOMImpl_MeasureDriver::GetID(), VERTEX_BY_INDEX);
|
||||||
|
if (aFunction.IsNull()) return NULL;
|
||||||
|
|
||||||
|
//Check if the function is set correctly
|
||||||
|
if (aFunction->GetDriverGUID() != GEOMImpl_MeasureDriver::GetID()) return NULL;
|
||||||
|
|
||||||
|
GEOMImpl_IMeasure aCI (aFunction);
|
||||||
|
aCI.SetBase(aRefShape);
|
||||||
|
aCI.SetIndex(theIndex);
|
||||||
|
|
||||||
|
//Compute
|
||||||
|
try {
|
||||||
|
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||||
|
OCC_CATCH_SIGNALS;
|
||||||
|
#endif
|
||||||
|
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||||
|
SetErrorCode("Vertex by index driver failed.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Standard_Failure) {
|
||||||
|
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||||
|
SetErrorCode(aFail->GetMessageString());
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Make a Python command
|
||||||
|
GEOM::TPythonDump(aFunction) << aVertex << " = geompy.GetVertexByIndex(" << theShape << ", " << theIndex << ")";
|
||||||
|
|
||||||
|
SetErrorCode(OK);
|
||||||
|
return aVertex;
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* GetNormal
|
* GetNormal
|
||||||
|
@ -92,6 +92,9 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations {
|
|||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) GetCentreOfMass (Handle(GEOM_Object) theShape);
|
Standard_EXPORT Handle(GEOM_Object) GetCentreOfMass (Handle(GEOM_Object) theShape);
|
||||||
|
|
||||||
|
Standard_EXPORT Handle(GEOM_Object) GetVertexByIndex (Handle(GEOM_Object) theShape,
|
||||||
|
Standard_Integer theIndex);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) GetNormal (Handle(GEOM_Object) theFace,
|
Standard_EXPORT Handle(GEOM_Object) GetNormal (Handle(GEOM_Object) theFace,
|
||||||
Handle(GEOM_Object) theOptionalPoint);
|
Handle(GEOM_Object) theOptionalPoint);
|
||||||
|
|
||||||
|
@ -35,6 +35,11 @@
|
|||||||
#include <TopAbs.hxx>
|
#include <TopAbs.hxx>
|
||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#include <TopoDS_Edge.hxx>
|
||||||
|
#include <TopoDS_Wire.hxx>
|
||||||
|
#include <TopExp.hxx>
|
||||||
|
#include <TopExp_Explorer.hxx>
|
||||||
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
|
|
||||||
#include <GProp_GProps.hxx>
|
#include <GProp_GProps.hxx>
|
||||||
#include <GeomLProp_SLProps.hxx>
|
#include <GeomLProp_SLProps.hxx>
|
||||||
@ -108,6 +113,69 @@ Standard_Integer GEOMImpl_MeasureDriver::Execute(TFunction_Logbook& log) const
|
|||||||
|
|
||||||
aShape = BRepBuilderAPI_MakeVertex(aCenterMass).Shape();
|
aShape = BRepBuilderAPI_MakeVertex(aCenterMass).Shape();
|
||||||
}
|
}
|
||||||
|
else if (aType == VERTEX_BY_INDEX)
|
||||||
|
{
|
||||||
|
Handle(GEOM_Function) aRefBase = aCI.GetBase();
|
||||||
|
TopoDS_Shape aShapeBase = aRefBase->GetValue();
|
||||||
|
if (aShapeBase.IsNull()) {
|
||||||
|
Standard_NullObject::Raise("Shape for centre of mass calculation is null");
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = aCI.GetIndex();
|
||||||
|
gp_Pnt aVertex;
|
||||||
|
|
||||||
|
if (aShapeBase.ShapeType() == TopAbs_VERTEX) {
|
||||||
|
if ( index != 1 )
|
||||||
|
Standard_NullObject::Raise("Vertex index is out of range");
|
||||||
|
else
|
||||||
|
aVertex = BRep_Tool::Pnt(TopoDS::Vertex(aShapeBase));
|
||||||
|
} else if (aShapeBase.ShapeType() == TopAbs_EDGE) {
|
||||||
|
TopoDS_Vertex aV1, aV2;
|
||||||
|
TopoDS_Edge anEdgeE = TopoDS::Edge(aShapeBase);
|
||||||
|
|
||||||
|
TopExp::Vertices(anEdgeE, aV1, aV2);
|
||||||
|
gp_Pnt aP1 = BRep_Tool::Pnt(aV1);
|
||||||
|
gp_Pnt aP2 = BRep_Tool::Pnt(aV2);
|
||||||
|
|
||||||
|
if (index < 0 || index > 1)
|
||||||
|
Standard_NullObject::Raise("Vertex index is out of range");
|
||||||
|
|
||||||
|
if ( anEdgeE.Orientation() == TopAbs_FORWARD && index == 0 ||
|
||||||
|
anEdgeE.Orientation() == TopAbs_REVERSED && index == 1 )
|
||||||
|
aVertex = aP1;
|
||||||
|
else
|
||||||
|
aVertex = aP2;
|
||||||
|
} else if (aShapeBase.ShapeType() == TopAbs_WIRE) {
|
||||||
|
TopTools_IndexedMapOfShape anEdgeShapes;
|
||||||
|
TopTools_IndexedMapOfShape aVertexShapes;
|
||||||
|
TopoDS_Vertex aV1, aV2;
|
||||||
|
TopoDS_Wire aWire = TopoDS::Wire(aShapeBase);
|
||||||
|
TopExp_Explorer exp (aWire, TopAbs_EDGE);
|
||||||
|
for (; exp.More(); exp.Next()) {
|
||||||
|
anEdgeShapes.Add(exp.Current());
|
||||||
|
TopoDS_Edge E = TopoDS::Edge(exp.Current());
|
||||||
|
TopExp::Vertices(E, aV1, aV2);
|
||||||
|
if ( aVertexShapes.Extent() == 0)
|
||||||
|
aVertexShapes.Add(aV1);
|
||||||
|
if ( !aV1.IsSame( aVertexShapes(aVertexShapes.Extent()) ) )
|
||||||
|
aVertexShapes.Add(aV1);
|
||||||
|
if ( !aV2.IsSame( aVertexShapes(aVertexShapes.Extent()) ) )
|
||||||
|
aVertexShapes.Add(aV2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index < 0 || index > aVertexShapes.Extent())
|
||||||
|
Standard_NullObject::Raise("Vertex index is out of range");
|
||||||
|
|
||||||
|
if (aWire.Orientation() == TopAbs_FORWARD)
|
||||||
|
aVertex = BRep_Tool::Pnt(TopoDS::Vertex(aVertexShapes(index+1)));
|
||||||
|
else
|
||||||
|
aVertex = BRep_Tool::Pnt(TopoDS::Vertex(aVertexShapes(aVertexShapes.Extent() - index)));
|
||||||
|
} else {
|
||||||
|
Standard_NullObject::Raise("Shape for vertex calculation is not an edge or wire");
|
||||||
|
}
|
||||||
|
|
||||||
|
aShape = BRepBuilderAPI_MakeVertex(aVertex).Shape();
|
||||||
|
}
|
||||||
else if (aType == VECTOR_FACE_NORMALE)
|
else if (aType == VECTOR_FACE_NORMALE)
|
||||||
{
|
{
|
||||||
// Face
|
// Face
|
||||||
|
@ -113,6 +113,7 @@
|
|||||||
#define VECTOR_DX_DY_DZ 2
|
#define VECTOR_DX_DY_DZ 2
|
||||||
#define VECTOR_TANGENT_CURVE_PAR 3
|
#define VECTOR_TANGENT_CURVE_PAR 3
|
||||||
#define VECTOR_FACE_NORMALE 4
|
#define VECTOR_FACE_NORMALE 4
|
||||||
|
#define VERTEX_BY_INDEX 5
|
||||||
|
|
||||||
#define PLANE_PNT_VEC 1
|
#define PLANE_PNT_VEC 1
|
||||||
#define PLANE_FACE 2
|
#define PLANE_FACE 2
|
||||||
|
@ -149,6 +149,31 @@ GEOM::GEOM_Object_ptr GEOM_IMeasureOperations_i::GetCentreOfMass
|
|||||||
return GetObject(anObject);
|
return GetObject(anObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* GetVertexByIndex
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
GEOM::GEOM_Object_ptr GEOM_IMeasureOperations_i::GetVertexByIndex
|
||||||
|
(GEOM::GEOM_Object_ptr theShape, CORBA::Long theIndex)
|
||||||
|
{
|
||||||
|
GEOM::GEOM_Object_var aGEOMObject;
|
||||||
|
|
||||||
|
//Set a not done flag
|
||||||
|
GetOperations()->SetNotDone();
|
||||||
|
|
||||||
|
//Get the reference shape
|
||||||
|
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
|
||||||
|
if ( aShape.IsNull() ) return aGEOMObject._retn();
|
||||||
|
|
||||||
|
// Get vertex by index
|
||||||
|
Handle(GEOM_Object) anObject = GetOperations()->GetVertexByIndex(aShape, theIndex);
|
||||||
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||||
|
return aGEOMObject._retn();
|
||||||
|
|
||||||
|
return GetObject(anObject);
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* GetNormal
|
* GetNormal
|
||||||
|
@ -60,6 +60,9 @@ class GEOM_I_EXPORT GEOM_IMeasureOperations_i :
|
|||||||
GEOM::GEOM_Object_ptr GetNormal (GEOM::GEOM_Object_ptr theFace,
|
GEOM::GEOM_Object_ptr GetNormal (GEOM::GEOM_Object_ptr theFace,
|
||||||
GEOM::GEOM_Object_ptr theOptionalPoint);
|
GEOM::GEOM_Object_ptr theOptionalPoint);
|
||||||
|
|
||||||
|
GEOM::GEOM_Object_ptr GetVertexByIndex (GEOM::GEOM_Object_ptr theObject,
|
||||||
|
CORBA::Long theIndex);
|
||||||
|
|
||||||
void GetInertia (GEOM::GEOM_Object_ptr theShape,
|
void GetInertia (GEOM::GEOM_Object_ptr theShape,
|
||||||
CORBA::Double& I11, CORBA::Double& I12, CORBA::Double& I13,
|
CORBA::Double& I11, CORBA::Double& I12, CORBA::Double& I13,
|
||||||
CORBA::Double& I21, CORBA::Double& I22, CORBA::Double& I23,
|
CORBA::Double& I21, CORBA::Double& I22, CORBA::Double& I23,
|
||||||
|
@ -3231,6 +3231,41 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
|
RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
|
||||||
return anObj
|
return anObj
|
||||||
|
|
||||||
|
## Get a vertex subshape by index depended with orientation.
|
||||||
|
# @param theShape Shape to find subshape.
|
||||||
|
# @param theIndex Index to find vertex by this index.
|
||||||
|
# @return New GEOM_Object, containing the created vertex.
|
||||||
|
#
|
||||||
|
# @ref tui_measurement_tools_page "Example"
|
||||||
|
def GetVertexByIndex(self,theShape, theIndex):
|
||||||
|
# Example: see GEOM_TestMeasures.py
|
||||||
|
anObj = self.MeasuOp.GetVertexByIndex(theShape, theIndex)
|
||||||
|
RaiseIfFailed("GetVertexByIndex", self.MeasuOp)
|
||||||
|
return anObj
|
||||||
|
|
||||||
|
## Get the first vertex of wire/edge depended orientation.
|
||||||
|
# @param theShape Shape to find first vertex.
|
||||||
|
# @return New GEOM_Object, containing the created vertex.
|
||||||
|
#
|
||||||
|
# @ref tui_measurement_tools_page "Example"
|
||||||
|
def GetFirstVertex(self,theShape):
|
||||||
|
# Example: see GEOM_TestMeasures.py
|
||||||
|
anObj = self.GetVertexByIndex(theShape, 0)
|
||||||
|
RaiseIfFailed("GetFirstVertex", self.MeasuOp)
|
||||||
|
return anObj
|
||||||
|
|
||||||
|
## Get the last vertex of wire/edge depended orientation.
|
||||||
|
# @param theShape Shape to find last vertex.
|
||||||
|
# @return New GEOM_Object, containing the created vertex.
|
||||||
|
#
|
||||||
|
# @ref tui_measurement_tools_page "Example"
|
||||||
|
def GetLastVertex(self,theShape):
|
||||||
|
# Example: see GEOM_TestMeasures.py
|
||||||
|
nb_vert = self.ShapesOp.NumberOfSubShapes(theShape, ShapeType["VERTEX"])
|
||||||
|
anObj = self.GetVertexByIndex(theShape, (nb_vert-1))
|
||||||
|
RaiseIfFailed("GetLastVertex", self.MeasuOp)
|
||||||
|
return anObj
|
||||||
|
|
||||||
## Get a normale to the given face. If the point is not given,
|
## Get a normale to the given face. If the point is not given,
|
||||||
# the normale is calculated at the center of mass.
|
# the normale is calculated at the center of mass.
|
||||||
# @param theFace Face to define normale of.
|
# @param theFace Face to define normale of.
|
||||||
|
Loading…
Reference in New Issue
Block a user