本文整理汇总了C++中TopoDS_Shape::Located方法的典型用法代码示例。如果您正苦于以下问题:C++ TopoDS_Shape::Located方法的具体用法?C++ TopoDS_Shape::Located怎么用?C++ TopoDS_Shape::Located使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TopoDS_Shape
的用法示例。
在下文中一共展示了TopoDS_Shape::Located方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeScaledPrism
//=======================================================================
//function : MakeScaledPrism
//purpose :
//=======================================================================
TopoDS_Shape GEOMImpl_PrismDriver::MakeScaledPrism (const TopoDS_Shape& theShapeBase,
const gp_Vec& theVector,
const Standard_Real theScaleFactor,
const gp_Pnt& theCDG,
bool isCDG)
{
TopoDS_Shape aShape;
BRep_Builder B;
// 1. aCDG = geompy.MakeCDG(theBase)
gp_Pnt aCDG = theCDG;
if (!isCDG) {
gp_Ax3 aPos = GEOMImpl_IMeasureOperations::GetPosition(theShapeBase);
aCDG = aPos.Location();
}
TopoDS_Shape aShapeCDG_1 = BRepBuilderAPI_MakeVertex(aCDG).Shape();
// Process case of several given shapes
if (theShapeBase.ShapeType() == TopAbs_COMPOUND ||
theShapeBase.ShapeType() == TopAbs_SHELL) {
int nbSub = 0;
TopoDS_Shape aShapeI;
TopoDS_Compound aCompound;
B.MakeCompound(aCompound);
TopoDS_Iterator It (theShapeBase, Standard_True, Standard_True);
for (; It.More(); It.Next()) {
nbSub++;
aShapeI = MakeScaledPrism(It.Value(), theVector, theScaleFactor, aCDG, true);
B.Add(aCompound, aShapeI);
}
if (nbSub == 1)
aShape = aShapeI;
else if (nbSub > 1)
aShape = GEOMImpl_GlueDriver::GlueFaces(aCompound, Precision::Confusion(), Standard_True);
return aShape;
}
// 2. Scale = geompy.MakeScaleTransform(theBase, aCDG, theScaleFactor)
// Bug 6839: Check for standalone (not included in faces) degenerated edges
TopTools_IndexedDataMapOfShapeListOfShape aEFMap;
TopExp::MapShapesAndAncestors(theShapeBase, 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(aCDG, theScaleFactor);
BRepBuilderAPI_Transform aBRepTrsf (theShapeBase, aTrsf, Standard_False);
TopoDS_Shape aScale = aBRepTrsf.Shape();
// 3. aBase2 = geompy.MakeTranslationVectorDistance(Scale, theVec, theH)
gp_Trsf aTrsf3;
aTrsf3.SetTranslation(theVector);
TopLoc_Location aLocOrig = aScale.Location();
gp_Trsf aTrsfOrig = aLocOrig.Transformation();
TopLoc_Location aLocRes (aTrsf3 * aTrsfOrig);
TopoDS_Shape aBase2 = aScale.Located(aLocRes);
// 4. aCDG_2 = geompy.MakeTranslationVectorDistance(aCDG, theVec, theH)
gp_Pnt aCDG_2 = aCDG.Translated(theVector);
TopoDS_Shape aShapeCDG_2 = BRepBuilderAPI_MakeVertex(aCDG_2).Shape();
// 5. Vector = geompy.MakeVector(aCDG, aCDG_2)
TopoDS_Shape aShapeVec = BRepBuilderAPI_MakeEdge(aCDG, aCDG_2).Shape();
TopoDS_Edge anEdge = TopoDS::Edge(aShapeVec);
TopoDS_Wire aWirePath = BRepBuilderAPI_MakeWire(anEdge);
// 6. aPrism = geompy.MakePipeWithDifferentSections([theBase, aBase2], [aCDG, aCDG_2], Vector, False, False)
Handle(TopTools_HSequenceOfShape) aBases = new TopTools_HSequenceOfShape;
aBases->Append(theShapeBase);
aBases->Append(aBase2);
Handle(TopTools_HSequenceOfShape) aLocs = new TopTools_HSequenceOfShape;
aLocs->Append(aShapeCDG_1);
aLocs->Append(aShapeCDG_2);
aShape = GEOMImpl_PipeDriver::CreatePipeWithDifferentSections(aWirePath, aBases, aLocs, false, false);
// 7. Make a solid, if possible
if (theShapeBase.ShapeType() == TopAbs_FACE) {
BRepBuilderAPI_Sewing aSewing (Precision::Confusion()*10.0);
TopExp_Explorer expF (aShape, TopAbs_FACE);
Standard_Integer ifa = 0;
for (; expF.More(); expF.Next()) {
aSewing.Add(expF.Current());
ifa++;
}
//.........这里部分代码省略.........