[TD]use correct property types and spinboxes for Section
This commit is contained in:
@@ -66,7 +66,6 @@
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <chrono>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
@@ -735,7 +734,7 @@ TopoDS_Compound DrawViewSection::findSectionPlaneIntersections(const TopoDS_Shap
|
||||
-m_shapeSize,
|
||||
m_shapeSize);
|
||||
BRepTools::Write(mkFace.Face(), "DVSSectionPlane.brep");// debug
|
||||
BRepTools::Write(shape, "DVSShapeToIntersect.brep)");
|
||||
BRepTools::Write(shape, "DVSShapeToIntersect.brep");
|
||||
}
|
||||
BRep_Builder builder;
|
||||
TopoDS_Compound result;
|
||||
@@ -759,10 +758,6 @@ TopoDS_Compound DrawViewSection::findSectionPlaneIntersections(const TopoDS_Shap
|
||||
// move section faces to line up with cut shape
|
||||
TopoDS_Compound DrawViewSection::alignSectionFaces(TopoDS_Shape faceIntersections)
|
||||
{
|
||||
// Base::Console().Message("DVS::alignSectionFaces() - %s -
|
||||
// faceIntersection.isnull: %d\n",
|
||||
// getNameInDocument(),
|
||||
// faceIntersections.IsNull());
|
||||
TopoDS_Compound sectionFaces;
|
||||
TopoDS_Shape centeredShape =
|
||||
ShapeUtils::moveShape(faceIntersections, getOriginalCentroid() * -1.0);
|
||||
@@ -773,6 +768,10 @@ TopoDS_Compound DrawViewSection::alignSectionFaces(TopoDS_Shape faceIntersection
|
||||
ShapeUtils::rotateShape(scaledSection, getProjectionCS(), Rotation.getValue());
|
||||
}
|
||||
|
||||
if (debugSection()) {
|
||||
BRepTools::Write(scaledSection, "DVSScaledSectionFaces.brep");
|
||||
}
|
||||
|
||||
return mapToPage(scaledSection);
|
||||
}
|
||||
|
||||
@@ -796,12 +795,23 @@ TopoDS_Compound DrawViewSection::mapToPage(TopoDS_Shape& shapeToAlign)
|
||||
TopExp_Explorer expFace(shapeToAlign, TopAbs_FACE);
|
||||
for (int iFace = 1; expFace.More(); expFace.Next(), iFace++) {
|
||||
const TopoDS_Face& face = TopoDS::Face(expFace.Current());
|
||||
if (debugSection()) {
|
||||
std::stringstream ss;
|
||||
ss << "DVSFace" << iFace << ".brep";
|
||||
BRepTools::Write(face, ss.str().c_str());// debug
|
||||
}
|
||||
|
||||
|
||||
std::vector<TopoDS_Wire> faceWires;
|
||||
TopExp_Explorer expWires(face, TopAbs_WIRE);
|
||||
for (; expWires.More(); expWires.Next()) {
|
||||
const TopoDS_Wire& wire = TopoDS::Wire(expWires.Current());
|
||||
TopoDS_Shape projectedShape =
|
||||
GeometryObject::projectSimpleShape(wire, getProjectionCS());
|
||||
TopoDS_Shape projectedShape = GeometryObject::projectSimpleShape(wire, getProjectionCS());
|
||||
if (debugSection()) {
|
||||
std::stringstream ss;
|
||||
ss << "DVSProjectedWire" << iFace << ".brep";
|
||||
BRepTools::Write(projectedShape, ss.str().c_str());// debug
|
||||
}
|
||||
std::vector<TopoDS_Edge> wireEdges;
|
||||
// projectedShape is just a bunch of edges. we have to rebuild the wire.
|
||||
TopExp_Explorer expEdges(projectedShape, TopAbs_EDGE);
|
||||
@@ -809,6 +819,7 @@ TopoDS_Compound DrawViewSection::mapToPage(TopoDS_Shape& shapeToAlign)
|
||||
const TopoDS_Edge& edge = TopoDS::Edge(expEdges.Current());
|
||||
wireEdges.push_back(edge);
|
||||
}
|
||||
|
||||
TopoDS_Wire cleanWire = EdgeWalker::makeCleanWire(wireEdges, 2.0 * EWTOLERANCE);
|
||||
faceWires.push_back(cleanWire);
|
||||
}
|
||||
@@ -1225,6 +1236,33 @@ void DrawViewSection::setupObject()
|
||||
DrawViewPart::setupObject();
|
||||
}
|
||||
|
||||
void DrawViewSection::handleChangedPropertyType(Base::XMLReader &reader, const char * TypeName, App::Property * prop)
|
||||
{
|
||||
if (prop == &SectionOrigin) {
|
||||
// SectionOrigin was PropertyVector but is now PropertyPosition
|
||||
App::PropertyVector tmp;
|
||||
if (strcmp(tmp.getTypeId().getName(), TypeName)==0) {
|
||||
tmp.setContainer(this);
|
||||
tmp.Restore(reader);
|
||||
auto tmpValue = tmp.getValue();
|
||||
SectionOrigin.setValue(tmpValue);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop == &SectionNormal) {
|
||||
// Radius was PropertyVector but is now PropertyDirection
|
||||
App::PropertyVector tmp;
|
||||
if (strcmp(tmp.getTypeId().getName(), TypeName)==0) {
|
||||
tmp.setContainer(this);
|
||||
tmp.Restore(reader);
|
||||
auto tmpValue = tmp.getValue();
|
||||
SectionNormal.setValue(tmpValue);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// hatch file routines
|
||||
|
||||
// create geometric hatch lines
|
||||
|
||||
Reference in New Issue
Block a user