本文整理汇总了C++中TFunction_Logbook类 的典型用法代码示例。如果您正苦于以下问题:C++ TFunction_Logbook类的具体用法?C++ TFunction_Logbook怎么用?C++ TFunction_Logbook使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TFunction_Logbook类 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Execute
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_CylinderDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_ICylinder aCI (aFunction);
Standard_Integer aType = aFunction->GetType();
gp_Pnt aP;
gp_Vec aV;
if (aType == CYLINDER_R_H) {
aP = gp::Origin();
aV = gp::DZ();
}
else if (aType == CYLINDER_PNT_VEC_R_H) {
Handle(GEOM_Function) aRefPoint = aCI.GetPoint();
Handle(GEOM_Function) aRefVector = aCI.GetVector();
TopoDS_Shape aShapePnt = aRefPoint->GetValue();
TopoDS_Shape aShapeVec = aRefVector->GetValue();
if (aShapePnt.IsNull() || aShapeVec.IsNull()) {
Standard_NullObject::Raise("Cylinder creation aborted: point or vector is not defined");
}
if (aShapePnt.ShapeType() != TopAbs_VERTEX ||
aShapeVec.ShapeType() != TopAbs_EDGE) {
Standard_TypeMismatch::Raise("Cylinder creation aborted: point or vector shapes has wrong type");
}
aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
TopoDS_Edge anE = TopoDS::Edge(aShapeVec);
TopoDS_Vertex V1, V2;
TopExp::Vertices(anE, V1, V2, Standard_True);
if (V1.IsNull() || V2.IsNull()) {
Standard_NullObject::Raise("Cylinder creation aborted: vector is not defined");
}
aV = gp_Vec(BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
}
else {
return 0;
}
if (aCI.GetH() < 0.0) aV.Reverse();
gp_Ax2 anAxes (aP, aV);
BRepPrimAPI_MakeCylinder MC (anAxes, aCI.GetR(), Abs(aCI.GetH()));
MC.Build();
if (!MC.IsDone()) {
StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters");
}
TopoDS_Shape aShape = MC.Shape();
if (aShape.IsNull()) return 0;
aFunction->SetValue(aShape);
log.SetTouched(Label());
return 1;
}
开发者ID:triggerfish1, 项目名称:pythonocc, 代码行数:64, 代码来源:GEOMImpl_CylinderDriver.cpp
示例2: Execute
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOM_SubShapeDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOM_ISubShape aCI (aFunction);
TDF_Label aLabel = aCI.GetMainShape()->GetOwnerEntry();
if (aLabel.IsRoot()) return 0;
Handle(GEOM_Object) anObj = GEOM_Object::GetObject(aLabel);
if (anObj.IsNull()) return 0;
TopoDS_Shape aMainShape = anObj->GetValue();
if (aMainShape.IsNull()) return 0;
Handle(TColStd_HArray1OfInteger) anIndices = aCI.GetIndices();
if (anIndices.IsNull() || anIndices->Length() <= 0) return 0;
BRep_Builder B;
TopoDS_Compound aCompound;
TopoDS_Shape aShape;
if (anIndices->Length() == 1 && anIndices->Value(1) == -1) { //The empty sub-shape
B.MakeCompound(aCompound);
aShape = aCompound;
}
else {
TopTools_IndexedMapOfShape aMapOfShapes;
TopExp::MapShapes(aMainShape, aMapOfShapes);
if (anIndices->Length() > 1) {
B.MakeCompound(aCompound);
for (int i = anIndices->Lower(); i <= anIndices->Upper(); i++) {
if (aMapOfShapes.Extent() < anIndices->Value(i))
Standard_NullObject::Raise("GEOM_SubShapeDriver::Execute: Index is out of range");
TopoDS_Shape aSubShape = aMapOfShapes.FindKey(anIndices->Value(i));
if (aSubShape.IsNull()) continue;
B.Add(aCompound,aSubShape);
}
aShape = aCompound;
}
else {
int i = anIndices->Lower();
if (aMapOfShapes.Extent() < anIndices->Value(i))
Standard_NullObject::Raise("GEOM_SubShapeDriver::Execute: Index is out of range");
aShape = aMapOfShapes.FindKey(anIndices->Value(i));
}
}
if (aShape.IsNull()) return 0;
aFunction->SetValue(aShape);
log.SetTouched(Label());
return 1;
}
开发者ID:triggerfish1, 项目名称:pythonocc, 代码行数:62, 代码来源:GEOM_SubShapeDriver.cpp
示例3: Execute
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_BoxDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_IBox aBI (aFunction);
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
if (aType == BOX_DX_DY_DZ) {
BRepPrimAPI_MakeBox MB (aBI.GetDX(), aBI.GetDY(), aBI.GetDZ());
MB.Build();
if (!MB.IsDone()) {
StdFail_NotDone::Raise("Box with the given dimensions can not be computed");
}
aShape = MB.Shape();
}
else if (aType == BOX_TWO_PNT) {
Handle(GEOM_Function) aRefPoint1 = aBI.GetRef1();
Handle(GEOM_Function) aRefPoint2 = aBI.GetRef2();
TopoDS_Shape aShape1 = aRefPoint1->GetValue();
TopoDS_Shape aShape2 = aRefPoint2->GetValue();
if (aShape1.ShapeType() == TopAbs_VERTEX &&
aShape2.ShapeType() == TopAbs_VERTEX) {
gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape1));
gp_Pnt P2 = BRep_Tool::Pnt(TopoDS::Vertex(aShape2));
if (std::abs(P1.X() - P2.X()) < Precision::Confusion() ||
std::abs(P1.Y() - P2.Y()) < Precision::Confusion() ||
std::abs(P1.Z() - P2.Z()) < Precision::Confusion() ) {
StdFail_NotDone::Raise("Box can not be created, the points belong both to one of the OXY, OYZ or OZX planes");
return 0;
}
BRepPrimAPI_MakeBox MB (P1,P2);
MB.Build();
if (!MB.IsDone()) {
StdFail_NotDone::Raise("Box can not be computed from the given point");
}
aShape = MB.Shape();
}
}
else {
}
if (aShape.IsNull()) return 0;
aFunction->SetValue(aShape);
log.SetTouched(Label());
return 1;
}
开发者ID:triggerfish1, 项目名称:pythonocc, 代码行数:60, 代码来源:GEOMImpl_BoxDriver.cpp
示例4: Execute
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_HealingDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
if (aFunction.IsNull()) return 0;
GEOMImpl_IHealing HI (aFunction);
Standard_Integer aType = aFunction->GetType();
Handle(GEOM_Function) anOriginalFunction = HI.GetOriginal();
if (anOriginalFunction.IsNull()) return 0;
TopoDS_Shape aShape, anOriginalShape = anOriginalFunction->GetValue();
if (anOriginalShape.IsNull()) return 0;
switch (aType)
{
case SHAPE_PROCESS:
ShapeProcess(&HI, anOriginalShape, aShape);
break;
case SUPPRESS_FACES:
SuppressFaces(&HI, anOriginalShape, aShape);
break;
case CLOSE_CONTOUR:
CloseContour(&HI, anOriginalShape, aShape);
break;
case REMOVE_INT_WIRES:
RemoveIntWires(&HI, anOriginalShape, aShape);
break;
case FILL_HOLES:
RemoveHoles(&HI, anOriginalShape, aShape);
break;
case SEWING:
Sew(&HI, anOriginalShape, aShape);
break;
case DIVIDE_EDGE:
AddPointOnEdge(&HI, anOriginalShape, aShape);
break;
case CHANGE_ORIENTATION:
ChangeOrientation(&HI, anOriginalShape, aShape);
break;
case LIMIT_TOLERANCE:
LimitTolerance(&HI, anOriginalShape, aShape);
break;
default:
return 0;
}
if (aShape.IsNull())
raiseNotDoneExeption( ShHealOper_ErrorExecution );
aFunction->SetValue(aShape);
log.SetTouched(Label());
return 1;
}
开发者ID:dbarbier, 项目名称:pythonocc, 代码行数:59, 代码来源:GEOMImpl_HealingDriver.cpp
示例5: Execute
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_TorusDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_ITorus aCI (aFunction);
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
if (aType == TORUS_RR) {
aShape = BRepPrimAPI_MakeTorus(aCI.GetRMajor(), aCI.GetRMinor()).Shape();
} else if (aType == TORUS_PNT_VEC_RR) {
Handle(GEOM_Function) aRefPoint = aCI.GetCenter();
Handle(GEOM_Function) aRefVector = aCI.GetVector();
TopoDS_Shape aShapePnt = aRefPoint->GetValue();
TopoDS_Shape aShapeVec = aRefVector->GetValue();
if (aShapePnt.ShapeType() != TopAbs_VERTEX) {
Standard_TypeMismatch::Raise("Torus Center must be a vertex");
}
if (aShapeVec.ShapeType() != TopAbs_EDGE) {
Standard_TypeMismatch::Raise("Torus Axis must be an edge");
}
gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
TopoDS_Edge anE = TopoDS::Edge(aShapeVec);
TopoDS_Vertex V1, V2;
TopExp::Vertices(anE, V1, V2, Standard_True);
if (V1.IsNull() || V2.IsNull()) {
Standard_ConstructionError::Raise("Bad edge for the Torus Axis given");
}
gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
if (aV.Magnitude() < Precision::Confusion()) {
Standard_ConstructionError::Raise
("End vertices of edge, defining the Torus Axis, are too close");
}
gp_Ax2 anAxes (aP, aV);
BRepPrimAPI_MakeTorus MT (anAxes, aCI.GetRMajor(), aCI.GetRMinor());
if (!MT.IsDone()) MT.Build();
if (!MT.IsDone()) StdFail_NotDone::Raise("Torus construction algorithm has failed");
aShape = MT.Shape();
} else {
}
if (aShape.IsNull()) return 0;
aFunction->SetValue(aShape);
log.SetTouched(Label());
return 1;
}
开发者ID:triggerfish1, 项目名称:pythonocc, 代码行数:58, 代码来源:GEOMImpl_TorusDriver.cpp
示例6: Execute
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_SphereDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_ISphere aCI (aFunction);
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
char aMsg[] = "Sphere creation aborted: radius value less than 1e-07 is not acceptable";
double theAngle = aCI.GetAngle();
if (theAngle == 0.)
theAngle = PI * 2.;
double theVCoordStart = aCI.GetVCoordStart();
double theVCoordEnd = aCI.GetVCoordEnd();
if (aType == SPHERE_R) {
double anR = aCI.GetR();
if (anR < Precision::Confusion())
Standard_ConstructionError::Raise(aMsg);
//There seems to be an issue with the BRepPrimAPI_MakeSphere command concerning
//the limitations on V coodinates of its parametric space ... (Will not be used for the moment)
aShape = BRepPrimAPI_MakeSphere(anR /*, theVCoordStart, theVCoordEnd*/ , theAngle).Shape();
}
else if (aType == SPHERE_PNT_R) {
double anR = aCI.GetR();
if (anR < Precision::Confusion())
Standard_ConstructionError::Raise(aMsg);
Handle(GEOM_Function) aRefPoint = aCI.GetPoint();
TopoDS_Shape aShapePnt = aRefPoint->GetValue();
if (aShapePnt.ShapeType() != TopAbs_VERTEX)
Standard_ConstructionError::Raise("Invalid shape given for sphere center: it must be a point");
gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
aShape = BRepPrimAPI_MakeSphere(aP, anR/*, theVCoordStart, theVCoordEnd*/, theAngle).Shape();
}
else {
}
if (aShape.IsNull()) return 0;
aFunction->SetValue(aShape);
log.SetTouched(Label());
return 1;
}
开发者ID:hmeyer, 项目名称:salome-geom, 代码行数:58, 代码来源:GEOMImpl_SphereDriver.cpp
示例7: Execute
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_SphereDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_ISphere aCI (aFunction);
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
char aMsg[] = "Sphere creation aborted: radius value less than 1e-07 is not acceptable";
if (aType == SPHERE_R) {
double anR = aCI.GetR();
if (anR < Precision::Confusion())
Standard_ConstructionError::Raise(aMsg);
aShape = BRepPrimAPI_MakeSphere(anR).Shape();
}
else if (aType == SPHERE_PNT_R) {
double anR = aCI.GetR();
if (anR < Precision::Confusion())
Standard_ConstructionError::Raise(aMsg);
Handle(GEOM_Function) aRefPoint = aCI.GetPoint();
TopoDS_Shape aShapePnt = aRefPoint->GetValue();
if (aShapePnt.ShapeType() != TopAbs_VERTEX)
Standard_ConstructionError::Raise("Invalid shape given for sphere center: it must be a point");
gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
aShape = BRepPrimAPI_MakeSphere(aP, anR).Shape();
}
else {
}
if (aShape.IsNull()) return 0;
aFunction->SetValue(aShape);
log.SetTouched(Label());
return 1;
}
开发者ID:triggerfish1, 项目名称:pythonocc, 代码行数:47, 代码来源:GEOMImpl_SphereDriver.cpp
示例8: Execute
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_CircleDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_ICircle aCI (aFunction);
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
if (aType == CIRCLE_PNT_VEC_R) {
// Center
gp_Pnt aP = gp::Origin();
Handle(GEOM_Function) aRefPoint = aCI.GetCenter();
if (!aRefPoint.IsNull()) {
TopoDS_Shape aShapePnt = aRefPoint->GetValue();
if (aShapePnt.ShapeType() != TopAbs_VERTEX) {
Standard_ConstructionError::Raise
("Circle creation aborted: invalid center argument, must be a point");
}
aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
}
// Normal
gp_Vec aV = gp::DZ();
Handle(GEOM_Function) aRefVector = aCI.GetVector();
if (!aRefVector.IsNull()) {
TopoDS_Shape aShapeVec = aRefVector->GetValue();
if (aShapeVec.ShapeType() != TopAbs_EDGE) {
Standard_ConstructionError::Raise
("Circle creation aborted: invalid vector argument, must be a vector or an edge");
}
TopoDS_Edge anE = TopoDS::Edge(aShapeVec);
TopoDS_Vertex V1, V2;
TopExp::Vertices(anE, V1, V2, Standard_True);
if (!V1.IsNull() && !V2.IsNull()) {
aV = gp_Vec(BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
if (aV.Magnitude() < gp::Resolution()) {
Standard_ConstructionError::Raise
("Circle creation aborted: vector of zero length is given");
}
}
}
// Axes
gp_Ax2 anAxes (aP, aV);
// Radius
double anR = aCI.GetRadius();
char aMsg[] = "Circle creation aborted: radius value less than 1e-07 is not acceptable";
if (anR < Precision::Confusion())
Standard_ConstructionError::Raise(aMsg);
// Circle
gp_Circ aCirc (anAxes, anR);
aShape = BRepBuilderAPI_MakeEdge(aCirc).Edge();
}
else if (aType == CIRCLE_CENTER_TWO_PNT) {
Handle(GEOM_Function) aRefPoint1 = aCI.GetPoint1();
Handle(GEOM_Function) aRefPoint2 = aCI.GetPoint2();
Handle(GEOM_Function) aRefPoint3 = aCI.GetPoint3();
TopoDS_Shape aShapePnt1 = aRefPoint1->GetValue();
TopoDS_Shape aShapePnt2 = aRefPoint2->GetValue();
TopoDS_Shape aShapePnt3 = aRefPoint3->GetValue();
if (aShapePnt1.ShapeType() == TopAbs_VERTEX &&
aShapePnt2.ShapeType() == TopAbs_VERTEX &&
aShapePnt3.ShapeType() == TopAbs_VERTEX)
{
gp_Pnt aP1 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt1));
gp_Pnt aP2 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt2));
gp_Pnt aP3 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt3));
if (aP1.Distance(aP2) < gp::Resolution() ||
aP1.Distance(aP3) < gp::Resolution() ||
aP2.Distance(aP3) < gp::Resolution())
Standard_ConstructionError::Raise("Circle creation aborted: coincident points given");
if (gp_Vec(aP1, aP2).IsParallel(gp_Vec(aP1, aP3), Precision::Angular()))
Standard_ConstructionError::Raise("Circle creation aborted: points lay on one line");
double x, y, z, x1, y1, z1, x2, y2, z2, dx, dy, dz, dx2, dy2, dz2, dx3, dy3, dz3, aRadius;
//Calculations for Radius
x = aP1.X(); y = aP1.Y(); z = aP1.Z();
x1 = aP2.X(); y1 = aP2.Y(); z1 = aP2.Z();
dx = x1 - x;
dy = y1 - y;
dz = z1 - z;
aRadius = sqrt(dx*dx + dy*dy + dz*dz);
//Calculations for Plane Vector
x2 = aP3.X(); y2 = aP3.Y(); z2 = aP3.Z();
dx2 = x2 - x; dy2 = y2 - y; dz2 = z2 - z;
dx3 = ((dy*dz2) - (dy2*dz))/100;
dy3 = ((dx2*dz) - (dx*dz2))/100;
dz3 = ((dx*dy2) - (dx2*dy))/100;
//Make Plane Vector
gp_Dir aDir ( dx3, dy3, dz3 );
//Make Circle
gp_Ax2 anAxes (aP1, aDir);
//.........这里部分代码省略.........
开发者ID:dbarbier, 项目名称:pythonocc, 代码行数:101, 代码来源:GEOMImpl_CircleDriver.cpp
示例9: Execute
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_DraftDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
if(aFunction.IsNull()) return 0;
GEOMImpl_IDraft aCI (aFunction);
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
TopoDS_Shape aPlaneShape;
gp_Pln theNeutralPlane;
gp_Dir theDirection;
Handle(GEOM_Function) aRefShape = aCI.GetShape();
TopoDS_Shape aShapeBase = aRefShape->GetValue();
//get the reference plane and direction
if (aType == DRAFT_BY_FACE_PLN_ANG) {
Handle(GEOM_Function) aRefPlane = aCI.GetPlane();
if (aRefPlane.IsNull())
return 0;
aPlaneShape = aRefPlane->GetValue();
}
else if (aType == DRAFT_BY_FACE_STA_ANG) {
GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetStationary(), aPlaneShape);
}
if (aPlaneShape.IsNull() || aPlaneShape.ShapeType() != TopAbs_FACE)
return 0;
TopoDS_Face aFace = TopoDS::Face(aPlaneShape);
Handle(Geom_Surface) surf = BRep_Tool::Surface(aFace);
Handle(Geom_Plane) myPlane = Handle(Geom_Plane)::DownCast(surf);
theNeutralPlane = myPlane->Pln();
theDirection = theNeutralPlane.Axis().Direction();
//compute the value
Standard_Real theAngle = aCI.GetAngle();
int aLen = aCI.GetLength();
int ind = 1;
int added = 0;
BRepOffsetAPI_DraftAngle aDraft (aShapeBase);
for (; ind <= aLen; ind++) {
TopoDS_Shape aShapeFace;
if (GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace(ind), aShapeFace)) {
TopoDS_Face aFace = TopoDS::Face(aShapeFace);
aDraft.Add(aFace, theDirection, theAngle, theNeutralPlane);
if (aDraft.AddDone())
added++;
else
aDraft.Remove(aFace);
}
}
if (added == 0)
StdFail_NotDone::Raise("None of the faces provided can be used for draft algo");
aDraft.Build();
if (!aDraft.IsDone()) {
StdFail_NotDone::Raise("Draft can't be computed on the given shape with the given parameters");
}
aShape = aDraft.Shape();
if (aShape.IsNull()) return 0;
// Check shape validity
BRepCheck_Analyzer ana (aShape, false);
if (!ana.IsValid()) {
Standard_CString anErrStr("Draft algorythm has produced an invalid shape result");
#ifdef THROW_ON_INVALID_SH
Standard_ConstructionError::Raise(anErrStr);
#else
MESSAGE(anErrStr);
//further processing can be performed here
//...
//in case of failure of automatic treatment
//mark the corresponding GEOM_Object as problematic
TDF_Label aLabel = aFunction->GetOwnerEntry();
if (!aLabel.IsRoot()) {
Handle(GEOM_Object) aMainObj = GEOM_Object::GetObject(aLabel);
if (!aMainObj.IsNull())
aMainObj->SetDirty(Standard_True);
}
#endif
}
aFunction->SetValue(aShape);
log.SetTouched(Label());
return 1;
}
开发者ID:dbarbier, 项目名称:pythonocc, 代码行数:99, 代码来源:GEOMImpl_DraftDriver.cpp
示例10: Execute
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_ChamferDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_IChamfer aCI (aFunction);
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
Handle(GEOM_Function) aRefShape = aCI.GetShape();
TopoDS_Shape aShapeBase = aRefShape->GetValue();
if (aType == CHAMFER_SHAPE_EDGES_2D)
{
BRepFilletAPI_MakeFillet2d fill;
TopoDS_Face aFace;
Standard_Boolean aWireFlag = Standard_False;
if (aShapeBase.ShapeType() == TopAbs_FACE)
aFace = TopoDS::Face(aShapeBase);
else if (aShapeBase.ShapeType() == TopAbs_WIRE)
{
TopoDS_Wire aWire = TopoDS::Wire(aShapeBase);
BRepBuilderAPI_MakeFace aMF(aWire);
aMF.Build();
if (!aMF.IsDone()) {
StdFail_NotDone::Raise("Cannot build initial face from given wire");
}
aFace = aMF.Face();
aWireFlag = Standard_True;
}
else
StdFail_NotDone::Raise("Base shape is neither a face or a wire !");
fill.Init(aFace);
double aD1_2D = aCI.GetD1();
double aD2_2D = aCI.GetD2();
TopoDS_Shape aShapeFace1, aShapeFace2;
if (GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.Get2DEdge1(), aShapeFace1) &&
GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.Get2DEdge2(), aShapeFace2))
{
fill.AddChamfer(TopoDS::Edge(aShapeFace1), TopoDS::Edge(aShapeFace2), aD1_2D, aD2_2D);
}
else
StdFail_NotDone::Raise("Cannot get 2d egde from sub-shape index!");
fill.Build();
if (!fill.IsDone()) {
StdFail_NotDone::Raise("Chamfer can not be computed on the given shape with the given parameters");
}
if (aWireFlag)
{
BRepBuilderAPI_MakeWire MW;
TopExp_Explorer exp (fill.Shape(), TopAbs_EDGE);
for (; exp.More(); exp.Next())
MW.Add(TopoDS::Edge(exp.Current()));
MW.Build();
if (!MW.IsDone())
StdFail_NotDone::Raise("Resulting wire cannot be built");
aShape = MW.Shape();
}
else
aShape = fill.Shape();
}
else
{
// Check the shape type. It have to be shell
// or solid, or compsolid, or compound of these shapes.
if (!isGoodForChamfer(aShapeBase)) {
StdFail_NotDone::Raise
("Wrong shape. Must be shell or solid, or compsolid or compound of these shapes");
}
BRepFilletAPI_MakeChamfer fill (aShapeBase);
if (aType == CHAMFER_SHAPE_ALL) {
// symmetric chamfer on all edges
double aD = aCI.GetD();
TopTools_IndexedDataMapOfShapeListOfShape M;
GEOMImpl_Block6Explorer::MapShapesAndAncestors(aShapeBase, TopAbs_EDGE, TopAbs_FACE, M);
for (int i = 1; i <= M.Extent(); i++) {
TopoDS_Edge E = TopoDS::Edge(M.FindKey(i));
TopoDS_Face F = TopoDS::Face(M.FindFromIndex(i).First());
if (!BRepTools::IsReallyClosed(E, F) &&
!BRep_Tool::Degenerated(E) &&
M.FindFromIndex(i).Extent() == 2)
fill.Add(aD, E, F);
}
//.........这里部分代码省略.........
开发者ID:hmeyer, 项目名称:salome-geom, 代码行数:101, 代码来源:GEOMImpl_ChamferDriver.cpp
示例11: Execute
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_ScaleDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_IScale aCI (aFunction);
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
if (aType == SCALE_SHAPE || aType == SCALE_SHAPE_COPY) {
Handle(GEOM_Function) aRefShape = aCI.GetShape();
TopoDS_Shape aShapeBase = aRefShape->GetValue();
if (aShapeBase.IsNull()) return 0;
gp_Pnt aP (0,0,0);
Handle(GEOM_Function) aRefPoint = aCI.GetPoint();
if (!aRefPoint.IsNull()) {
TopoDS_Shape aShapePnt = aRefPoint->GetValue();
if (aShapePnt.IsNull()) return 0;
if (aShapePnt.ShapeType() != TopAbs_VERTEX) return 0;
aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
}
// Bug 6839: Check for standalone (not included in faces) degenerated edges
TopTools_IndexedDataMapOfShapeListOfShape aEFMap;
TopExp::MapShapesAndAncestors(aShapeBase, TopAbs_EDGE, TopAbs_FACE, aEFMap);
Standard_Integer i, nbE = aEFMap.Extent();
for (i = 1; i <= nbE; i++) {
TopoDS_Shape anEdgeSh = aEFMap.FindKey(i);
if (BRep_Tool::Degenerated(TopoDS::Edge(anEdgeSh))) {
const TopTools_ListOfShape& aFaces = aEFMap.FindFromIndex(i);
if (aFaces.IsEmpty())
Standard_ConstructionError::Raise
("Scaling aborted : cannot scale standalone degenerated edge");
}
}
// Perform Scaling
gp_Trsf aTrsf;
aTrsf.SetScale(aP, aCI.GetFactor());
BRepBuilderAPI_Transform aBRepTrsf (aShapeBase, aTrsf, Standard_False);
aShape = aBRepTrsf.Shape();
}
else if (aType == SCALE_SHAPE_AFFINE || aType == SCALE_SHAPE_AFFINE_COPY) {
Handle(GEOM_Function) aRefShape = aCI.GetShape();
Handle(GEOM_Function) aRefVector = aCI.GetVector();
TopoDS_Shape aShapeBase = aRefShape->GetValue();
TopoDS_Shape aShapeVector = aRefVector->GetValue();
if (aShapeBase.IsNull() || aShapeVector.IsNull()) return 0;
if (aShapeVector.ShapeType() != TopAbs_EDGE) return 0;
TopoDS_Edge anEdgeVector = TopoDS::Edge(aShapeVector);
// Bug 6839: Check for standalone (not included in faces) degenerated edges
TopTools_IndexedDataMapOfShapeListOfShape aEFMap;
TopExp::MapShapesAndAncestors(aShapeBase, TopAbs_EDGE, TopAbs_FACE, aEFMap);
Standard_Integer i, nbE = aEFMap.Extent();
for (i = 1; i <= nbE; i++) {
TopoDS_Shape anEdgeSh = aEFMap.FindKey(i);
if (BRep_Tool::Degenerated(TopoDS::Edge(anEdgeSh))) {
const TopTools_ListOfShape& aFaces = aEFMap.FindFromIndex(i);
if (aFaces.IsEmpty())
Standard_ConstructionError::Raise
("Scaling aborted : cannot scale standalone degenerated edge");
}
}
//Get axis
gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdgeVector));
gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdgeVector));
gp_Dir aDir(gp_Vec(aP1, aP2));
gp_Ax2 anAx2(aP1, aDir);
// Perform Scaling
gp_GTrsf aGTrsf;
aGTrsf.SetAffinity(anAx2, aCI.GetFactor());
BRepBuilderAPI_GTransform aBRepGTrsf(aShapeBase, aGTrsf, Standard_False);
aShape = aBRepGTrsf.Shape();
}
else if (aType == SCALE_SHAPE_AXES || aType == SCALE_SHAPE_AXES_COPY) {
Handle(GEOM_Function) aRefShape = aCI.GetShape();
TopoDS_Shape aShapeBase = aRefShape->GetValue();
if (aShapeBase.IsNull()) return 0;
bool isP = false;
gp_Pnt aP (0,0,0);
Handle(GEOM_Function) aRefPoint = aCI.GetPoint();
if (!aRefPoint.IsNull()) {
TopoDS_Shape aShapePnt = aRefPoint->GetValue();
if (aShapePnt.IsNull()) return 0;
if (aShapePnt.ShapeType() != TopAbs_VERTEX) return 0;
aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
isP = true;
}
// Bug 6839: Check for standalone (not included in faces) degenerated edges
//.........这里部分代码省略.........
开发者ID:dbarbier, 项目名称:pythonocc, 代码行数:101, 代码来源:GEOMImpl_ScaleDriver.cpp
示例12: Execute
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_MarkerDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_IMarker aPI (aFunction);
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
if (aType == MARKER_CS) {
double OX, OY, OZ;
double XDX, XDY, XDZ;
double YDX, YDY, YDZ;
aPI.GetOrigin(OX, OY, OZ);
aPI.GetXDir(XDX, XDY, XDZ);
aPI.GetYDir(YDX, YDY, YDZ);
gp_Pnt aPO (OX, OY, OZ);
gp_Vec aVX (XDX, XDY, XDZ);
gp_Vec aVY (YDX, YDY, YDZ);
Standard_Real aTol = Precision::Confusion();
if (aVX.Magnitude() < aTol ||
aVY.Magnitude() < aTol ||
aVX.IsParallel(aVY, Precision::Angular())) {
Standard_ConstructionError::Raise("Degenerated or parallel directions given");
}
gp_Vec aN = aVX ^ aVY;
gp_Ax3 anA (aPO, aN, aVX);
gp_Pln aPln (anA);
double aTrimSize = 100.0;
aShape = BRepBuilderAPI_MakeFace(aPln, -aTrimSize, +aTrimSize, -aTrimSize, +aTrimSize).Shape();
} else if (aType == MARKER_SHAPE) {
Handle(GEOM_Function) aRefShape = aPI.GetShape();
TopoDS_Shape aSh = aRefShape->GetValue();
gp_Ax3 anAx3 = GEOMImpl_IMeasureOperations::GetPosition(aSh);
gp_Pln aPln (anAx3);
double aTrimSize = 100.0;
aShape = BRepBuilderAPI_MakeFace(aPln, -aTrimSize, +aTrimSize, -aTrimSize, +aTrimSize).Shape();
} else if (aType == MARKER_PNT2VEC) {
Handle(GEOM_Function) aRefOrigin = aPI.GetOrigin();
Handle(GEOM_Function) aRefXVec = aPI.GetXVec();
Handle(GEOM_Function) aRefYVec = aPI.GetYVec();
TopoDS_Shape aShapeOrigin = aRefOrigin->GetValue();
TopoDS_Shape aShapeXVec = aRefXVec->GetValue();
TopoDS_Shape aShapeYVec = aRefYVec->GetValue();
if (aShapeOrigin.ShapeType() != TopAbs_VERTEX || aShapeOrigin.IsNull()) return 0;
if (aShapeXVec.ShapeType() != TopAbs_EDGE || aShapeXVec.IsNull()) return 0;
if (aShapeYVec.ShapeType() != TopAbs_EDGE || aShapeYVec.IsNull()) return 0;
gp_Pnt aPO = BRep_Tool::Pnt( TopoDS::Vertex( aShapeOrigin ) );
gp_Pnt aPX1 = BRep_Tool::Pnt( TopExp::FirstVertex( TopoDS::Edge( aShapeXVec ) ) );
gp_Pnt aPX2 = BRep_Tool::Pnt( TopExp::LastVertex( TopoDS::Edge( aShapeXVec ) ) );
gp_Vec aVX( aPX1, aPX2 );
gp_Pnt aPY1 = BRep_Tool::Pnt( TopExp::FirstVertex( TopoDS::Edge( aShapeYVec ) ) );
gp_Pnt aPY2 = BRep_Tool::Pnt( TopExp::LastVertex( TopoDS::Edge( aShapeYVec ) ) );
gp_Vec aVY( aPY1, aPY2 );
if (aVX.Magnitude() < gp::Resolution() || aVY.Magnitude() < gp::Resolution())
Standard_ConstructionError::Raise
("Local CS creation aborted: vector of zero length is given");
if ( aVX.IsParallel(aVY, Precision::Angular()))
Standard_ConstructionError::Raise("Parallel Vectors given");
gp_Vec aN = aVX ^ aVY;
gp_Ax3 anA (aPO, aN, aVX);
gp_Pln aPln (anA);
double aTrimSize = 100.0;
aShape = BRepBuilderAPI_MakeFace(aPln, -aTrimSize, +aTrimSize, -aTrimSize, +aTrimSize).Shape();
} else {
}
if (aShape.IsNull()) return 0;
aFunction->SetValue(aShape);
log.SetTouched(Label());
return 1;
}
开发者ID:triggerfish1, 项目名称:pythonocc, 代码行数:91, 代码来源:GEOMImpl_MarkerDriver.cpp
示例13: Execute
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_MeasureDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_IMeasure aCI (aFunction);
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
if (aType == CDG_MEASURE)
{
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");
}
gp_Ax3 aPos = GEOMImpl_IMeasureOperations::GetPosition(aShapeBase);
gp_Pnt aCenterMass = aPos.Location();
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)
{
// Face
Handle(GEOM_Function) aRefBase = aCI.GetBase();
TopoDS_Shape aShapeBase = aRefBase->GetValue();
if (aShapeBase.IsNull()) {
Standard_NullObject::Raise("Face for normale calculation is null");
}
if (aShapeBase.ShapeType() != TopAbs_FACE) {
Standard_NullObject::Raise("Shape for normale calculation is not a face");
}
//.........这里部分代码省略.........
开发者ID:triggerfish1, 项目名称:pythonocc, 代码行数:101, 代码来源:GEOMImpl_MeasureDriver.cpp
示例14: Execute
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_PositionDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_IPosition aCI (aFunction);
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
if (aType == POSITION_SHAPE || aType == POSITION_SHAPE_COPY) {
Handle(GEOM_Function) aRefShape = aCI.GetShape();
Handle(GEOM_Function) aRefStartLCS = aCI.GetStartLCS();
Handle(GEOM_Function) aRefEndLCS = aCI.GetEndLCS();
TopoDS_Shape aShapeBase = aRefShape->GetValue();
TopoDS_Shape aShapeStartLCS = aRefStartLCS->GetValue();
TopoDS_Shape aShapeEndLCS = aRefEndLCS->GetValue();
if (aShapeBase.IsNull() || aShapeStartLCS.IsNull() ||
aShapeEndLCS.IsNull() || aShapeEndLCS.ShapeType() != TopAbs_FACE)
return 0;
gp_Trsf aTrsf;
gp_Ax3 aStartAx3, aDestAx3;
// End LCS
aDestAx3 = GEOMImpl_IMeasureOperations::GetPosition(aShapeEndLCS);
// Start LCS
aStartAx3 = GEOMImpl_IMeasureOperations::GetPosition(aShapeStartLCS);
// Set transformation
aTrsf.SetDisplacement(aStartAx3, aDestAx3);
// Perform transformation
BRepBuilderAPI_Transform aBRepTrsf (aShapeBase, aTrsf, Standard_False);
aShape = aBRepTrsf.Shape();
}
else if (aType == POSITION_SHAPE_FROM_GLOBAL ||
aType == POSITION_SHAPE_FROM_GLOBAL_COPY) {
Handle(GEOM_Function) aRefShape = aCI.GetShape();
Handle(GEOM_Function) aRefEndLCS = aCI.GetEndLCS();
TopoDS_Shape aShapeBase = aRefShape->GetValue();
TopoDS_Shape aShapeEndLCS = aRefEndLCS->GetValue();
if (aShapeBase.IsNull() || aShapeEndLCS.IsNull() ||
aShapeEndLCS.ShapeType() != TopAbs_FACE)
return 0;
gp_Trsf aTrsf;
gp_Ax3 aStartAx3, aDestAx3;
// End LCS
aDestAx3 = GEOMImpl_IMeasureOperations::GetPosition(aShapeEndLCS);
// Set transformation
aTrsf.SetDisplacement(aStartAx3, aDestAx3);
// Perform transformation
BRepBuilderAPI_Transform aBRepTrsf (aShapeBase, aTrsf, Standard_False);
aShape = aBRepTrsf.Shape();
}
else if (aType == POSITION_ALONG_PATH) {
Handle(GEOM_Function) aRefShape = aCI.GetShape();
Handle(GEOM_Function) aPathShape = aCI.GetPath();
Standard_Real aParameter = aCI.GetDistance();
bool aReversed = aCI.GetReverse();
if (aReversed)
aParameter = 1 - aParameter;
TopoDS_Shape aShapeBase = aRefShape->GetValue();
TopoDS_Shape aPath = aPathShape->GetValue();
TopoDS_Wire aWire;
if (aShapeBase.IsNull() || aPath.IsNull())
return 0;
if ( aPath.ShapeType() == TopAbs_EDGE ) {
TopoDS_Edge anEdge = TopoDS::Edge(aPath);
aWire = BRepBuilderAPI_MakeWire(anEdge);
}
else if ( aPath.ShapeType() == TopAbs_WIRE)
aWire = TopoDS::Wire(aPath);
else
return 0;
Handle(GeomFill_TrihedronLaw) TLaw = new GeomFill_CorrectedFrenet();
Handle(GeomFill_CurveAndTrihedron) aLocationLaw = new GeomFill_CurveAndTrihedron( TLaw );
Handle(BRepFill_LocationLaw) aLocation = new BRepFill_Edge3DLaw(aWire, aLocationLaw);
aLocation->TransformInCompatibleLaw( 0.01 );
//Calculate a Parameter
Standard_Real aFirstParam1 = 0, aLastParam1 = 0; // Parameters of the First edge
//.........这里部分代码省略.........
开发者ID:triggerfish1, 项目名称:pythonocc, 代码行数:101, 代码来源:GEOMImpl_PositionDriver.cpp
示例15: Execute
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_ChamferDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_IChamfer aCI (aFunction);
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
Handle(GEOM_Function) aRefShape = aCI.GetShape();
TopoDS_Shape aShapeBase = aRefShape->GetValue();
// Check the shape type. It have to be shell
// or solid, or compsolid, or compound of these shapes.
if (!isGoodForChamfer(aShapeBase)) {
StdFail_NotDone::Raise
("Wrong shape. Must be shell or solid, or compsolid or compound of these shapes");
}
BRepFilletAPI_MakeChamfer fill (aShapeBase);
if (aType == CHAMFER_SHAPE_ALL) {
// symmetric chamfer on all edges
double aD = aCI.GetD();
TopTools_IndexedDataMapOfShapeListOfShape M;
GEOMImpl_Block6Explorer::MapShapesAndAncestors(aShapeBase, TopAbs_EDGE, TopAbs_FACE, M);
for (int i = 1; i <= M.Extent(); i++) {
TopoDS_Edge E = TopoDS::Edge(M.FindKey(i));
TopoDS_Face F = TopoDS::Face(M.FindFromIndex(i).First());
if (!BRepTools::IsReallyClosed(E, F) &&
!BRep_Tool::Degenerated(E) &&
M.FindFromIndex(i).Extent() == 2)
fill.Add(aD, E, F);
}
}
else if (aType == CHAMFER_SHAPE_EDGE || aType == CHAMFER_SHAPE_EDGE_AD) {
// chamfer on edges, common to two faces, with D1 on the first face
TopoDS_Shape aFace1, aFace2;
if (GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace1(), aFace1) &&
GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace2(), aFace2))
{
TopoDS_Face F = TopoDS::Face(aFace1);
// fill map of edges of the second face
TopTools_MapOfShape aMap;
TopExp_Explorer Exp2 (aFace2, TopAbs_EDGE);
for (; Exp2.More(); Exp2.Next()) {
aMap.Add(Exp2.Current());
}
// find edges of the first face, common with the second face
TopExp_Explorer Exp (aFace1, TopAbs_EDGE);
for (; Exp.More(); Exp.Next()) {
if (aMap.Contains(Exp.Current())) {
TopoDS_Edge E = TopoDS::Edge(Exp.Current());
if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E))
{
if ( aType == CHAMFER_SHAPE_EDGE )
{
double aD1 = aCI.GetD1();
double aD2 = aCI.GetD2();
fill.Add(aD1, aD2, E, F);
}
else
{
double aD = aCI.GetD();
double anAngle = aCI.GetAngle();
if ( (anAngle > 0) && (anAngle < (M_PI/2.)) )
fill.AddDA(aD, anAngle, E, F);
}
}
}
}
}
}
else if (aType == CHAMFER_SHAPE_FACES || aType == CHAMFER_SHAPE_FACES_AD) {
// chamfer on all edges of the selected faces, with D1 on the selected face
// (on first selected face, if the edge belongs to two selected faces)
int aLen = aCI.GetLength();
int ind = 1;
TopTools_MapOfShape aMap;
TopTools_IndexedDataMapOfShapeListOfShape M;
GEOMImpl_Block6Explorer::MapShapesAndAncestors(aShapeBase, TopAbs_EDGE, TopAbs_FACE, M);
for (; ind <= aLen; ind++)
{
TopoDS_Shape aShapeFace;
if (GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace(ind), aShapeFace))
{
TopoDS_Face F = TopoDS::Face(aShapeFace);
TopExp_Explorer Exp (F, TopAbs_EDGE);
for (; Exp.More(); Exp.Next()) {
if (!aMap.Contains(Exp.Current()))
{
//.........这里部分代码省略.........
开发者ID:triggerfish1, 项目名称:pythonocc, 代码行数:101, 代码来源:GEOMImpl_ChamferDriver.cpp
六六分期app的软件客服如何联系?不知道吗?加qq群【895510560】即可!标题:六六分期
阅读:18209| 2023-10-27
今天小编告诉大家如何处理win10系统火狐flash插件总是崩溃的问题,可能很多用户都不知
阅读:9656| 2022-11-06
今天小编告诉大家如何对win10系统删除桌面回收站图标进行设置,可能很多用户都不知道
阅读:8168| 2022-11-06
今天小编告诉大家如何对win10系统电脑设置节能降温的设置方法,想必大家都遇到过需要
阅读:8543| 2022-11-06
我们在使用xp系统的过程中,经常需要对xp系统无线网络安装向导设置进行设置,可能很多
阅读:8449| 2022-11-06
今天小编告诉大家如何处理win7系统玩cf老是与主机连接不稳定的问题,可能很多用户都不
阅读:9374| 2022-11-06
电脑对日常生活的重要性小编就不多说了,可是一旦碰到win7系统设置cf烟雾头的问题,很
阅读:8418| 2022-11-06
我们在日常使用电脑的时候,有的小伙伴们可能在打开应用的时候会遇见提示应用程序无法
阅读:7855| 2022-11-06
今天小编告诉大家如何对win7系统打开vcf文件进行设置,可能很多用户都不知道怎么对win
阅读:8403| 2022-11-06
今天小编告诉大家如何对win10系统s4开启USB调试模式进行设置,可能很多用户都不知道怎
阅读:7391| 2022-11-06
请发表评论