[TD]detail of rotated ComplexSection

This commit is contained in:
wandererfan
2022-12-10 20:08:32 -05:00
committed by WandererFan
parent 02386e3150
commit 100d4956c8
11 changed files with 1541 additions and 1592 deletions

View File

@@ -175,7 +175,7 @@ TopoDS_Shape DrawComplexSection::getShapeToCut()
TopoDS_Shape DrawComplexSection::makeCuttingTool(double dMax)
{
// Base::Console().Message("DCS::makeCuttingTool()\n");
// Base::Console().Message("DCS::makeCuttingTool()\n");
TopoDS_Wire profileWire = makeProfileWire();
if (profileWire.IsNull()) {
throw Base::RuntimeError("Can not make wire from cutting tool (1)");
@@ -270,20 +270,22 @@ TopoDS_Shape DrawComplexSection::prepareShape(const TopoDS_Shape& cutShape, doub
return TopoDS_Shape();
}
TopoDS_Shape preparedShape = scaleShape(m_alignResult, getScale());
TopoDS_Shape centeredShape = TechDraw::centerShapeXY(m_alignResult, getProjectionCS());
// m_preparedShape = scaleShape(m_alignResult, getScale());
m_preparedShape = scaleShape(centeredShape, getScale());
if (!DrawUtil::fpCompare(Rotation.getValue(), 0.0)) {
preparedShape =
TechDraw::rotateShape(preparedShape, getProjectionCS(), Rotation.getValue());
m_preparedShape =
TechDraw::rotateShape(m_preparedShape, getProjectionCS(), Rotation.getValue());
}
return preparedShape;
return m_preparedShape;
}
void DrawComplexSection::makeSectionCut(TopoDS_Shape& baseShape)
{
// Base::Console().Message("DCS::makeSectionCut() - %s - baseShape.IsNull: %d\n",
// getNameInDocument(), baseShape.IsNull());
// Base::Console().Message("DCS::makeSectionCut() - %s - baseShape.IsNull: %d\n",
// getNameInDocument(), baseShape.IsNull());
if (ProjectionStrategy.getValue() == 0) {
//Offset. Use regular section behaviour
return DrawViewSection::makeSectionCut(baseShape);
@@ -325,7 +327,7 @@ void DrawComplexSection::onSectionCutFinished()
//TODO: this process should replace the "makeSectionCut" from DVS
void DrawComplexSection::makeAlignedPieces(const TopoDS_Shape& rawShape)
{
// Base::Console().Message("DCS::makeAlignedPieces() - rawShape.isNull: %d\n", rawShape.IsNull());
// Base::Console().Message("DCS::makeAlignedPieces() - rawShape.isNull: %d\n", rawShape.IsNull());
if (!canBuild(getSectionCS(), CuttingToolWireObject.getValue())) {
throw Base::RuntimeError("Profile is parallel to Section Normal");
@@ -641,6 +643,16 @@ TopoDS_Shape DrawComplexSection::getShapeToIntersect()
//Aligned
return m_preparedShape;
}
TopoDS_Shape DrawComplexSection::getShapeForDetail() const
{
if (ProjectionStrategy.getValue() == 0) {//Offset
return DrawViewSection::getShapeForDetail();
}
//Aligned
return m_preparedShape;
}
TopoDS_Wire DrawComplexSection::makeProfileWire() const
{
App::DocumentObject* toolObj = CuttingToolWireObject.getValue();
@@ -672,7 +684,7 @@ TopoDS_Wire DrawComplexSection::makeProfileWire(App::DocumentObject* toolObj)
gp_Vec DrawComplexSection::makeProfileVector(TopoDS_Wire profileWire)
{
// Base::Console().Message("DCS::makeProfileVector()\n");
// Base::Console().Message("DCS::makeProfileVector()\n");
TopoDS_Vertex tvFirst, tvLast;
TopExp::Vertices(profileWire, tvFirst, tvLast);
gp_Pnt gpFirst = BRep_Tool::Pnt(tvFirst);
@@ -1003,7 +1015,7 @@ bool DrawComplexSection::showSegment(gp_Dir segmentNormal) const
//Can we make a ComplexSection using this profile and sectionNormal?
bool DrawComplexSection::canBuild(gp_Ax2 sectionCS, App::DocumentObject* profileObject)
{
// Base::Console().Message("DCS::canBuild()\n");
// Base::Console().Message("DCS::canBuild()\n");
if (!isProfileObject(profileObject)) {
return false;
}

View File

@@ -50,32 +50,31 @@ public:
TopoDS_Shape makeCuttingTool(double dMax) override;
gp_Ax2 getCSFromBase(const std::string sectionName) const override;
bool isBaseValid() const override;
TopoDS_Compound findSectionPlaneIntersections(const TopoDS_Shape &cutShape) override;
TopoDS_Shape prepareShape(const TopoDS_Shape &cutShape, double shapeSize) override;
TopoDS_Compound findSectionPlaneIntersections(const TopoDS_Shape& cutShape) override;
TopoDS_Shape prepareShape(const TopoDS_Shape& cutShape, double shapeSize) override;
TopoDS_Shape getShapeToPrepare() const override;
TopoDS_Shape getShapeToIntersect() override;
gp_Pln getSectionPlane() const override;
TopoDS_Compound alignSectionFaces(TopoDS_Shape faceIntersections) override;
std::pair<Base::Vector3d, Base::Vector3d> sectionLineEnds() override;
void makeSectionCut(TopoDS_Shape &baseShape) override;
void makeSectionCut(TopoDS_Shape& baseShape) override;
void waitingForAlign(bool s) { m_waitingForAlign = s; }
bool waitingForAlign(void) const { return m_waitingForAlign; }
TopoDS_Shape getShapeForDetail() const override;
public Q_SLOTS:
void onSectionCutFinished(void) override;
bool boxesIntersect(TopoDS_Face &face, TopoDS_Shape &shape);
TopoDS_Shape shapeShapeIntersect(const TopoDS_Shape &shape0, const TopoDS_Shape &shape1);
std::vector<TopoDS_Face> faceShapeIntersect(const TopoDS_Face &face, const TopoDS_Shape &shape);
TopoDS_Shape extrudeWireToFace(TopoDS_Wire &wire, gp_Dir extrudeDir, double extrudeDist);
// void makeAlignedPieces(const TopoDS_Shape &rawShape, const TopoDS_Shape &toolFaceShape,
// double extrudeDistance);
void makeAlignedPieces(const TopoDS_Shape &rawShape);
TopoDS_Compound singleToolIntersections(const TopoDS_Shape &cutShape);
TopoDS_Compound alignedToolIntersections(const TopoDS_Shape &cutShape);
bool boxesIntersect(TopoDS_Face& face, TopoDS_Shape& shape);
TopoDS_Shape shapeShapeIntersect(const TopoDS_Shape& shape0, const TopoDS_Shape& shape1);
std::vector<TopoDS_Face> faceShapeIntersect(const TopoDS_Face& face, const TopoDS_Shape& shape);
TopoDS_Shape extrudeWireToFace(TopoDS_Wire& wire, gp_Dir extrudeDir, double extrudeDist);
void makeAlignedPieces(const TopoDS_Shape& rawShape);
TopoDS_Compound singleToolIntersections(const TopoDS_Shape& cutShape);
TopoDS_Compound alignedToolIntersections(const TopoDS_Shape& cutShape);
BaseGeomPtrVector makeSectionLineGeometry();
std::pair<Base::Vector3d, Base::Vector3d> sectionArrowDirs();
@@ -84,33 +83,34 @@ public Q_SLOTS:
ChangePointVector getChangePointsFromSectionLine() override;
bool validateProfilePosition(TopoDS_Wire profileWire, gp_Ax2 sectionCS,
gp_Dir &gClosestBasis) const;
gp_Dir& gClosestBasis) const;
bool showSegment(gp_Dir segmentNormal) const;
gp_Vec projectVector(const gp_Vec& vec) const;
TopoDS_Wire makeProfileWire() const;
static TopoDS_Wire makeProfileWire(App::DocumentObject *toolObj);
static TopoDS_Wire makeProfileWire(App::DocumentObject* toolObj);
static TopoDS_Wire makeNoseToTailWire(TopoDS_Wire inWire);
static gp_Vec makeProfileVector(TopoDS_Wire profileWire);
static bool isProfileObject(App::DocumentObject *obj);
static bool isMultiSegmentProfile(App::DocumentObject *obj);
static bool isLinearProfile(App::DocumentObject *obj);
static bool isProfileObject(App::DocumentObject* obj);
static bool isMultiSegmentProfile(App::DocumentObject* obj);
static bool isLinearProfile(App::DocumentObject* obj);
static bool isTrulyEmpty(TopoDS_Shape inShape);
static bool canBuild(gp_Ax2 sectionCS, App::DocumentObject* profileObject);
static gp_Vec projectVector(const gp_Vec& vec, gp_Ax2 sectionCS);
private:
gp_Dir getFaceNormal(TopoDS_Face &face);
gp_Dir getFaceNormal(TopoDS_Face& face);
TopoDS_Shape m_toolFaceShape;
TopoDS_Shape m_alignResult;
TopoDS_Shape m_preparedShape;//saved for detail views
QMetaObject::Connection connectAlignWatcher;
QFutureWatcher<void> m_alignWatcher;
QFuture<void> m_alignFuture;
bool m_waitingForAlign;
static const char *ProjectionStrategyEnums[];
static const char* ProjectionStrategyEnums[];
};
using DrawComplexSectionPython = App::FeaturePythonT<DrawComplexSection>;

View File

@@ -23,30 +23,30 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <QtConcurrentRun>
# include <sstream>
# include <Bnd_Box.hxx>
# include <BRepAlgoAPI_Common.hxx>
# include <BRepBndLib.hxx>
# include <BRepBuilderAPI_Copy.hxx>
# include <BRepBuilderAPI_MakeFace.hxx>
# include <BRep_Builder.hxx>
# include <BRepPrimAPI_MakeCylinder.hxx>
# include <BRepPrimAPI_MakePrism.hxx>
# include <BRepProj_Projection.hxx>
# include <BRepTools.hxx>
# include <gp_Ax2.hxx>
# include <gp_Dir.hxx>
# include <gp_Pln.hxx>
# include <gp_Pnt.hxx>
# include <TopExp_Explorer.hxx>
# include <TopoDS_Compound.hxx>
# include <TopoDS_Edge.hxx>
# include <TopoDS_Face.hxx>
# include <TopoDS.hxx>
# include <TopoDS_Shape.hxx>
# include <TopoDS_Shell.hxx>
# include <TopoDS_Solid.hxx>
#include <BRepAlgoAPI_Common.hxx>
#include <BRepBndLib.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx>
#include <BRepPrimAPI_MakePrism.hxx>
#include <BRepProj_Projection.hxx>
#include <BRepTools.hxx>
#include <BRep_Builder.hxx>
#include <Bnd_Box.hxx>
#include <QtConcurrentRun>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Solid.hxx>
#include <gp_Ax2.hxx>
#include <gp_Dir.hxx>
#include <gp_Pln.hxx>
#include <gp_Pnt.hxx>
#include <sstream>
#endif
#include <App/Application.h>
@@ -54,8 +54,9 @@
#include <Base/Console.h>
#include <Base/Parameter.h>
#include "DrawViewDetail.h"
#include "DrawComplexSection.h"
#include "DrawUtil.h"
#include "DrawViewDetail.h"
#include "DrawViewSection.h"
#include "GeometryObject.h"
#include "Preferences.h"
@@ -69,26 +70,25 @@ using namespace TechDraw;
PROPERTY_SOURCE(TechDraw::DrawViewDetail, TechDraw::DrawViewPart)
DrawViewDetail::DrawViewDetail() :
m_waitingForDetail(false),
m_saveDvp(nullptr),
m_saveDvs(nullptr)
DrawViewDetail::DrawViewDetail() : m_waitingForDetail(false), m_saveDvp(nullptr), m_saveDvs(nullptr)
{
static const char *dgroup = "Detail";
static const char* dgroup = "Detail";
ADD_PROPERTY_TYPE(BaseView ,(nullptr), dgroup, App::Prop_None, "2D View source for this Section");
ADD_PROPERTY_TYPE(BaseView, (nullptr), dgroup, App::Prop_None,
"2D View source for this Section");
BaseView.setScope(App::LinkScope::Global);
ADD_PROPERTY_TYPE(AnchorPoint ,(0, 0,0) ,dgroup, App::Prop_None, "Location of detail in BaseView");
ADD_PROPERTY_TYPE(AnchorPoint, (0, 0, 0), dgroup, App::Prop_None,
"Location of detail in BaseView");
ADD_PROPERTY_TYPE(Radius, (10.0), dgroup, App::Prop_None, "Size of detail area");
ADD_PROPERTY_TYPE(Reference ,("1"), dgroup, App::Prop_None, "An identifier for this detail");
ADD_PROPERTY_TYPE(Reference, ("1"), dgroup, App::Prop_None, "An identifier for this detail");
getParameters();
m_fudge = 1.01;
//hide Properties not relevant to DVDetail
Direction.setStatus(App::Property::ReadOnly, true); //Should be same as BaseView
Rotation.setStatus(App::Property::ReadOnly, true); //same as BaseView
ScaleType.setValue("Custom"); //dvd uses scale from BaseView
Direction.setStatus(App::Property::ReadOnly, true);//Should be same as BaseView
Rotation.setStatus(App::Property::ReadOnly, true); //same as BaseView
ScaleType.setValue("Custom"); //dvd uses scale from BaseView
}
DrawViewDetail::~DrawViewDetail()
@@ -106,10 +106,8 @@ short DrawViewDetail::mustExecute() const
TechDraw::DrawView::mustExecute();
}
if (AnchorPoint.isTouched() ||
Radius.isTouched() ||
BaseView.isTouched() ||
Reference.isTouched()) {
if (AnchorPoint.isTouched() || Radius.isTouched() || BaseView.isTouched()
|| Reference.isTouched()) {
return 1;
}
@@ -124,16 +122,13 @@ void DrawViewDetail::onChanged(const App::Property* prop)
}
if (prop == &Reference) {
std::string lblText = "Detail " +
std::string(Reference.getValue());
std::string lblText = "Detail " + std::string(Reference.getValue());
Label.setValue(lblText);
}
if (prop == &Reference ||
prop == &Radius ||
prop == &BaseView) {
if (prop == &Reference || prop == &Radius || prop == &BaseView) {
requestPaint();
}
if (prop == &AnchorPoint) {
if (prop == &AnchorPoint) {
// to see AnchorPoint changes repainting is not enough, we must recompute
recomputeFeature(true);
}
@@ -141,15 +136,15 @@ void DrawViewDetail::onChanged(const App::Property* prop)
DrawViewPart::onChanged(prop);
}
App::DocumentObjectExecReturn *DrawViewDetail::execute()
App::DocumentObjectExecReturn* DrawViewDetail::execute()
{
// Base::Console().Message("DVD::execute() - %s\n", getNameInDocument());
// Base::Console().Message("DVD::execute() - %s\n", getNameInDocument());
if (!keepUpdated()) {
return DrawView::execute();
}
App::DocumentObject* baseObj = BaseView.getValue();
if (!baseObj) {
if (!baseObj) {
return DrawView::execute();
}
@@ -159,15 +154,18 @@ App::DocumentObjectExecReturn *DrawViewDetail::execute()
}
DrawViewPart* dvp = static_cast<DrawViewPart*>(baseObj);
TopoDS_Shape shape = dvp->getShapeForDetail();
DrawViewSection* dvs = nullptr;
TopoDS_Shape shape;
if (dvp->isDerivedFrom(TechDraw::DrawViewSection::getClassTypeId())) {
dvs= static_cast<TechDraw::DrawViewSection*>(dvp);
shape = dvs->getCutShape();
} else {
//getSourceShapeFused will complain if called on section
shape = dvp->getSourceShapeFused();
dvs = static_cast<TechDraw::DrawViewSection*>(dvp);
}
// TopoDS_Shape shape;
// shape = dvs->getCutShape();
// }
// else {
// //getSourceShapeFused will complain if called on section
// shape = dvp->getSourceShapeFused();
// }
if (shape.IsNull()) {
return DrawView::execute();
@@ -178,33 +176,31 @@ App::DocumentObjectExecReturn *DrawViewDetail::execute()
//block touch/onChanged stuff
Base::Vector3d newX = getXDirection();
XDirection.setValue(newX);
XDirection.purgeTouched(); //don't trigger updates!
XDirection.purgeTouched();//don't trigger updates!
//unblock
}
detailExec(shape, dvp, dvs);
addShapes2d();
dvp->requestPaint(); //to refresh detail highlight in base view
dvp->requestPaint();//to refresh detail highlight in base view
return DrawView::execute();
}
//try to create a detail of the solids & shells in shape
//if there are no solids/shells in shape, use the edges in shape
void DrawViewDetail::detailExec(TopoDS_Shape& shape,
DrawViewPart* dvp,
DrawViewSection* dvs)
void DrawViewDetail::detailExec(TopoDS_Shape& shape, DrawViewPart* dvp, DrawViewSection* dvs)
{
if (waitingForHlr() ||
waitingForDetail()) {
if (waitingForHlr() || waitingForDetail()) {
return;
}
//note that &m_detailWatcher in the third parameter is not strictly required, but using the
//4 parameter signature instead of the 3 parameter signature prevents clazy warning:
//https://github.com/KDE/clazy/blob/1.11/docs/checks/README-connect-3arg-lambda.md
connectDetailWatcher = QObject::connect(&m_detailWatcher, &QFutureWatcherBase::finished,
&m_detailWatcher, [this] { this->onMakeDetailFinished(); });
connectDetailWatcher =
QObject::connect(&m_detailWatcher, &QFutureWatcherBase::finished, &m_detailWatcher,
[this] { this->onMakeDetailFinished(); });
m_detailFuture = QtConcurrent::run(this, &DrawViewDetail::makeDetailShape, shape, dvp, dvs);
m_detailWatcher.setFuture(m_detailFuture);
waitingForDetail(true);
@@ -213,9 +209,7 @@ void DrawViewDetail::detailExec(TopoDS_Shape& shape,
//this runs in a separate thread since it can sometimes take a long time
//make a common of the input shape and a cylinder (or prism depending on
//the matting style)
void DrawViewDetail::makeDetailShape(TopoDS_Shape& shape,
DrawViewPart* dvp,
DrawViewSection* dvs)
void DrawViewDetail::makeDetailShape(TopoDS_Shape& shape, DrawViewPart* dvp, DrawViewSection* dvs)
{
showProgressMessage(getNameInDocument(), "is making detail shape");
@@ -232,30 +226,33 @@ void DrawViewDetail::makeDetailShape(TopoDS_Shape& shape,
m_saveDvp = dvp;
m_saveDvs = dvs;
gp_Pnt gpCenter = TechDraw::findCentroid(copyShape,
dirDetail);
gp_Pnt gpCenter = TechDraw::findCentroid(copyShape, dirDetail);
Base::Vector3d shapeCenter = Base::Vector3d(gpCenter.X(), gpCenter.Y(), gpCenter.Z());
m_saveCentroid = shapeCenter; //centroid of original shape
m_saveCentroid = shapeCenter;//centroid of original shape
if (!dvs) {
//section cutShape should already be on origin
copyShape = TechDraw::moveShape(copyShape, //centre shape on origin
-shapeCenter);
copyShape = TechDraw::moveShape(copyShape,//centre shape on origin
-shapeCenter);
}
shapeCenter = Base::Vector3d(0.0, 0.0, 0.0);
m_viewAxis = dvp->getProjectionCS(shapeCenter); //save the CS for later
Base::Vector3d anchor = AnchorPoint.getValue(); //this is a 2D point in unrotated base view coords
anchor = DrawUtil::toR3(m_viewAxis, anchor); //actual anchor coords in R3
m_viewAxis = dvp->getProjectionCS(shapeCenter);//save the CS for later
Base::Vector3d anchor = AnchorPoint.getValue();//this is a 2D point in base view local coords
// double baseRotationRad = dvp->Rotation.getValue() * M_PI / 180.0;
// anchor.RotateZ(baseRotationRad);
anchor = DrawUtil::toR3(m_viewAxis, anchor);//actual anchor coords in R3
Bnd_Box bbxSource;
bbxSource.SetGap(0.0);
BRepBndLib::AddOptimal(copyShape, bbxSource);
double diag = sqrt(bbxSource.SquareExtent());
Base::Vector3d toolPlaneOrigin = anchor + dirDetail * diag * -1.0; //center tool about anchor
Base::Vector3d toolPlaneOrigin = anchor + dirDetail * diag * -1.0;//center tool about anchor
double extrudeLength = 2.0 * toolPlaneOrigin.Length();
gp_Pnt gpnt(toolPlaneOrigin.x, toolPlaneOrigin.y, toolPlaneOrigin.z);
@@ -270,22 +267,26 @@ void DrawViewDetail::makeDetailShape(TopoDS_Shape& shape,
gp_Pln gpln(gpnt, gdir);
BRepBuilderAPI_MakeFace mkFace(gpln, -radius, radius, -radius, radius);
extrusionFace = mkFace.Face();
if(extrusionFace.IsNull()) {
Base::Console().Warning("DVD::makeDetailShape - %s - failed to create tool base face\n", getNameInDocument());
if (extrusionFace.IsNull()) {
Base::Console().Warning("DVD::makeDetailShape - %s - failed to create tool base face\n",
getNameInDocument());
return;
}
tool = BRepPrimAPI_MakePrism(extrusionFace, extrudeDir, false, true).Shape();
if(tool.IsNull()) {
Base::Console().Warning("DVD::makeDetailShape - %s - failed to create tool (prism)\n", getNameInDocument());
if (tool.IsNull()) {
Base::Console().Warning("DVD::makeDetailShape - %s - failed to create tool (prism)\n",
getNameInDocument());
return;
}
} else {
}
else {
//circular mat
gp_Ax2 cs(gpnt, gdir);
BRepPrimAPI_MakeCylinder mkTool(cs, radius, extrudeLength);
tool = mkTool.Shape();
if(tool.IsNull()) {
Base::Console().Warning("DVD::detailExec - %s - failed to create tool (cylinder)\n", getNameInDocument());
if (tool.IsNull()) {
Base::Console().Warning("DVD::detailExec - %s - failed to create tool (cylinder)\n",
getNameInDocument());
return;
}
}
@@ -296,7 +297,7 @@ void DrawViewDetail::makeDetailShape(TopoDS_Shape& shape,
BRep_Builder builder;
TopoDS_Compound pieces;
builder.MakeCompound(pieces);
if (solidCount > 0) {
if (solidCount > 0) {
TopExp_Explorer expl(copyShape, TopAbs_SOLID);
for (; expl.More(); expl.Next()) {
const TopoDS_Solid& s = TopoDS::Solid(expl.Current());
@@ -343,56 +344,48 @@ void DrawViewDetail::makeDetailShape(TopoDS_Shape& shape,
}
if (debugDetail()) {
BRepTools::Write(tool, "DVDTool.brep"); //debug
BRepTools::Write(copyShape, "DVDCopy.brep"); //debug
BRepTools::Write(pieces, "DVDCommon.brep"); //debug
BRepTools::Write(tool, "DVDTool.brep"); //debug
BRepTools::Write(copyShape, "DVDCopy.brep");//debug
BRepTools::Write(pieces, "DVDCommon.brep"); //debug
}
gp_Pnt inputCenter;
try {
//centroid of result
inputCenter = TechDraw::findCentroid(pieces,
dirDetail);
Base::Vector3d centroid(inputCenter.X(),
inputCenter.Y(),
inputCenter.Z());
m_saveCentroid += centroid; //center of massaged shape
inputCenter = TechDraw::findCentroid(pieces, dirDetail);
Base::Vector3d centroid(inputCenter.X(), inputCenter.Y(), inputCenter.Z());
m_saveCentroid += centroid;//center of massaged shape
if ((solidCount > 0) ||
(shellCount > 0)) {
if ((solidCount > 0) || (shellCount > 0)) {
//align shape with detail anchor
TopoDS_Shape centeredShape = TechDraw::moveShape(pieces,
anchor * -1.0);
m_scaledShape = TechDraw::scaleShape(centeredShape,
getScale());
TopoDS_Shape centeredShape = TechDraw::moveShape(pieces, anchor * -1.0);
m_scaledShape = TechDraw::scaleShape(centeredShape, getScale());
if (debugDetail()) {
BRepTools::Write(m_scaledShape, "DVDScaled.brep"); //debug
BRepTools::Write(m_scaledShape, "DVDScaled.brep");//debug
}
} else {
}
else {
//no solids, no shells, do what you can with edges
TopoDS_Shape projectedEdges = projectEdgesOntoFace(copyShape, extrusionFace, gdir);
TopoDS_Shape centeredShape = TechDraw::moveShape(projectedEdges,
anchor * -1.0);
TopoDS_Shape centeredShape = TechDraw::moveShape(projectedEdges, anchor * -1.0);
if (debugDetail()) {
BRepTools::Write(projectedEdges, "DVDProjectedEdges.brep"); //debug
BRepTools::Write(centeredShape, "DVDCenteredShape.brep"); //debug
BRepTools::Write(projectedEdges, "DVDProjectedEdges.brep");//debug
BRepTools::Write(centeredShape, "DVDCenteredShape.brep"); //debug
}
m_scaledShape = TechDraw::scaleShape(centeredShape,
getScale());
m_scaledShape = TechDraw::scaleShape(centeredShape, getScale());
}
Base::Vector3d stdOrg(0.0, 0.0, 0.0);
m_viewAxis = dvp->getProjectionCS(stdOrg);
if (!DrawUtil::fpCompare(Rotation.getValue(), 0.0)) {
m_scaledShape = TechDraw::rotateShape(m_scaledShape,
m_viewAxis,
Rotation.getValue());
m_scaledShape = TechDraw::rotateShape(m_scaledShape, m_viewAxis, Rotation.getValue());
}
} //end try block
}//end try block
catch (Standard_Failure& e1) {
Base::Console().Message("DVD::makeDetailShape - failed to create detail %s - %s **\n", getNameInDocument(), e1.GetMessageString());
Base::Console().Message("DVD::makeDetailShape - failed to create detail %s - %s **\n",
getNameInDocument(), e1.GetMessageString());
return;
}
@@ -401,11 +394,12 @@ void DrawViewDetail::makeDetailShape(TopoDS_Shape& shape,
void DrawViewDetail::postHlrTasks(void)
{
// Base::Console().Message("DVD::postHlrTasks()\n");
// Base::Console().Message("DVD::postHlrTasks()\n");
DrawViewPart::postHlrTasks();
geometryObject->pruneVertexGeom(Base::Vector3d(0.0, 0.0, 0.0),
Radius.getValue() * getScale()); //remove vertices beyond clipradius
Radius.getValue()
* getScale());//remove vertices beyond clipradius
//second pass if required
if (ScaleType.isValue("Automatic") && !checkFit()) {
@@ -424,28 +418,24 @@ void DrawViewDetail::onMakeDetailFinished(void)
QObject::disconnect(connectDetailWatcher);
//ancestor's buildGeometryObject will run HLR and face finding in a separate thread
m_tempGeometryObject = buildGeometryObject(m_scaledShape, m_viewAxis);
m_tempGeometryObject = buildGeometryObject(m_scaledShape, m_viewAxis);
}
bool DrawViewDetail::waitingForResult() const
{
if (DrawViewPart::waitingForResult() ||
waitingForDetail()) {
if (DrawViewPart::waitingForResult() || waitingForDetail()) {
return true;
}
return false;
}
TopoDS_Shape DrawViewDetail::projectEdgesOntoFace(TopoDS_Shape &edgeShape,
TopoDS_Face &projFace,
TopoDS_Shape DrawViewDetail::projectEdgesOntoFace(TopoDS_Shape& edgeShape, TopoDS_Face& projFace,
gp_Dir& projDir)
{
BRep_Builder builder;
TopoDS_Compound edges;
builder.MakeCompound(edges);
TopExp_Explorer Ex(edgeShape, TopAbs_EDGE);
while (Ex.More())
{
while (Ex.More()) {
TopoDS_Edge e = TopoDS::Edge(Ex.Current());
BRepProj_Projection mkProj(e, projFace, projDir);
if (mkProj.IsDone()) {
@@ -454,7 +444,7 @@ TopoDS_Shape DrawViewDetail::projectEdgesOntoFace(TopoDS_Shape &edgeShape,
Ex.Next();
}
if (debugDetail()) {
BRepTools::Write(edges, "DVDEdges.brep"); //debug
BRepTools::Write(edges, "DVDEdges.brep");//debug
}
return TopoDS_Shape(std::move(edges));
@@ -467,22 +457,22 @@ std::vector<DrawViewDetail*> DrawViewDetail::getDetailRefs() const
return std::vector<DrawViewDetail*>();
}
double DrawViewDetail::getFudgeRadius()
{
return Radius.getValue() * m_fudge;
}
double DrawViewDetail::getFudgeRadius() { return Radius.getValue() * m_fudge; }
bool DrawViewDetail::debugDetail() const
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/debug");
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
.GetUserParameter()
.GetGroup("BaseApp")
->GetGroup("Preferences")
->GetGroup("Mod/TechDraw/debug");
return hGrp->GetBool("debugDetail", false);
}
void DrawViewDetail::unsetupObject()
{
// Base::Console().Message("DVD::unsetupObject()\n");
// Base::Console().Message("DVD::unsetupObject()\n");
App::DocumentObject* baseObj = BaseView.getValue();
DrawView* base = dynamic_cast<DrawView*>(baseObj);
if (base) {
@@ -490,20 +480,20 @@ void DrawViewDetail::unsetupObject()
}
}
void DrawViewDetail::getParameters()
{
}
void DrawViewDetail::getParameters() {}
// Python Drawing feature ---------------------------------------------------------
namespace App {
namespace App
{
/// @cond DOXERR
PROPERTY_SOURCE_TEMPLATE(TechDraw::DrawViewDetailPython, TechDraw::DrawViewDetail)
template<> const char* TechDraw::DrawViewDetailPython::getViewProviderName() const {
template<> const char* TechDraw::DrawViewDetailPython::getViewProviderName() const
{
return "TechDrawGui::ViewProviderViewPart";
}
/// @endcond
// explicit template instantiation
template class TechDrawExport FeaturePythonT<TechDraw::DrawViewDetail>;
}
}// namespace App

File diff suppressed because it is too large Load Diff

View File

@@ -37,8 +37,8 @@
#include <Base/BoundBox.h>
#include <Mod/TechDraw/TechDrawGlobal.h>
#include "DrawView.h"
#include "CosmeticExtension.h"
#include "DrawView.h"
class gp_Pnt;
@@ -58,9 +58,10 @@ using GeometryObjectPtr = std::shared_ptr<GeometryObject>;
class Vertex;
class BaseGeom;
class Face;
}
}// namespace TechDraw
namespace TechDraw {
namespace TechDraw
{
class DrawHatch;
class DrawGeomHatch;
class DrawViewDimension;
@@ -72,14 +73,14 @@ class CosmeticVertex;
class CosmeticEdge;
class CenterLine;
class GeomFormat;
}
}// namespace TechDraw
namespace TechDraw
{
class DrawViewSection;
class TechDrawExport DrawViewPart : public DrawView, public CosmeticExtension
class TechDrawExport DrawViewPart: public DrawView, public CosmeticExtension
{
PROPERTY_HEADER_WITH_EXTENSIONS(TechDraw::DrawViewPart);
@@ -87,32 +88,31 @@ public:
DrawViewPart();
~DrawViewPart() override;
App::PropertyLinkList Source;
App::PropertyXLinkList XSource;
App::PropertyVector Direction; //TODO: Rename to YAxisDirection or whatever this actually is (ProjectionDirection)
App::PropertyVector XDirection;
App::PropertyBool Perspective;
App::PropertyDistance Focus;
App::PropertyLinkList Source;
App::PropertyXLinkList XSource;
App::PropertyVector
Direction;//TODO: Rename to YAxisDirection or whatever this actually is (ProjectionDirection)
App::PropertyVector XDirection;
App::PropertyBool Perspective;
App::PropertyDistance Focus;
App::PropertyBool CoarseView;
App::PropertyBool SeamVisible;
App::PropertyBool SmoothVisible;
App::PropertyBool CoarseView;
App::PropertyBool SeamVisible;
App::PropertyBool SmoothVisible;
//App::PropertyBool OutlinesVisible;
App::PropertyBool IsoVisible;
App::PropertyBool IsoVisible;
App::PropertyBool HardHidden;
App::PropertyBool SmoothHidden;
App::PropertyBool SeamHidden;
App::PropertyBool HardHidden;
App::PropertyBool SmoothHidden;
App::PropertyBool SeamHidden;
//App::PropertyBool OutlinesHidden;
App::PropertyBool IsoHidden;
App::PropertyInteger IsoCount;
App::PropertyBool IsoHidden;
App::PropertyInteger IsoCount;
short mustExecute() const override;
App::DocumentObjectExecReturn *execute() override;
const char* getViewProviderName() const override {
return "TechDrawGui::ViewProviderViewPart";
}
PyObject *getPyObject() override;
App::DocumentObjectExecReturn* execute() override;
const char* getViewProviderName() const override { return "TechDrawGui::ViewProviderViewPart"; }
PyObject* getPyObject() override;
std::vector<TechDraw::DrawHatch*> getHatches() const;
std::vector<TechDraw::DrawGeomHatch*> getGeomHatches() const;
@@ -127,34 +127,35 @@ public:
bool hasGeometry() const;
TechDraw::GeometryObjectPtr getGeometryObject() const { return geometryObject; }
TechDraw::BaseGeomPtr getGeomByIndex(int idx) const; //get existing geom for edge idx in projection
TechDraw::VertexPtr getProjVertexByIndex(int idx) const; //get existing geom for vertex idx in projection
TechDraw::BaseGeomPtr
getGeomByIndex(int idx) const;//get existing geom for edge idx in projection
TechDraw::VertexPtr
getProjVertexByIndex(int idx) const;//get existing geom for vertex idx in projection
TechDraw::VertexPtr getProjVertexByCosTag(std::string cosTag);
std::vector<TechDraw::BaseGeomPtr> getFaceEdgesByIndex(int idx) const; //get edges for face idx in projection
std::vector<TechDraw::BaseGeomPtr>
getFaceEdgesByIndex(int idx) const;//get edges for face idx in projection
virtual Base::BoundBox3d getBoundingBox() const;
double getBoxX() const;
double getBoxY() const;
QRectF getRect() const override;
virtual std::vector<DrawViewSection*> getSectionRefs() const; //are there ViewSections based on this ViewPart?
virtual std::vector<DrawViewSection*>
getSectionRefs() const;//are there ViewSections based on this ViewPart?
virtual std::vector<DrawViewDetail*> getDetailRefs() const;
virtual Base::Vector3d projectPoint(const Base::Vector3d& pt,
bool invert = true) const;
virtual Base::Vector3d projectPoint(const Base::Vector3d& pt, bool invert = true) const;
virtual BaseGeomPtr projectEdge(const TopoDS_Edge& e) const;
virtual BaseGeomPtrVector projectWire(const TopoDS_Wire& inWire) const;
virtual gp_Ax2 getViewAxis(const Base::Vector3d& pt,
const Base::Vector3d& direction,
const bool flip=true) const;
virtual gp_Ax2 getViewAxis(const Base::Vector3d& pt, const Base::Vector3d& direction,
const bool flip = true) const;
virtual gp_Ax2 getProjectionCS(Base::Vector3d pt = Base::Vector3d(0.0, 0.0, 0.0)) const;
virtual Base::Vector3d getXDirection() const; //don't use XDirection.getValue()
virtual Base::Vector3d getXDirection() const;//don't use XDirection.getValue()
virtual Base::Vector3d getOriginalCentroid() const;
virtual Base::Vector3d getCurrentCentroid() const;
virtual Base::Vector3d getLegacyX(const Base::Vector3d& pt,
const Base::Vector3d& axis,
const bool flip = true) const;
virtual Base::Vector3d getLegacyX(const Base::Vector3d& pt, const Base::Vector3d& axis,
const bool flip = true) const;
gp_Ax2 localVectorToCS(const Base::Vector3d localUnit) const;
Base::Vector3d localVectorToDirection(const Base::Vector3d localUnit) const;
@@ -168,6 +169,7 @@ public:
virtual TopoDS_Shape getSourceShape() const;
virtual TopoDS_Shape getSourceShapeFused() const;
virtual std::vector<TopoDS_Shape> getSourceShape2d() const;
virtual TopoDS_Shape getShapeForDetail() const;
TopoDS_Shape getShape() const;
double getSizeAlongVector(Base::Vector3d alignmentVector);
@@ -209,7 +211,7 @@ public:
std::vector<App::DocumentObject*> getAllSources() const;
bool waitingForFaces() const { return m_waitingForFaces; }
void waitingForFaces(bool s) { m_waitingForFaces = s;}
void waitingForFaces(bool s) { m_waitingForFaces = s; }
bool waitingForHlr() const { return m_waitingForHlr; }
void waitingForHlr(bool s) { m_waitingForHlr = s; }
virtual bool waitingForResult() const;
@@ -224,14 +226,15 @@ protected:
bool checkXDirection() const;
TechDraw::GeometryObjectPtr geometryObject;
TechDraw::GeometryObjectPtr m_tempGeometryObject; //holds the new GO until hlr is completed
TechDraw::GeometryObjectPtr m_tempGeometryObject;//holds the new GO until hlr is completed
Base::BoundBox3d bbox;
void onChanged(const App::Property* prop) override;
void unsetupObject() override;
virtual TechDraw::GeometryObjectPtr buildGeometryObject(TopoDS_Shape& shape, const gp_Ax2& viewAxis);
virtual TechDraw::GeometryObjectPtr makeGeometryForShape(TopoDS_Shape& shape); //const??
virtual TechDraw::GeometryObjectPtr buildGeometryObject(TopoDS_Shape& shape,
const gp_Ax2& viewAxis);
virtual TechDraw::GeometryObjectPtr makeGeometryForShape(TopoDS_Shape& shape);//const??
void partExec(TopoDS_Shape& shape);
virtual void addShapes2d(void);
@@ -242,10 +245,11 @@ protected:
bool m_handleFaces;
TopoDS_Shape m_saveShape; //TODO: make this a Property. Part::TopoShapeProperty??
Base::Vector3d m_saveCentroid; //centroid before centering shape in origin
TopoDS_Shape m_saveShape; //TODO: make this a Property. Part::TopoShapeProperty??
Base::Vector3d m_saveCentroid;//centroid before centering shape in origin
void handleChangedPropertyName(Base::XMLReader &reader, const char* TypeName, const char* PropName) override;
void handleChangedPropertyName(Base::XMLReader& reader, const char* TypeName,
const char* PropName) override;
bool prefHardViz();
bool prefSeamViz();
@@ -255,7 +259,7 @@ protected:
bool prefSeamHid();
bool prefSmoothHid();
bool prefIsoHid();
int prefIsoCount();
int prefIsoCount();
std::vector<TechDraw::VertexPtr> m_referenceVerts;
@@ -270,11 +274,10 @@ private:
QMetaObject::Connection connectFaceWatcher;
QFutureWatcher<void> m_faceWatcher;
QFuture<void> m_faceFuture;
};
using DrawViewPartPython = App::FeaturePythonT<DrawViewPart>;
} //namespace TechDraw
}//namespace TechDraw
#endif // #ifndef DrawViewPart_h_
#endif// #ifndef DrawViewPart_h_

File diff suppressed because it is too large Load Diff

View File

@@ -25,9 +25,9 @@
#ifndef DrawViewSection_h_
#define DrawViewSection_h_
#include <gp_Ax2.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Shape.hxx>
#include <gp_Ax2.hxx>
#include <App/DocumentObject.h>
#include <App/FeaturePython.h>
@@ -80,7 +80,7 @@ private:
using ChangePointVector = std::vector<ChangePoint>;
class TechDrawExport DrawViewSection : public DrawViewPart
class TechDrawExport DrawViewSection: public DrawViewPart
{
PROPERTY_HEADER_WITH_OVERRIDE(Part::DrawViewSection);
@@ -88,39 +88,40 @@ public:
DrawViewSection();
~DrawViewSection() override;
App::PropertyLink BaseView;
App::PropertyLink BaseView;
App::PropertyVector SectionNormal;
App::PropertyVector SectionOrigin;
App::PropertyString SectionSymbol;
App::PropertyEnumeration SectionDirection; //to be made obsolete eventually
App::PropertyEnumeration CutSurfaceDisplay; //new v019
App::PropertyFile FileHatchPattern;
App::PropertyFile FileGeomPattern; //new v019
App::PropertyEnumeration SectionDirection; //to be made obsolete eventually
App::PropertyEnumeration CutSurfaceDisplay;//new v019
App::PropertyFile FileHatchPattern;
App::PropertyFile FileGeomPattern;//new v019
App::PropertyFileIncluded SvgIncluded;
App::PropertyFileIncluded PatIncluded;
App::PropertyString NameGeomPattern;
App::PropertyFloat HatchScale;
App::PropertyFloat HatchRotation;
App::PropertyFloat HatchScale;
App::PropertyFloat HatchRotation;
App::PropertyVector HatchOffset;
App::PropertyBool FuseBeforeCut;
App::PropertyBool TrimAfterCut; //new v021
App::PropertyBool FuseBeforeCut;
App::PropertyBool TrimAfterCut;//new v021
bool isReallyInBox (const Base::Vector3d v, const Base::BoundBox3d bb) const;
bool isReallyInBox (const gp_Pnt p, const Bnd_Box& bb) const;
bool isReallyInBox(const Base::Vector3d v, const Base::BoundBox3d bb) const;
bool isReallyInBox(const gp_Pnt p, const Bnd_Box& bb) const;
App::DocumentObjectExecReturn *execute() override;
App::DocumentObjectExecReturn* execute() override;
void onChanged(const App::Property* prop) override;
const char* getViewProviderName() const override {
const char* getViewProviderName() const override
{
return "TechDrawGui::ViewProviderViewSection";
}
void unsetupObject() override;
short mustExecute() const override;
void sectionExec(TopoDS_Shape& s);
virtual void makeSectionCut(TopoDS_Shape &baseShape);
virtual void makeSectionCut(TopoDS_Shape& baseShape);
void postHlrTasks(void) override;
virtual void postSectionCutTasks();
void waitingForCut(bool s) { m_waitingForCut = s; }
@@ -130,8 +131,7 @@ public:
virtual TopoDS_Shape makeCuttingTool(double shapeSize);
virtual TopoDS_Shape getShapeToCut();
virtual bool isBaseValid() const;
virtual TopoDS_Shape prepareShape(const TopoDS_Shape& rawShape,
double shapeSize);
virtual TopoDS_Shape prepareShape(const TopoDS_Shape& rawShape, double shapeSize);
virtual TopoDS_Shape getShapeToPrepare() const { return m_cutPieces; }
//CS related methods
@@ -141,25 +141,27 @@ public:
void setCSFromLocalUnit(const Base::Vector3d localUnit);
virtual gp_Ax2 getCSFromBase(const std::string sectionName) const;
gp_Ax2 getSectionCS() const;
Base::Vector3d getXDirection() const override; //don't use XDirection.getValue()
Base::Vector3d getXDirection() const override;//don't use XDirection.getValue()
TechDraw::DrawViewPart* getBaseDVP() const;
TechDraw::DrawProjGroupItem* getBaseDPGI() const;
//section face related methods
TopoDS_Compound getSectionTFaces() { return m_sectionTopoDSFaces;}
std::vector<TechDraw::FacePtr> getTDFaceGeometry() {return m_tdSectionFaces;}
TopoDS_Compound getSectionTFaces() { return m_sectionTopoDSFaces; }
std::vector<TechDraw::FacePtr> getTDFaceGeometry() { return m_tdSectionFaces; }
TopoDS_Face getSectionTopoDSFace(int i);
virtual TopoDS_Compound alignSectionFaces(TopoDS_Shape faceIntersections);
TopoDS_Compound mapToPage(TopoDS_Shape& shapeToAlign);
virtual std::vector<TechDraw::FacePtr> makeTDSectionFaces(TopoDS_Compound topoDSFaces);
virtual TopoDS_Shape getShapeToIntersect() { return m_cutPieces; }
void makeLineSets(void) ;
void makeLineSets(void);
std::vector<LineSet> getDrawableLines(int i = 0);
std::vector<PATLineSpec> getDecodedSpecsFromFile(std::string fileSpec, std::string myPattern);
TopoDS_Shape getCutShape() {return m_cutShape;}
TopoDS_Shape getCutShape() const { return m_cutShape; }
TopoDS_Shape getShapeForDetail() const override;
static const char* SectionDirEnums[];
static const char* CutSurfaceEnums[];
@@ -173,7 +175,7 @@ public Q_SLOTS:
virtual void onSectionCutFinished(void);
protected:
TopoDS_Compound m_sectionTopoDSFaces; //needed for hatching
TopoDS_Compound m_sectionTopoDSFaces;//needed for hatching
std::vector<LineSet> m_lineSets;
std::vector<TechDraw::FacePtr> m_tdSectionFaces;
@@ -192,9 +194,9 @@ protected:
void replaceSvgIncluded(std::string newSvgFile);
void replacePatIncluded(std::string newPatFile);
TopoDS_Shape m_cutPieces; //the shape after cutting, but before centering & scaling
TopoDS_Shape m_cutPieces;//the shape after cutting, but before centering & scaling
gp_Ax2 m_projectionCS;
TopoDS_Shape m_preparedShape; //the shape after cutting, centering, scaling etc
TopoDS_Shape m_preparedShape;//the shape after cutting, centering, scaling etc
QMetaObject::Connection connectCutWatcher;
QFutureWatcher<void> m_cutWatcher;
@@ -206,6 +208,6 @@ protected:
using DrawViewSectionPython = App::FeaturePythonT<DrawViewSection>;
} //namespace TechDraw
}//namespace TechDraw
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -29,9 +29,9 @@
#include <string>
#include <vector>
#include <TopoDS_Shape.hxx>
#include <gp_Ax2.hxx>
#include <gp_Pnt.hxx>
#include <TopoDS_Shape.hxx>
#include <Base/BoundBox.h>
#include <Base/Vector3D.h>
@@ -46,7 +46,7 @@ class DrawViewDetail;
class DrawView;
class CosmeticVertex;
class CosmeticEdge;
}
}// namespace TechDraw
namespace TechDraw
{
@@ -57,54 +57,43 @@ class Vertex;
//! scales & mirrors a shape about a center
TopoDS_Shape TechDrawExport mirrorShapeVec(const TopoDS_Shape &input,
const Base::Vector3d& inputCenter = Base::Vector3d(0.0, 0.0, 0.0),
double scale = 1.0);
TopoDS_Shape TechDrawExport mirrorShapeVec(
const TopoDS_Shape& input, const Base::Vector3d& inputCenter = Base::Vector3d(0.0, 0.0, 0.0),
double scale = 1.0);
TopoDS_Shape TechDrawExport mirrorShape(const TopoDS_Shape &input,
const gp_Pnt& inputCenter = gp_Pnt(0.0, 0.0, 0.0),
double scale = 1.0);
TopoDS_Shape TechDrawExport mirrorShape(const TopoDS_Shape& input,
const gp_Pnt& inputCenter = gp_Pnt(0.0, 0.0, 0.0),
double scale = 1.0);
TopoDS_Shape TechDrawExport scaleShape(const TopoDS_Shape &input,
double scale);
TopoDS_Shape TechDrawExport rotateShape(const TopoDS_Shape &input,
const gp_Ax2& viewAxis,
TopoDS_Shape TechDrawExport scaleShape(const TopoDS_Shape& input, double scale);
TopoDS_Shape TechDrawExport rotateShape(const TopoDS_Shape& input, const gp_Ax2& viewAxis,
double rotAngle);
TopoDS_Shape TechDrawExport moveShape(const TopoDS_Shape &input,
const Base::Vector3d& motion);
TopoDS_Shape TechDrawExport moveShapeRestricted(const TopoDS_Shape &input,
const Base::Vector3d& motion,
bool allowX = true,
bool allowY = true,
bool allowZ = true);
TopoDS_Shape TechDrawExport moveShapeRestricted(const TopoDS_Shape &input,
TopoDS_Shape TechDrawExport moveShape(const TopoDS_Shape& input, const Base::Vector3d& motion);
TopoDS_Shape TechDrawExport moveShapeRestricted(const TopoDS_Shape& input,
const Base::Vector3d& motion, bool allowX = true,
bool allowY = true, bool allowZ = true);
TopoDS_Shape TechDrawExport moveShapeRestricted(const TopoDS_Shape& input,
const Base::Vector3d& motion,
const Base::Vector3d& mask);
TopoDS_Shape TechDrawExport moveShapeRestricted(const TopoDS_Shape &input,
const gp_Vec& motion,
TopoDS_Shape TechDrawExport moveShapeRestricted(const TopoDS_Shape& input, const gp_Vec& motion,
const gp_Vec& mask);
TopoDS_Shape TechDrawExport centerShapeXY(const TopoDS_Shape& inShape, const gp_Ax2& coordSys);
//! Returns the centroid of shape, as viewed according to direction
gp_Pnt TechDrawExport findCentroid(const TopoDS_Shape& shape);
gp_Pnt TechDrawExport findCentroid(const TopoDS_Shape &shape,
const Base::Vector3d &direction);
gp_Pnt TechDrawExport findCentroid(const TopoDS_Shape &shape,
const gp_Ax2 &viewAxis);
Base::Vector3d TechDrawExport findCentroidVec(const TopoDS_Shape &shape,
const Base::Vector3d &direction);
Base::Vector3d TechDrawExport findCentroidVec(const TopoDS_Shape &shape,
const gp_Ax2& cs);
gp_Pnt TechDrawExport findCentroid(const TopoDS_Shape& shape, const Base::Vector3d& direction);
gp_Pnt TechDrawExport findCentroid(const TopoDS_Shape& shape, const gp_Ax2& viewAxis);
Base::Vector3d TechDrawExport findCentroidVec(const TopoDS_Shape& shape,
const Base::Vector3d& direction);
Base::Vector3d TechDrawExport findCentroidVec(const TopoDS_Shape& shape, const gp_Ax2& cs);
gp_Pnt TechDrawExport findCentroidXY(const TopoDS_Shape& shape, const gp_Ax2& coordSys);
gp_Ax2 TechDrawExport getViewAxis(const Base::Vector3d origin,
const Base::Vector3d& direction,
const bool flip=true);
gp_Ax2 TechDrawExport getViewAxis(const Base::Vector3d origin,
const Base::Vector3d& direction,
const Base::Vector3d& xAxis,
const bool flip=true);
gp_Ax2 TechDrawExport legacyViewAxis1(const Base::Vector3d origin,
const Base::Vector3d& direction,
const bool flip=true);
gp_Ax2 TechDrawExport getViewAxis(const Base::Vector3d origin, const Base::Vector3d& direction,
const bool flip = true);
gp_Ax2 TechDrawExport getViewAxis(const Base::Vector3d origin, const Base::Vector3d& direction,
const Base::Vector3d& xAxis, const bool flip = true);
gp_Ax2 TechDrawExport legacyViewAxis1(const Base::Vector3d origin, const Base::Vector3d& direction,
const bool flip = true);
class TechDrawExport GeometryObject
{
@@ -118,30 +107,25 @@ public:
//! Returns 2D bounding box
Base::BoundBox3d calcBoundingBox() const;
const std::vector<VertexPtr> & getVertexGeometry() const { return vertexGeom; }
const BaseGeomPtrVector & getEdgeGeometry() const { return edgeGeom; }
const std::vector<VertexPtr>& getVertexGeometry() const { return vertexGeom; }
const BaseGeomPtrVector& getEdgeGeometry() const { return edgeGeom; }
const BaseGeomPtrVector getVisibleFaceEdges(bool smooth, bool seam) const;
const std::vector<FacePtr> & getFaceGeometry() const { return faceGeom; }
const std::vector<FacePtr>& getFaceGeometry() const { return faceGeom; }
void setVertexGeometry(std::vector<VertexPtr> newVerts) {vertexGeom = newVerts; }
void setEdgeGeometry(BaseGeomPtrVector newGeoms) {edgeGeom = newGeoms; }
void setVertexGeometry(std::vector<VertexPtr> newVerts) { vertexGeom = newVerts; }
void setEdgeGeometry(BaseGeomPtrVector newGeoms) { edgeGeom = newGeoms; }
void projectShape(const TopoDS_Shape &input,
const gp_Ax2 &viewAxis);
void projectShapeWithPolygonAlgo(const TopoDS_Shape &input,
const gp_Ax2 &viewAxis);
static TopoDS_Shape projectSimpleShape(const TopoDS_Shape &shape,
const gp_Ax2 &CS);
static TopoDS_Shape simpleProjection(const TopoDS_Shape& shape,
const gp_Ax2& projCS);
static TopoDS_Shape projectFace(const TopoDS_Shape &face,
const gp_Ax2 &CS);
void projectShape(const TopoDS_Shape& input, const gp_Ax2& viewAxis);
void projectShapeWithPolygonAlgo(const TopoDS_Shape& input, const gp_Ax2& viewAxis);
static TopoDS_Shape projectSimpleShape(const TopoDS_Shape& shape, const gp_Ax2& CS);
static TopoDS_Shape simpleProjection(const TopoDS_Shape& shape, const gp_Ax2& projCS);
static TopoDS_Shape projectFace(const TopoDS_Shape& face, const gp_Ax2& CS);
void makeTDGeometry();
void extractGeometry(edgeClass category, bool visible);
void addFaceGeom(FacePtr f);
void clearFaceGeom();
void setIsoCount(int i) { m_isoCount = i; }
void setParentName(std::string n); //for debug messages
void setParentName(std::string n);//for debug messages
void isPerspective(bool b) { m_isPersp = b; }
bool isPerspective() { return m_isPersp; }
void usePolygonHLR(bool b) { m_usePolygonHLR = b; }
@@ -153,16 +137,16 @@ public:
//dupl mirrorShape???
static TopoDS_Shape invertGeometry(const TopoDS_Shape s);
TopoDS_Shape getVisHard() { return visHard; }
TopoDS_Shape getVisHard() { return visHard; }
TopoDS_Shape getVisOutline() { return visOutline; }
TopoDS_Shape getVisSmooth() { return visSmooth; }
TopoDS_Shape getVisSeam() { return visSeam; }
TopoDS_Shape getVisIso() { return visIso; }
TopoDS_Shape getHidHard() { return hidHard; }
TopoDS_Shape getVisSmooth() { return visSmooth; }
TopoDS_Shape getVisSeam() { return visSeam; }
TopoDS_Shape getVisIso() { return visIso; }
TopoDS_Shape getHidHard() { return hidHard; }
TopoDS_Shape getHidOutline() { return hidOutline; }
TopoDS_Shape getHidSmooth() { return hidSmooth; }
TopoDS_Shape getHidSeam() { return hidSeam; }
TopoDS_Shape getHidIso() { return hidIso; }
TopoDS_Shape getHidSmooth() { return hidSmooth; }
TopoDS_Shape getHidSeam() { return hidSeam; }
TopoDS_Shape getHidIso() { return hidIso; }
void addVertex(TechDraw::VertexPtr v);
void addEdge(TechDraw::BaseGeomPtr bg);
@@ -170,20 +154,14 @@ public:
int addCosmeticVertex(CosmeticVertex* cv);
int addCosmeticVertex(Base::Vector3d pos);
int addCosmeticVertex(Base::Vector3d pos,
std::string tagString);
int addCosmeticVertex(Base::Vector3d pos, std::string tagString);
int addCosmeticEdge(CosmeticEdge* ce);
int addCosmeticEdge(Base::Vector3d start,
Base::Vector3d end);
int addCosmeticEdge(Base::Vector3d start,
Base::Vector3d end,
std::string tagString);
int addCosmeticEdge(TechDraw::BaseGeomPtr base,
std::string tagString);
int addCosmeticEdge(Base::Vector3d start, Base::Vector3d end);
int addCosmeticEdge(Base::Vector3d start, Base::Vector3d end, std::string tagString);
int addCosmeticEdge(TechDraw::BaseGeomPtr base, std::string tagString);
int addCenterLine(TechDraw::BaseGeomPtr bg,
std::string tag);
int addCenterLine(TechDraw::BaseGeomPtr bg, std::string tag);
protected:
//HLR output
@@ -225,6 +203,6 @@ protected:
using GeometryObjectPtr = std::shared_ptr<GeometryObject>;
} //namespace TechDraw
}//namespace TechDraw
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -481,7 +481,7 @@ QString TaskComplexSection::sourcesToString()
//******************************************************************************
bool TaskComplexSection::apply(bool forceUpdate)
{
// Base::Console().Message("TCS::apply() - liveUpdate: %d forece: %d\n",
// Base::Console().Message("TCS::apply() - liveUpdate: %d force: %d\n",
// ui->cbLiveUpdate->isChecked(), forceUpdate);
if (!ui->cbLiveUpdate->isChecked() && !forceUpdate) {
//nothing to do