本文整理汇总了C++中BRepBuilderAPI_MakePolygon::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ BRepBuilderAPI_MakePolygon::Close方法的具体用法?C++ BRepBuilderAPI_MakePolygon::Close怎么用?C++ BRepBuilderAPI_MakePolygon::Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BRepBuilderAPI_MakePolygon
的用法示例。
在下文中一共展示了BRepBuilderAPI_MakePolygon::Close方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createPolygonal
int OCCFace::createPolygonal(std::vector<OCCStruct3d> points)
{
try {
BRepBuilderAPI_MakePolygon MP;
for (unsigned i=0; i<points.size(); i++) {
MP.Add(gp_Pnt(points[i].x, points[i].y, points[i].z));
}
MP.Close();
if (!MP.IsDone()) {
StdFail_NotDone::Raise("failed to create face");;
}
BRepBuilderAPI_MakeFace MF(MP.Wire(), false);
this->setShape(MF.Face());
// possible fix shape
if (!this->fixShape())
StdFail_NotDone::Raise("Shapes not valid");
} catch(Standard_Failure &err) {
Handle_Standard_Failure e = Standard_Failure::Caught();
const Standard_CString msg = e->GetMessageString();
if (msg != NULL && strlen(msg) > 1) {
setErrorMessage(msg);
} else {
setErrorMessage("Failed to create face");
}
return 0;
}
return 1;
}
示例2: pnt
App::DocumentObjectExecReturn *Part::Polygon::execute(void)
{
BRepBuilderAPI_MakePolygon poly;
const std::vector<Base::Vector3d> nodes = Nodes.getValues();
for (std::vector<Base::Vector3d>::const_iterator it = nodes.begin(); it != nodes.end(); ++it) {
gp_Pnt pnt(it->x, it->y, it->z);
poly.Add(pnt);
}
if (Close.getValue())
poly.Close();
if (!poly.IsDone())
throw Base::CADKernelError("Cannot create polygon because less than two vertices are given");
TopoDS_Wire wire = poly.Wire();
this->Shape.setValue(wire);
return App::DocumentObject::StdReturn;
}
示例3:
bool IfcGeom::Kernel::convert(const IfcSchema::IfcPolyLoop* l, TopoDS_Wire& result) {
IfcSchema::IfcCartesianPoint::list::ptr points = l->Polygon();
// Parse and store the points in a sequence
TColgp_SequenceOfPnt polygon;
for(IfcSchema::IfcCartesianPoint::list::it it = points->begin(); it != points->end(); ++ it) {
gp_Pnt pnt;
IfcGeom::Kernel::convert(*it, pnt);
polygon.Append(pnt);
}
// A loop should consist of at least three vertices
int original_count = polygon.Length();
if (original_count < 3) {
Logger::Message(Logger::LOG_ERROR, "Not enough edges for:", l->entity);
return false;
}
// Remove points that are too close to one another
remove_redundant_points_from_loop(polygon, true);
int count = polygon.Length();
if (original_count - count != 0) {
std::stringstream ss; ss << (original_count - count) << " edges removed for:";
Logger::Message(Logger::LOG_WARNING, ss.str(), l->entity);
}
if (count < 3) {
Logger::Message(Logger::LOG_ERROR, "Not enough edges for:", l->entity);
return false;
}
BRepBuilderAPI_MakePolygon w;
for (int i = 1; i <= polygon.Length(); ++i) {
w.Add(polygon.Value(i));
}
w.Close();
result = w.Wire();
return true;
}
示例4: makeLoft
void occQt::makeLoft()
{
// bottom wire.
TopoDS_Edge aCircleEdge = BRepBuilderAPI_MakeEdge(gp_Circ(gp_Ax2(gp_Pnt(0.0, 80.0, 0.0), gp::DZ()), 1.5));
TopoDS_Wire aCircleWire = BRepBuilderAPI_MakeWire(aCircleEdge);
// top wire.
BRepBuilderAPI_MakePolygon aPolygon;
aPolygon.Add(gp_Pnt(-3.0, 77.0, 6.0));
aPolygon.Add(gp_Pnt(3.0, 77.0, 6.0));
aPolygon.Add(gp_Pnt(3.0, 83.0, 6.0));
aPolygon.Add(gp_Pnt(-3.0, 83.0, 6.0));
aPolygon.Close();
BRepOffsetAPI_ThruSections aShellGenerator;
BRepOffsetAPI_ThruSections aSolidGenerator(true);
aShellGenerator.AddWire(aCircleWire);
aShellGenerator.AddWire(aPolygon.Wire());
aSolidGenerator.AddWire(aCircleWire);
aSolidGenerator.AddWire(aPolygon.Wire());
// translate the solid.
gp_Trsf aTrsf;
aTrsf.SetTranslation(gp_Vec(18.0, 0.0, 0.0));
BRepBuilderAPI_Transform aTransform(aSolidGenerator.Shape(), aTrsf);
Handle_AIS_Shape anAisShell = new AIS_Shape(aShellGenerator.Shape());
Handle_AIS_Shape anAisSolid = new AIS_Shape(aTransform.Shape());
anAisShell->SetColor(Quantity_NOC_OLIVEDRAB);
anAisSolid->SetColor(Quantity_NOC_PEACHPUFF);
mContext->Display(anAisShell);
mContext->Display(anAisSolid);
}