Section Rebuild subproject

new dialog
new Section/SectionLine logic
remove XAxisDirection property
This commit is contained in:
WandererFan 2016-10-06 15:15:09 -04:00 committed by Yorik van Havre
parent a82a50a60f
commit a662cad5be
25 changed files with 1132 additions and 503 deletions

View File

@ -399,7 +399,6 @@ void DrawProjGroup::setViewOrientation(DrawProjGroupItem *v, const char *projTyp
//xDir = viewOrientationMatrix.getValue() * xDir;
v->Direction.setValue(dir);
//v->XAxisDirection.setValue(xDir);
}
void DrawProjGroup::arrangeViewPointers(DrawProjGroupItem *viewPtrs[10]) const

View File

@ -57,7 +57,6 @@ DrawProjGroupItem::DrawProjGroupItem(void)
//projection group controls these
Direction.setStatus(App::Property::ReadOnly,true);
XAxisDirection.setStatus(App::Property::ReadOnly,true);
Scale.setStatus(App::Property::ReadOnly,true);
ScaleType.setStatus(App::Property::ReadOnly,true);
}

View File

@ -83,6 +83,7 @@ DrawView::~DrawView()
App::DocumentObjectExecReturn *DrawView::execute(void)
{
//Base::Console().Message("TRACE - DV::execute - %s\n",Label.getValue());
TechDraw::DrawPage *page = findParentPage();
if(page) {
if (ScaleType.isValue("Document")) {
@ -105,6 +106,7 @@ App::DocumentObjectExecReturn *DrawView::execute(void)
void DrawView::onChanged(const App::Property* prop)
{
if (!isRestoring()) {
//Base::Console().Message("TRACE - DV::onChanged(%s) - %s\n",prop->getName(),Label.getValue());
if (prop == &ScaleType) {
if (ScaleType.isValue("Document")) {
Scale.setStatus(App::Property::ReadOnly,true);

View File

@ -103,13 +103,12 @@ DrawViewPart::DrawViewPart(void) : geometryObject(0)
{
static const char *group = "Projection";
static const char *fgroup = "Format";
static const char *lgroup = "SectionLine";
static const char *sgroup = "Show";
//properties that affect Geometry
ADD_PROPERTY_TYPE(Source ,(0),group,App::Prop_None,"3D Shape to view");
ADD_PROPERTY_TYPE(Direction ,(0,0,1.0) ,group,App::Prop_None,"Projection direction. The direction you are looking from.");
ADD_PROPERTY_TYPE(XAxisDirection ,(1,0,0) ,group,App::Prop_None,"Where to place projection's XAxis (rotation)");
// ADD_PROPERTY_TYPE(XAxisDirection ,(1,0,0) ,group,App::Prop_None,"Where to place projection's XAxis (rotation)");
ADD_PROPERTY_TYPE(Tolerance,(0.05f),group,App::Prop_None,"Internal tolerance for calculations");
Tolerance.setConstraints(&floatRange);
@ -135,9 +134,6 @@ DrawViewPart::DrawViewPart(void) : geometryObject(0)
//properties that affect Section Line
ADD_PROPERTY_TYPE(ShowSectionLine ,(true) ,sgroup,App::Prop_None,"Show/hide section line if applicable");
ADD_PROPERTY_TYPE(HorizSectionLine ,(true) ,lgroup,App::Prop_None,"Section line is horizontal");
ADD_PROPERTY_TYPE(ArrowUpSection ,(false) ,lgroup,App::Prop_None,"Section line arrows point up");
ADD_PROPERTY_TYPE(SymbolSection,("A") ,lgroup,App::Prop_None,"Section identifier");
geometryObject = new TechDrawGeometry::GeometryObject(this);
getRunControl();
@ -166,6 +162,8 @@ App::DocumentObjectExecReturn *DrawViewPart::execute(void)
return new App::DocumentObjectExecReturn("FVP - Linked shape object is empty");
}
//Base::Console().Message("TRACE - DVP::execute - %s \n",Label.getValue());
(void) DrawView::execute(); //make sure Scale is up to date
geometryObject->setTolerance(Tolerance.getValue());
@ -175,8 +173,7 @@ App::DocumentObjectExecReturn *DrawViewPart::execute(void)
gp_Pnt inputCenter;
try {
inputCenter = TechDrawGeometry::findCentroid(shape,
Direction.getValue(),
getValidXDir());
Direction.getValue());
shapeCentroid = Base::Vector3d(inputCenter.X(),inputCenter.Y(),inputCenter.Z());
}
catch (Standard_Failure) {
@ -228,7 +225,6 @@ short DrawViewPart::mustExecute() const
short result = 0;
if (!isRestoring()) {
result = (Direction.isTouched() ||
XAxisDirection.isTouched() ||
Source.isTouched() ||
Scale.isTouched() );
}
@ -241,6 +237,8 @@ short DrawViewPart::mustExecute() const
void DrawViewPart::onChanged(const App::Property* prop)
{
//Base::Console().Message("TRACE - DVP::onChanged(%s) - %s\n",prop->getName(),Label.getValue());
DrawView::onChanged(prop);
//TODO: when scale changes, any Dimensions for this View sb recalculated. DVD should pick this up subject to topological naming issues.
@ -249,15 +247,12 @@ void DrawViewPart::onChanged(const App::Property* prop)
void DrawViewPart::buildGeometryObject(TopoDS_Shape shape, gp_Pnt& inputCenter)
{
Base::Vector3d baseProjDir = Direction.getValue();
Base::Vector3d validXDir = getValidXDir();
saveParamSpace(baseProjDir,
validXDir);
saveParamSpace(baseProjDir);
geometryObject->projectShape(shape,
inputCenter,
Direction.getValue(),
validXDir);
Direction.getValue());
geometryObject->extractGeometry(TechDrawGeometry::ecHARD, //always show the hard&outline visible lines
true);
geometryObject->extractGeometry(TechDrawGeometry::ecOUTLINE,
@ -749,11 +744,7 @@ Base::Vector3d DrawViewPart::projectPoint(const Base::Vector3d& pt) const
{
Base::Vector3d centeredPoint = pt - shapeCentroid;
Base::Vector3d direction = Direction.getValue();
Base::Vector3d xAxis = getValidXDir();
gp_Ax2 viewAxis;
viewAxis = gp_Ax2(gp_Pnt(0.0,0.0,0.0),
gp_Dir(direction.x, direction.y, direction.z),
gp_Dir(xAxis.x, xAxis.y, xAxis.z));
gp_Ax2 viewAxis = TechDrawGeometry::getViewAxis(centeredPoint,direction);
HLRAlgo_Projector projector( viewAxis );
gp_Pnt2d prjPnt;
projector.Project(gp_Pnt(centeredPoint.x,centeredPoint.y,centeredPoint.z), prjPnt);
@ -774,64 +765,27 @@ bool DrawViewPart::hasGeometry(void) const
return result;
}
Base::Vector3d DrawViewPart::getValidXDir() const
void DrawViewPart::saveParamSpace(const Base::Vector3d& direction)
{
Base::Vector3d X(1.0,0.0,0.0);
Base::Vector3d Y(0.0,1.0,0.0);
Base::Vector3d Z(0.0,0.0,1.0);
Base::Vector3d xDir = XAxisDirection.getValue();
if (xDir.Length() < Precision::Confusion()) {
Base::Console().Warning("XAxisDirection has zero length - using (1,0,0)\n");
xDir = X;
}
double xLength = xDir.Length();
xDir.Normalize();
Base::Vector3d viewDir = Direction.getValue();
viewDir.Normalize();
Base::Vector3d randomDir(0.0,0.0,0.0);
if (xDir == viewDir) {
randomDir = Y;
if (randomDir == xDir) {
randomDir = X;
}
xDir = randomDir;
Base::Console().Warning("XAxisDirection cannot equal +/- Direction - using (%.3f,%.3f%.3f)\n",
xDir.x,xDir.y,xDir.z);
} else if (xDir == (-1.0 * viewDir)) {
randomDir = Y;
if ((xDir == randomDir) ||
(xDir == (-1.0 * randomDir))) {
randomDir = X;
}
xDir = randomDir;
Base::Console().Warning("XAxisDirection cannot equal +/- Direction - using (%.3f,%.3f%.3f)\n",
xDir.x,xDir.y,xDir.z);
}
return xLength * xDir;
}
Base::Vector3d origin(0.0,0.0,0.0);
gp_Ax2 viewAxis = TechDrawGeometry::getViewAxis(origin,direction);
void DrawViewPart::saveParamSpace(const Base::Vector3d& direction,
const Base::Vector3d& xAxis)
{
gp_Ax2 viewAxis;
viewAxis = gp_Ax2(gp_Pnt(0, 0, 0),
gp_Dir(direction.x, -direction.y, direction.z),
gp_Dir(xAxis.x, -xAxis.y, xAxis.z)); // Y invert warning! //
uDir = Base::Vector3d(xAxis.x, -xAxis.y, xAxis.z);
gp_Dir xdir = viewAxis.XDirection();
uDir = Base::Vector3d(xdir.X(),xdir.Y(),xdir.Z());
gp_Dir ydir = viewAxis.YDirection();
vDir = Base::Vector3d(ydir.X(),ydir.Y(),ydir.Z());
wDir = Base::Vector3d(direction.x, -direction.y, direction.z);
wDir.Normalize();
}
DrawViewSection* DrawViewPart::getSectionRef(void) const
std::vector<DrawViewSection*> DrawViewPart::getSectionRefs(void) const
{
DrawViewSection* result = nullptr;
std::vector<DrawViewSection*> result;
std::vector<App::DocumentObject*> inObjs = getInList();
for (auto& o:inObjs) {
if (o->getTypeId().isDerivedFrom(DrawViewSection::getClassTypeId())) {
result = static_cast<TechDraw::DrawViewSection*>(o);
result.push_back(static_cast<TechDraw::DrawViewSection*>(o));
}
}
return result;

View File

@ -72,7 +72,7 @@ public:
App::PropertyLink Source; //Part Feature
App::PropertyVector Direction; //TODO: Rename to YAxisDirection or whatever this actually is (ProjectionDirection)
App::PropertyVector XAxisDirection;
//App::PropertyVector XAxisDirection;
App::PropertyBool SeamVisible;
App::PropertyBool SmoothVisible;
//App::PropertyBool OutlinesVisible;
@ -93,11 +93,7 @@ public:
App::PropertyFloatConstraint Tolerance;
App::PropertyBool HorizCenterLine;
App::PropertyBool VertCenterLine;
App::PropertyBool ShowSectionLine;
App::PropertyBool HorizSectionLine; //true(horiz)/false(vert)
App::PropertyBool ArrowUpSection; //true(up/right)/false(down/left)
App::PropertyString SymbolSection;
std::vector<TechDraw::DrawHatch*> getHatches(void) const;
@ -118,12 +114,11 @@ public:
double getBoxX(void) const;
double getBoxY(void) const;
virtual QRectF getRect() const;
virtual DrawViewSection* getSectionRef() const; //is there a ViewSection based on this ViewPart?
virtual std::vector<DrawViewSection*> getSectionRefs() const; //are there ViewSections based on this ViewPart?
const Base::Vector3d& getUDir(void) const {return uDir;} //paperspace X
const Base::Vector3d& getVDir(void) const {return vDir;} //paperspace Y
const Base::Vector3d& getWDir(void) const {return wDir;} //paperspace Z
const Base::Vector3d& getCentroid(void) const {return shapeCentroid;}
Base::Vector3d getValidXDir() const;
Base::Vector3d projectPoint(const Base::Vector3d& pt) const;
virtual short mustExecute() const;
@ -158,8 +153,7 @@ protected:
double simpleMinDist(TopoDS_Shape s1, TopoDS_Shape s2); //const; //probably sb static or DrawUtil
//Projection parameter space
void saveParamSpace(const Base::Vector3d& direction,
const Base::Vector3d& xAxis);
void saveParamSpace(const Base::Vector3d& direction);
Base::Vector3d uDir; //paperspace X
Base::Vector3d vDir; //paperspace Y
Base::Vector3d wDir; //paperspace Z

View File

@ -30,13 +30,15 @@
#include <Bnd_Box.hxx>
#include <BRepBndLib.hxx>
#include <BRepBuilderAPI_MakePolygon.hxx>
//#include <BRepBuilderAPI_MakePolygon.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepPrimAPI_MakePrism.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepAdaptor_Surface.hxx>
# include <BRep_Builder.hxx>
#include <gp_Ax2.hxx>
#include <gp_Ax3.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pln.hxx>
#include <gp_Dir.hxx>
@ -49,6 +51,7 @@
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
@ -76,6 +79,14 @@
using namespace TechDraw;
using namespace std;
const char* DrawViewSection::SectionDirEnums[]= {"Right",
"Left",
"Up",
"Down",
NULL};
//===========================================================================
// DrawViewSection
//===========================================================================
@ -89,12 +100,14 @@ DrawViewSection::DrawViewSection()
//static const char *lgroup = "Line";
ADD_PROPERTY_TYPE(BaseView ,(0),sgroup,App::Prop_None,"2D View with SectionLine");
ADD_PROPERTY_TYPE(SectionSymbol ,("A"),sgroup,App::Prop_None,"The identifier for this section");
ADD_PROPERTY_TYPE(BaseView ,(0),sgroup,App::Prop_None,"2D View source for this Section");
ADD_PROPERTY_TYPE(SectionNormal ,(0,0,1.0) ,sgroup,App::Prop_None,"Section Plane normal direction"); //direction of extrusion of cutting prism
ADD_PROPERTY_TYPE(SectionOrigin ,(0,0,0) ,sgroup,App::Prop_None,"Section Plane Origin");
SectionDirection.setEnums(SectionDirEnums);
ADD_PROPERTY_TYPE(SectionDirection,((long)0),sgroup, App::Prop_None, "Direction in Base View for this Section");
ADD_PROPERTY_TYPE(ShowCutSurface ,(true),fgroup,App::Prop_None,"Shade the cut surface");
ADD_PROPERTY_TYPE(CutSurfaceColor,(0.0,0.0,0.0),fgroup,App::Prop_None,"The color to shade the cut surface");
ADD_PROPERTY_TYPE(HatchCutSurface ,(false),fgroup,App::Prop_None,"Hatch the cut surface");
ADD_PROPERTY_TYPE(HatchPattern ,(""),fgroup,App::Prop_None,"The hatch pattern file for the cut surface");
@ -114,7 +127,6 @@ short DrawViewSection::mustExecute() const
if (!isRestoring()) {
result = (Scale.isTouched() ||
Direction.isTouched() ||
XAxisDirection.isTouched() ||
BaseView.isTouched() ||
SectionNormal.isTouched() ||
SectionOrigin.isTouched() );
@ -127,8 +139,23 @@ short DrawViewSection::mustExecute() const
void DrawViewSection::onChanged(const App::Property* prop)
{
if (!isRestoring()) {
//Base::Console().Message("TRACE - DVS::onChanged(%s) - %s\n",prop->getName(),Label.getValue());
if (prop == &SectionSymbol) {
std::string lblText = "Section " +
std::string(SectionSymbol.getValue()) +
" - " +
std::string(SectionSymbol.getValue());
Label.setValue(lblText);
}
if (prop == &SectionOrigin) {
App::DocumentObject* base = BaseView.getValue();
base->touch();
}
}
DrawView::onChanged(prop);
}
App::DocumentObjectExecReturn *DrawViewSection::execute(void)
{
App::DocumentObject* link = Source.getValue();
@ -143,8 +170,9 @@ App::DocumentObjectExecReturn *DrawViewSection::execute(void)
if (!base->getTypeId().isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId()))
return new App::DocumentObjectExecReturn("BaseView object is not a DrawViewPart object");
//Base::Console().Message("TRACE - DVS::execute() - %s/%s\n",getNameInDocument(),Label.getValue());
const Part::TopoShape &partTopo = static_cast<Part::Feature*>(link)->Shape.getShape();
//const TechDraw::DrawViewPart* dvp = static_cast<TechDraw::DrawViewPart*>(base);
if (partTopo.getShape().IsNull())
return new App::DocumentObjectExecReturn("Linked shape object is empty");
@ -152,47 +180,25 @@ App::DocumentObjectExecReturn *DrawViewSection::execute(void)
(void) DrawView::execute(); //make sure Scale is up to date
gp_Pln pln = getSectionPlane();
// Get the Axis Directions for the Plane to transform UV components again
gp_XYZ xAxis = pln.XAxis().Direction().XYZ();
gp_XYZ yAxis = pln.YAxis().Direction().XYZ();
gp_XYZ origin = pln.Location().XYZ();
gp_Dir plnNormal = pln.Axis().Direction().XYZ();
gp_Dir gpNormal = pln.Axis().Direction();
Base::Vector3d orgPnt = SectionOrigin.getValue();
Base::BoundBox3d bb = partTopo.getBoundBox();
Base::Vector3d tmp1 = SectionOrigin.getValue();
Base::Vector3d plnPnt(tmp1.x, tmp1.y, tmp1.z);
Base::Vector3d plnNorm(plnNormal.X(), plnNormal.Y(), plnNormal.Z());
// if(!bb.IsCutPlane(plnPnt, plnNorm)) { //this test doesn't work if plane is coincident with bb!
if(!isReallyInBox(plnPnt, bb)) {
if(!isReallyInBox(orgPnt, bb)) {
Base::Console().Warning("DVS: Section Plane doesn't intersect part in %s\n",getNameInDocument());
Base::Console().Warning("DVS: Using center of bounding box.\n");
plnPnt = bb.GetCenter();
//SectionOrigin.setValue(plnPnt);
orgPnt = bb.GetCenter();
SectionOrigin.setValue(orgPnt);
}
double dMax = bb.CalcDiagonalLength();
double maxParm = dMax;
BRepBuilderAPI_MakePolygon mkPoly;
gp_Pnt pn1(origin + xAxis * maxParm + yAxis * maxParm);
gp_Pnt pn2(origin + xAxis * maxParm + yAxis * -maxParm);
gp_Pnt pn3(origin + xAxis * -maxParm + yAxis * -maxParm);
gp_Pnt pn4(origin + xAxis * -maxParm + yAxis * +maxParm);
mkPoly.Add(pn1);
mkPoly.Add(pn2);
mkPoly.Add(pn3);
mkPoly.Add(pn4);
mkPoly.Close();
// Make the extrusion face
BRepBuilderAPI_MakeFace mkFace(mkPoly.Wire());
double dMax = bb.CalcDiagonalLength();
BRepBuilderAPI_MakeFace mkFace(pln, -dMax,dMax,-dMax,dMax);
TopoDS_Face aProjFace = mkFace.Face();
if(aProjFace.IsNull())
return new App::DocumentObjectExecReturn("DrawViewSection - Projected face is NULL");
TopoDS_Shape prism = BRepPrimAPI_MakePrism(aProjFace, dMax * gp_Vec(pln.Axis().Direction()), false, true).Shape();
gp_Vec extrudeDir = dMax * gp_Vec(gpNormal);
TopoDS_Shape prism = BRepPrimAPI_MakePrism(aProjFace, extrudeDir, false, true).Shape();
// We need to copy the shape to not modify the BRepstructure
BRepBuilderAPI_Copy BuilderCopy(partTopo.getShape());
@ -207,18 +213,17 @@ App::DocumentObjectExecReturn *DrawViewSection::execute(void)
BRepBndLib::Add(rawShape, testBox);
testBox.SetGap(0.0);
if (testBox.IsVoid()) { //prism & input don't intersect. rawShape is garbage, don't bother.
Base::Console().Log("INFO - DVS::execute - prism & input don't intersect\n");
return DrawView::execute();
}
geometryObject->setTolerance(Tolerance.getValue());
geometryObject->setScale(Scale.getValue());
Base::Vector3d validXDir = getValidXDir();
gp_Pnt inputCenter;
try {
inputCenter = TechDrawGeometry::findCentroid(rawShape,
Direction.getValue(),
validXDir);
Direction.getValue());
TopoDS_Shape mirroredShape = TechDrawGeometry::mirrorShape(rawShape,
inputCenter,
Scale.getValue());
@ -248,8 +253,7 @@ App::DocumentObjectExecReturn *DrawViewSection::execute(void)
const TopoDS_Face& face = TopoDS::Face(expl.Current());
TopoDS_Face pFace = projectFace(face,
inputCenter,
Direction.getValue(),
validXDir);
Direction.getValue());
if (!pFace.IsNull()) {
builder.Add(newFaces,pFace);
}
@ -270,10 +274,13 @@ gp_Pln DrawViewSection::getSectionPlane() const
{
Base::Vector3d plnPnt = SectionOrigin.getValue();
Base::Vector3d plnNorm = SectionNormal.getValue();
gp_Ax2 viewAxis = TechDrawGeometry::getViewAxis(plnPnt,plnNorm,false);
gp_Ax3 viewAxis3(viewAxis);
return gp_Pln(gp_Pnt(plnPnt.x, plnPnt.y, plnPnt.z), gp_Dir(plnNorm.x, plnNorm.y, plnNorm.z));
return gp_Pln(viewAxis3);
}
//! tries to find the intersection of the section plane with the shape giving a collection of planar faces
TopoDS_Compound DrawViewSection::findSectionPlaneIntersections(const TopoDS_Shape& shape)
{
@ -336,22 +343,18 @@ std::vector<TechDrawGeometry::Face*> DrawViewSection::getFaceGeometry()
//! project a single face using HLR - used for section faces
TopoDS_Face DrawViewSection::projectFace(const TopoDS_Shape &face,
gp_Pnt faceCenter,
const Base::Vector3d &direction,
const Base::Vector3d &xaxis)
const Base::Vector3d &direction)
{
if(face.IsNull()) {
throw Base::Exception("DrawViewSection::projectFace - input Face is NULL");
}
gp_Ax2 transform;
transform = gp_Ax2(faceCenter,
gp_Dir(direction.x, direction.y, direction.z),
gp_Dir(xaxis.x, xaxis.y, xaxis.z));
Base::Vector3d origin(faceCenter.X(),faceCenter.Y(),faceCenter.Z());
gp_Ax2 viewAxis = TechDrawGeometry::getViewAxis(origin,direction);
HLRBRep_Algo *brep_hlr = new HLRBRep_Algo();
brep_hlr->Add(face);
HLRAlgo_Projector projector( transform );
HLRAlgo_Projector projector( viewAxis );
brep_hlr->Projector(projector);
brep_hlr->Update();
brep_hlr->Hide();

View File

@ -60,12 +60,13 @@ public:
App::PropertyLink BaseView;
App::PropertyVector SectionNormal;
App::PropertyVector SectionOrigin;
App::PropertyEnumeration SectionDirection;
App::PropertyBool ShowCutSurface;
App::PropertyColor CutSurfaceColor;
App::PropertyBool HatchCutSurface;
App::PropertyFile HatchPattern;
App::PropertyColor HatchColor;
App::PropertyString SectionSymbol;
virtual short mustExecute() const;
bool isReallyInBox (const Base::Vector3d v, const Base::BoundBox3d bb) const;
@ -83,6 +84,7 @@ public:
public:
std::vector<TechDrawGeometry::Face*> getFaceGeometry();
static const char* SectionDirEnums[];
protected:
TopoDS_Compound sectionFaces;
@ -91,14 +93,12 @@ protected:
TopoDS_Compound findSectionPlaneIntersections(const TopoDS_Shape& shape);
TopoDS_Face projectFace(const TopoDS_Shape &face,
gp_Pnt faceCenter,
const Base::Vector3d &direction,
const Base::Vector3d &xaxis);
const Base::Vector3d &direction);
void getParameters(void);
};
typedef App::FeaturePythonT<DrawViewSection> DrawViewSectionPython;
} //namespace TechDraw
#endif

View File

@ -38,10 +38,10 @@
#include <gp_Elips.hxx>
#include <gp_Pln.hxx>
#include <gp_Vec.hxx>
#include <HLRTopoBRep_OutLiner.hxx>
//#include <HLRTopoBRep_OutLiner.hxx>
#include <HLRBRep.hxx>
#include <HLRBRep_Algo.hxx>
#include <HLRBRep_Data.hxx>
//#include <HLRBRep_Data.hxx>
#include <HLRBRep_HLRToShape.hxx>
#include <HLRAlgo_Projector.hxx>
#include <TopoDS.hxx>
@ -161,36 +161,18 @@ void GeometryObject::clear()
//!set up a hidden line remover and project a shape with it
void GeometryObject::projectShape(const TopoDS_Shape& input,
const gp_Pnt& inputCenter,
const Base::Vector3d& direction,
const Base::Vector3d& xAxis)
const Base::Vector3d& direction)
{
Base::Vector3d stdZ(0.0,0.0,1.0);
Base::Vector3d flipDirection(direction.x,-direction.y,direction.z);
Base::Vector3d cross = flipDirection;
//special cases
if (flipDirection == stdZ) {
cross = Base::Vector3d(1.0,0.0,0.0);
} else if (flipDirection == (stdZ * -1.0)) {
cross = Base::Vector3d(1.0,0.0,0.0);
} else {
cross.Normalize();
cross = cross.Cross(stdZ);
}
// Clear previous Geometry
clear();
Base::Vector3d origin(inputCenter.X(),inputCenter.Y(),inputCenter.Z());
gp_Ax2 viewAxis = getViewAxis(origin,direction);
auto start = chrono::high_resolution_clock::now();
Handle_HLRBRep_Algo brep_hlr = NULL;
try {
brep_hlr = new HLRBRep_Algo();
brep_hlr->Add(input, m_isoCount);
gp_Ax2 viewAxis;
viewAxis = gp_Ax2(inputCenter,
gp_Dir(flipDirection.x, flipDirection.y, flipDirection.z),
// gp_Dir(xAxis.x, -xAxis.y, xAxis.z));
gp_Dir(cross.x, cross.y, cross.z));
HLRAlgo_Projector projector( viewAxis );
brep_hlr->Projector(projector);
brep_hlr->Update();
@ -688,15 +670,42 @@ bool GeometryObject::findVertex(Base::Vector2D v)
}
/// utility non-class member functions
//! Returns the centroid of shape, as viewed according to direction and xAxis
gp_Pnt TechDrawGeometry::findCentroid(const TopoDS_Shape &shape,
const Base::Vector3d &direction,
const Base::Vector3d &xAxis)
//! gets a coordinate system
gp_Ax2 TechDrawGeometry::getViewAxis(const Base::Vector3d origin,
const Base::Vector3d& direction,
const bool flip)
{
gp_Pnt inputCenter(origin.x,origin.y,origin.z);
Base::Vector3d stdZ(0.0,0.0,1.0);
Base::Vector3d flipDirection(direction.x,-direction.y,direction.z);
if (!flip) {
flipDirection = Base::Vector3d(direction.x,direction.y,direction.z);
}
Base::Vector3d cross = flipDirection;
//special cases
if (flipDirection == stdZ) {
cross = Base::Vector3d(1.0,0.0,0.0);
} else if (flipDirection == (stdZ * -1.0)) {
cross = Base::Vector3d(1.0,0.0,0.0);
} else {
cross.Normalize();
cross = cross.Cross(stdZ);
}
gp_Ax2 viewAxis;
viewAxis = gp_Ax2(gp_Pnt(0, 0, 0),
gp_Dir(direction.x, -direction.y, direction.z),
gp_Dir(xAxis.x, -xAxis.y, xAxis.z));
viewAxis = gp_Ax2(inputCenter,
gp_Dir(flipDirection.x, flipDirection.y, flipDirection.z),
gp_Dir(cross.x, cross.y, cross.z));
return viewAxis;
}
//! Returns the centroid of shape, as viewed according to direction
gp_Pnt TechDrawGeometry::findCentroid(const TopoDS_Shape &shape,
const Base::Vector3d &direction)
{
Base::Vector3d origin(0.0,0.0,0.0);
gp_Ax2 viewAxis = getViewAxis(origin,direction);
gp_Trsf tempTransform;
tempTransform.SetTransformation(viewAxis);

View File

@ -25,7 +25,7 @@
#include <TopoDS_Shape.hxx>
#include <TopoDS_Compound.hxx>
#include <HLRBRep_Data.hxx>
//#include <HLRBRep_Data.hxx>
#include <gp_Pnt.hxx>
#include <Base/Vector3D.h>
@ -49,10 +49,13 @@ TopoDS_Shape TechDrawExport mirrorShape(const TopoDS_Shape &input,
const gp_Pnt& inputCenter,
double scale);
//! Returns the centroid of shape, as viewed according to direction and xAxis
//! Returns the centroid of shape, as viewed according to direction
gp_Pnt TechDrawExport findCentroid(const TopoDS_Shape &shape,
const Base::Vector3d &direction,
const Base::Vector3d &xAxis);
const Base::Vector3d &direction);
gp_Ax2 TechDrawExport getViewAxis(const Base::Vector3d origin,
const Base::Vector3d& direction,
const bool flip=true);
class TechDrawExport GeometryObject
{
@ -76,8 +79,7 @@ public:
void projectShape(const TopoDS_Shape &input,
const gp_Pnt& inputCenter,
const Base::Vector3d &direction,
const Base::Vector3d &xAxis);
const Base::Vector3d &direction);
void extractGeometry(edgeClass category, bool visible);
void addFaceGeom(Face * f);
void clearFaceGeom();

View File

@ -335,11 +335,11 @@ void CmdTechDrawNewViewSection::activated(int iMsg)
}
App::DocumentObject* dObj = *(shapes.begin());
TechDraw::DrawViewPart* dvp = static_cast<TechDraw::DrawViewPart*>(dObj);
if (dvp->getSectionRef()) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
QObject::tr("This View already has a related Section. Choose another."));
return;
}
// if (dvp->getSectionRef()) {
// QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
// QObject::tr("This View already has a related Section. Choose another."));
// return;
// }
std::string PageName = page->getNameInDocument();

View File

@ -872,6 +872,8 @@ void CmdTechDrawLinkDimension::activated(int iMsg)
return;
}
//TODO: if (subs.empty()) { "no geometry found in selection" }
// dialog to select the Dimension to link
Gui::Control().showDialog(new TaskDlgLinkDim(obj3D,subs,page));

View File

@ -250,7 +250,6 @@ void QGIViewPart::updateView(bool update)
viewPart->isTouched() ||
viewPart->Source.isTouched() ||
viewPart->Direction.isTouched() ||
viewPart->XAxisDirection.isTouched() ||
viewPart->Tolerance.isTouched() ||
viewPart->Scale.isTouched() ||
viewPart->HardHidden.isTouched() ||
@ -394,9 +393,11 @@ void QGIViewPart::drawViewPart()
}
}
//draw section line
if (viewPart->ShowSectionLine.getValue() &&
viewPart->getSectionRef() ) {
drawSectionLine(true);
if (viewPart->ShowSectionLine.getValue()) {
auto refs = viewPart->getSectionRefs();
for (auto& r:refs) {
drawSectionLine(r, true);
}
}
//draw center lines
drawCenterLines(true);
@ -464,10 +465,9 @@ void QGIViewPart::removeDecorations()
}
}
void QGIViewPart::drawSectionLine(bool b)
void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b)
{
TechDraw::DrawViewPart *viewPart = static_cast<TechDraw::DrawViewPart *>(getViewObject());
TechDraw::DrawViewSection *viewSection = viewPart->getSectionRef();
if (!viewPart ||
!viewSection) {
return;
@ -475,32 +475,38 @@ void QGIViewPart::drawSectionLine(bool b)
if (b) {
QGISectionLine* sectionLine = new QGISectionLine();
addToGroup(sectionLine);
sectionLine->setSymbol(const_cast<char*>(viewPart->SymbolSection.getValue()));
Base::Vector3d sectionDir(0,1,0);
Base::Vector3d up(0,1,0);
Base::Vector3d down(0,-1,0);
Base::Vector3d right(1,0,0);
Base::Vector3d left(-1,0,0);
bool horiz = viewPart->HorizSectionLine.getValue();
bool normal = viewPart->ArrowUpSection.getValue();
if (horiz && normal) {
sectionDir = up;
} else if (horiz && !normal) {
sectionDir = down;
} else if (!horiz && normal) {
sectionDir = right;
} else if (!horiz && !normal) {
sectionDir = left;
sectionLine->setSymbol(const_cast<char*>(viewSection->SectionSymbol.getValue()));
//TODO: handle oblique section lines?
//find smallest internal angle(normalDir,get?Dir()) and use -1*get?Dir() +/- angle
//Base::Vector3d normalDir = viewSection->SectionNormal.getValue();
Base::Vector3d arrowDir(0,1,0); //for drawing only, not geom
Base::Vector3d lineDir(1,0,0);
bool horiz = false;
if (viewSection->SectionDirection.isValue("Right")) {
arrowDir = Base::Vector3d(1,0,0);
lineDir = Base::Vector3d(0,1,0);
} else if (viewSection->SectionDirection.isValue("Left")) {
arrowDir = Base::Vector3d(-1,0,0);
lineDir = Base::Vector3d(0,-1,0);
} else if (viewSection->SectionDirection.isValue("Up")) {
arrowDir = Base::Vector3d(0,1,0);
lineDir = Base::Vector3d(1,0,0);
horiz = true;
} else if (viewSection->SectionDirection.isValue("Down")) {
arrowDir = Base::Vector3d(0,-1,0);
lineDir = Base::Vector3d(-1,0,0);
horiz = true;
}
sectionLine->setDirection(sectionDir.x,sectionDir.y);
sectionLine->setDirection(arrowDir.x,arrowDir.y);
Base::Vector3d org = viewSection->SectionOrigin.getValue();
double scale = viewPart->Scale.getValue();
Base::Vector3d pOrg = scale * viewPart->projectPoint(org);
pOrg.y = -1 * pOrg.y;
//now project pOrg onto sectionDir
//pOrg.y = -1 * pOrg.y;
//now project pOrg onto arrowDir
Base::Vector3d displace;
displace.ProjectToLine(pOrg, sectionDir);
displace.ProjectToLine(pOrg, arrowDir);
Base::Vector3d offset = pOrg + displace;
sectionLine->setPos(offset.x,offset.y);

View File

@ -32,6 +32,7 @@
namespace TechDraw {
class DrawViewPart;
class DrawViewSection;
class DrawHatch;
}
@ -57,7 +58,7 @@ public:
virtual void updateView(bool update = false) override;
void tidy();
virtual QRectF boundingRect() const override;
virtual void drawSectionLine(bool b);
virtual void drawSectionLine(TechDraw::DrawViewSection* s, bool b);
virtual void drawCenterLines(bool b);
bool showSection;

View File

@ -70,7 +70,7 @@ void QGIViewSection::drawSectionFace()
auto sectionFaces( section->getFaceGeometry() );
if (sectionFaces.empty()) {
Base::Console().Log("INFO - QGIViewSection::drawSectionFace - No sectionFaces available. Check Section plane.\n");
//Base::Console().Log("INFO - QGIViewSection::drawSectionFace - No sectionFaces available. Check Section plane.\n");
return;
}
std::vector<TechDrawGeometry::Face *>::iterator fit = sectionFaces.begin();
@ -111,8 +111,9 @@ void QGIViewSection::updateView(bool update)
}
}
void QGIViewSection::drawSectionLine(bool b)
void QGIViewSection::drawSectionLine(TechDraw::DrawViewSection* s, bool b)
{
Q_UNUSED(b);
Q_UNUSED(s);
//override QGIVP::drawSectionLine
}

View File

@ -39,7 +39,7 @@ public:
virtual void updateView(bool update = false) override;
enum {Type = QGraphicsItem::UserType + 108};
int type() const override { return Type;}
void drawSectionLine(bool b) override;
void drawSectionLine(TechDraw::DrawViewSection* s, bool b) override;
protected:

View File

@ -45,5 +45,9 @@
<file>icons/actions/techdraw-toggleframe.svg</file>
<file>icons/actions/techdraw-projgroup.svg</file>
<file>icons/actions/techdraw-spreadsheet.svg</file>
<file>icons/actions/section-up.svg</file>
<file>icons/actions/section-down.svg</file>
<file>icons/actions/section-left.svg</file>
<file>icons/actions/section-right.svg</file>
</qresource>
</RCC>

View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="64"
height="64"
id="svg2">
<defs
id="defs4">
<marker
refX="0"
refY="0"
orient="auto"
id="TriangleOutM"
style="overflow:visible">
<path
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
transform="scale(0.4,0.4)"
id="path3966"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="TriangleInM"
style="overflow:visible">
<path
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
transform="scale(-0.4,-0.4)"
id="path3957"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="TriangleOutL"
style="overflow:visible">
<path
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
transform="scale(0.8,0.8)"
id="path3963"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="Arrow1Lend"
style="overflow:visible">
<path
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
transform="matrix(-0.8,0,0,-0.8,-10,0)"
id="path3824"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="TriangleInL"
style="overflow:visible">
<path
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
transform="scale(-0.8,-0.8)"
id="path3954"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="Arrow2Lstart"
style="overflow:visible">
<path
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
transform="matrix(1.1,0,0,1.1,1.1,0)"
id="path3839"
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="Arrow1Lstart"
style="overflow:visible">
<path
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
transform="matrix(0.8,0,0,0.8,10,0)"
id="path3821"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
</defs>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(0,-988.36218)"
id="layer1">
<g
transform="matrix(-1,0,0,-1,64.000002,2040.7244)"
id="g7108">
<rect
width="57.698685"
height="57.693031"
x="3.1506577"
y="991.51569"
id="rect7087"
style="color:#000000;fill:#fce94f;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.30412978;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
width="34.819664"
height="34.838646"
x="14.590168"
y="1002.9429"
id="rect2985"
style="color:#000000;fill:#f57900;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.17058085;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<path
d="m 7.4305643,1004.2688 0.1262691,16.6676 0,0.2525 48.9923986,-0.2525 0,-16.415"
id="path3041"
style="color:#000000;fill:none;stroke:#000000;stroke-width:2.29999995;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:6.89999986, 2.29999995;stroke-dashoffset:0;marker:none;marker-start:url(#TriangleInM);marker-end:url(#TriangleOutM);visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="64"
height="64"
id="svg2">
<defs
id="defs4">
<marker
refX="0"
refY="0"
orient="auto"
id="TriangleOutM"
style="overflow:visible">
<path
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
transform="scale(0.4,0.4)"
id="path3966"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="TriangleInM"
style="overflow:visible">
<path
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
transform="scale(-0.4,-0.4)"
id="path3957"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="TriangleOutL"
style="overflow:visible">
<path
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
transform="scale(0.8,0.8)"
id="path3963"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="Arrow1Lend"
style="overflow:visible">
<path
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
transform="matrix(-0.8,0,0,-0.8,-10,0)"
id="path3824"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="TriangleInL"
style="overflow:visible">
<path
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
transform="scale(-0.8,-0.8)"
id="path3954"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="Arrow2Lstart"
style="overflow:visible">
<path
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
transform="matrix(1.1,0,0,1.1,1.1,0)"
id="path3839"
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="Arrow1Lstart"
style="overflow:visible">
<path
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
transform="matrix(0.8,0,0,0.8,10,0)"
id="path3821"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
</defs>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(0,-988.36218)"
id="layer1">
<g
transform="matrix(0,-1,1,0,-988.3622,1052.3622)"
id="g7108">
<rect
width="57.698685"
height="57.693031"
x="3.1506577"
y="991.51569"
id="rect7087"
style="color:#000000;fill:#fce94f;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.30412978;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
width="34.819664"
height="34.838646"
x="14.590168"
y="1002.9429"
id="rect2985"
style="color:#000000;fill:#f57900;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.17058085;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<path
d="m 7.4305643,1004.2688 0.1262691,16.6676 0,0.2525 48.9923986,-0.2525 0,-16.415"
id="path3041"
style="color:#000000;fill:none;stroke:#000000;stroke-width:2.29999995;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:6.89999986, 2.29999995;stroke-dashoffset:0;marker:none;marker-start:url(#TriangleInM);marker-end:url(#TriangleOutM);visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="64"
height="64"
id="svg2">
<defs
id="defs4">
<marker
refX="0"
refY="0"
orient="auto"
id="TriangleOutM"
style="overflow:visible">
<path
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
transform="scale(0.4,0.4)"
id="path3966"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="TriangleInM"
style="overflow:visible">
<path
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
transform="scale(-0.4,-0.4)"
id="path3957"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="TriangleOutL"
style="overflow:visible">
<path
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
transform="scale(0.8,0.8)"
id="path3963"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="Arrow1Lend"
style="overflow:visible">
<path
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
transform="matrix(-0.8,0,0,-0.8,-10,0)"
id="path3824"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="TriangleInL"
style="overflow:visible">
<path
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
transform="scale(-0.8,-0.8)"
id="path3954"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="Arrow2Lstart"
style="overflow:visible">
<path
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
transform="matrix(1.1,0,0,1.1,1.1,0)"
id="path3839"
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="Arrow1Lstart"
style="overflow:visible">
<path
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
transform="matrix(0.8,0,0,0.8,10,0)"
id="path3821"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
</defs>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(0,-988.36218)"
id="layer1">
<g
transform="matrix(0,1,-1,0,1052.3622,988.3622)"
id="g7108">
<rect
width="57.698685"
height="57.693031"
x="3.1506577"
y="991.51569"
id="rect7087"
style="color:#000000;fill:#fce94f;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.30412978;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
width="34.819664"
height="34.838646"
x="14.590168"
y="1002.9429"
id="rect2985"
style="color:#000000;fill:#f57900;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.17058085;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<path
d="m 7.4305643,1004.2688 0.1262691,16.6676 0,0.2525 48.9923986,-0.2525 0,-16.415"
id="path3041"
style="color:#000000;fill:none;stroke:#000000;stroke-width:2.29999995;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:6.89999986, 2.29999995;stroke-dashoffset:0;marker:none;marker-start:url(#TriangleInM);marker-end:url(#TriangleOutM);visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="64"
height="64"
id="svg2">
<defs
id="defs4">
<marker
refX="0"
refY="0"
orient="auto"
id="TriangleOutM"
style="overflow:visible">
<path
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
transform="scale(0.4,0.4)"
id="path3966"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="TriangleInM"
style="overflow:visible">
<path
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
transform="scale(-0.4,-0.4)"
id="path3957"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="TriangleOutL"
style="overflow:visible">
<path
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
transform="scale(0.8,0.8)"
id="path3963"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="Arrow1Lend"
style="overflow:visible">
<path
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
transform="matrix(-0.8,0,0,-0.8,-10,0)"
id="path3824"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="TriangleInL"
style="overflow:visible">
<path
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
transform="scale(-0.8,-0.8)"
id="path3954"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="Arrow2Lstart"
style="overflow:visible">
<path
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
transform="matrix(1.1,0,0,1.1,1.1,0)"
id="path3839"
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" />
</marker>
<marker
refX="0"
refY="0"
orient="auto"
id="Arrow1Lstart"
style="overflow:visible">
<path
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
transform="matrix(0.8,0,0,0.8,10,0)"
id="path3821"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
</marker>
</defs>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(0,-988.36218)"
id="layer1">
<rect
width="57.698685"
height="57.693031"
x="3.1506577"
y="991.51569"
id="rect7087"
style="color:#000000;fill:#fce94f;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.30412978;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
width="34.819664"
height="34.838646"
x="14.590168"
y="1002.9429"
id="rect2985"
style="color:#000000;fill:#f57900;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.17058085;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<path
d="m 7.4305643,1004.2688 0.1262691,16.6676 0,0.2525 48.9923986,-0.2525 0,-16.415"
id="path3041"
style="color:#000000;fill:none;stroke:#000000;stroke-width:2.29999995;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:6.89999986, 2.29999995;stroke-dashoffset:0;marker:none;marker-start:url(#TriangleInM);marker-end:url(#TriangleOutM);visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -50,6 +50,7 @@
using namespace Gui;
using namespace TechDrawGui;
void _printVect(char* label, Base::Vector3d v);
TaskSectionView::TaskSectionView(TechDraw::DrawViewPart* base, TechDraw::DrawViewSection* section) :
ui(new Ui_TaskSectionView),
@ -58,16 +59,14 @@ TaskSectionView::TaskSectionView(TechDraw::DrawViewPart* base, TechDraw::DrawVie
{
ui->setupUi(this);
connect(ui->cbHoriz, SIGNAL(clicked(bool)),
this, SLOT(onHorizontalClicked(bool)));
connect(ui->cbVert, SIGNAL(clicked(bool)),
this, SLOT(onVerticalClicked(bool)));
connect(ui->cbNormal, SIGNAL(clicked(bool)),
this, SLOT(onNormalClicked(bool)));
connect(ui->cbReverse, SIGNAL(clicked(bool)),
this, SLOT(onReverseClicked(bool)));
connect(ui->pbCalc, SIGNAL(clicked(bool)),
this, SLOT(onCalcClicked(bool)));
connect(ui->pb_Up, SIGNAL(clicked(bool)),
this, SLOT(onUpClicked(bool)));
connect(ui->pb_Down, SIGNAL(clicked(bool)),
this, SLOT(onDownClicked(bool)));
connect(ui->pb_Right, SIGNAL(clicked(bool)),
this, SLOT(onRightClicked(bool)));
connect(ui->pb_Left, SIGNAL(clicked(bool)),
this, SLOT(onLeftClicked(bool)));
connect(ui->pbReset, SIGNAL(clicked(bool)),
this, SLOT(onResetClicked(bool)));
@ -83,12 +82,9 @@ TaskSectionView::~TaskSectionView()
void TaskSectionView::saveInitialValues()
{
saveSym = m_base->SymbolSection.getValue();
saveHorizSectionLine = m_base->HorizSectionLine.getValue(); //true(horiz)/false(vert)
saveArrowUpSection = m_base->ArrowUpSection.getValue(); //true(up/right)/false(down/left)
saveSectionOrigin = m_section->SectionOrigin.getValue();
saveSectionXDir = m_section->XAxisDirection.getValue();
saveSectionDirection = m_section->Direction.getValue();
saveSym = m_section->SectionSymbol.getValue();
saveSectionOrigin = m_base->getCentroid();
saveSectionProjDir = m_section->Direction.getValue();
saveSectionNormal = m_section->SectionNormal.getValue();
saveLabel = m_section->Label.getValue();
}
@ -98,172 +94,203 @@ void TaskSectionView::resetValues()
{
ui->leSymbol->setText(QString::fromUtf8(saveSym.data(), saveSym.size()));
ui->cbHoriz->setChecked(false);
ui->cbVert->setChecked(false);
ui->cbNormal->setChecked(false);
ui->cbReverse->setChecked(false);
if (saveHorizSectionLine && !saveArrowUpSection) {
ui->cbHoriz->setChecked(true);
ui->cbNormal->setChecked(true);
} else if (saveHorizSectionLine && saveArrowUpSection) {
ui->cbHoriz->setChecked(true);
ui->cbReverse->setChecked(true);
} else if (!saveHorizSectionLine && !saveArrowUpSection) {
ui->cbVert->setChecked(true);
ui->cbNormal->setChecked(true);
} else if (!saveHorizSectionLine && saveArrowUpSection) {
ui->cbVert->setChecked(true);
ui->cbReverse->setChecked(true);
} else {
Base::Console().Error("%s Symbol Line Direction is invalid\n", m_base->getNameInDocument());
}
checkAll(false);
enableAll(true);
ui->sbOrgX->setValue(saveSectionOrigin.x);
ui->sbOrgY->setValue(saveSectionOrigin.y);
ui->sbOrgZ->setValue(saveSectionOrigin.z);
sectionProjDir = saveSectionProjDir;
sectionNormal = saveSectionNormal;
ui->sbXX->setValue(saveSectionXDir.x);
ui->sbXY->setValue(saveSectionXDir.y);
ui->sbXZ->setValue(saveSectionXDir.z);
ui->sb_OrgX->setValue(saveSectionOrigin.x);
ui->sb_OrgY->setValue(saveSectionOrigin.y);
ui->sb_OrgZ->setValue(saveSectionOrigin.z);
ui->leProjDir->setReadOnly(true);
ui->leProjDir->setText(formatVector(saveSectionDirection));
ui->leProjDir->setText(formatVector(saveSectionProjDir));
ui->leNormal->setReadOnly(true);
ui->leNormal->setText(formatVector(saveSectionNormal));
m_section->Label.setValue(saveLabel.c_str());
Base::Console().Message("");
}
//calculate good starting points from base view and push buttons
void TaskSectionView::calcValues()
{
arrowDir = Base::Vector3d(0,-1,0);
//section arrows should point to "remaining body" of part after sectioning.
//so the arrow direction is (-1) * sectionPlaneNormal/sectionViewDirection
if (ui->cbHoriz->isChecked() &&
ui->cbNormal->isChecked()) {
arrowDir = -1.0 * m_base->getVDir();
} else if (ui->cbHoriz->isChecked() &&
ui->cbReverse->isChecked()) {
arrowDir = m_base->getVDir();
} else if (ui->cbVert->isChecked() &&
ui->cbNormal->isChecked()) {
arrowDir = -1.0 * m_base->getUDir();
} else if (ui->cbVert->isChecked() &&
ui->cbReverse->isChecked() ) {
arrowDir = m_base->getUDir();
} else {
Base::Console().Error("%s Symbol Line Direction is invalid\n", m_base->getNameInDocument());
}
Base::Vector3d stdX(1.0,0.0,0.0);
Base::Vector3d stdY(0.0,1.0,0.0);
Base::Vector3d stdZ(0.0,0.0,1.0);
Base::Vector3d view = m_base->Direction.getValue();
sectionDir = "unset";
if (ui->pb_Up->isChecked()) {
sectionDir = "Up";
sectionProjDir = view;
sectionNormal = Base::Vector3d(view.x,view.z,-view.y);
if (view == stdZ) {
sectionProjDir = (-1.0 * stdY);
sectionNormal = (-1.0 * stdY);
} else if (view == (-1.0 * stdZ)) {
sectionProjDir = (-1.0 * stdY);
sectionNormal = (-1.0 * stdY);
}
} else if (ui->pb_Down->isChecked()) {
sectionDir = "Down";
sectionProjDir = view;
sectionNormal = Base::Vector3d(-view.x,-view.z,view.y);
if (view == stdZ) {
sectionProjDir = stdY;
sectionNormal = stdY;
} else if (view == (-1.0 * stdZ)) {
sectionProjDir = stdY;
sectionNormal = stdY;
}
} else if (ui->pb_Left->isChecked()) {
sectionDir = "Left";
sectionProjDir = Base::Vector3d(-view.y,view.x,view.z);
sectionNormal = Base::Vector3d(-view.y,view.x,0.0);
if (view == stdZ) {
sectionProjDir = stdX;
sectionNormal = stdX;
} else if (view == (-1.0 * stdZ)) {
sectionProjDir = stdX;
sectionNormal = stdX;
}
} else if (ui->pb_Right->isChecked()) {
sectionProjDir = Base::Vector3d(view.y,-view.x,view.z);
sectionNormal = Base::Vector3d(view.y,-view.x,0.0);
if (view == stdZ) {
sectionProjDir = -1.0 * stdX;
sectionNormal = -1.0 * stdX;
} else if (view == (-1.0 * stdZ)) {
sectionProjDir = -1.0 * stdX;
sectionNormal = -1.0 * stdX;
}
}
sectionNormal = -1.0 * arrowDir; //point of observer (ViewDirection) is away from direction of arrows
ui->leNormal->setText(formatVector(sectionNormal));
sectionProjDir = sectionNormal; //typical use-case is view perp to face
ui->leProjDir->setText(formatVector(sectionProjDir));
sectionOrigin = m_base->getCentroid(); //middle of the object
ui->sbOrgX->setValue(sectionOrigin.x);
ui->sbOrgY->setValue(sectionOrigin.y);
ui->sbOrgZ->setValue(sectionOrigin.z);
sectionXDir = m_base->Direction.getValue(); //rotate 90*
ui->sbXX->setValue(sectionXDir.x);
ui->sbXY->setValue(sectionXDir.y);
ui->sbXZ->setValue(sectionXDir.z);
Base::Console().Message("Press Reset, OK or Cancel to continue\n");
}
//move values from screen to DocObjs
void TaskSectionView::updateValues()
{
m_section->SectionDirection.setValue(sectionDir);
m_section->Direction.setValue(sectionProjDir);
m_section->SectionNormal.setValue(sectionNormal);
Base::Vector3d origin(ui->sbOrgX->value().getValue(),
ui->sbOrgY->value().getValue(),
ui->sbOrgZ->value().getValue());
Base::Vector3d origin(ui->sb_OrgX->value().getValue(),
ui->sb_OrgY->value().getValue(),
ui->sb_OrgZ->value().getValue());
m_section->SectionOrigin.setValue(origin);
m_section->SectionDirection.setValue(sectionDir);
m_section->SectionSymbol.setValue(ui->leSymbol->text().toUtf8().constData());
Base::Vector3d xDirIn(ui->sbXX->value().getValue(),
ui->sbXY->value().getValue(),
ui->sbXZ->value().getValue());
//edit is: can't be zero, can't be same/recip as sectionProjDir. anything else is ok.
if ((xDirIn.Length() < FLT_EPSILON) ||
(xDirIn == sectionProjDir) ||
(xDirIn == -1.0 * sectionProjDir)) {
Base::Console().Message("XAxisDirection Invalid. Will be substituted.\n");
}
m_section->XAxisDirection.setValue(xDirIn);
m_base->SymbolSection.setValue(ui->leSymbol->text().toUtf8().constData());
m_base->HorizSectionLine.setValue(ui->cbHoriz->isChecked());
m_base->ArrowUpSection.setValue(!ui->cbNormal->isChecked());
m_section->SymbolSection.setValue(ui->leSymbol->text().toUtf8().constData());
m_section->HorizSectionLine.setValue(ui->cbHoriz->isChecked());
m_section->ArrowUpSection.setValue(!ui->cbNormal->isChecked());
std::string symbol = m_base->SymbolSection.getValue();
std::string symbolText = "Section " + symbol + "-" + symbol;
if (symbolText.compare(m_section->Label.getValue())) {
m_section->Label.setValue(symbolText.c_str());
}
m_base->touch();
m_base->getDocument()->recompute();
}
void TaskSectionView::onHorizontalClicked(bool b)
void TaskSectionView::blockButtons(bool b)
{
Q_UNUSED(b);
ui->cbHoriz->blockSignals(true);
ui->cbVert->blockSignals(true);
ui->cbHoriz->setChecked(true);
ui->cbVert->setChecked(false);
ui->cbHoriz->blockSignals(false);
ui->cbVert->blockSignals(false);
ui->pb_Up->blockSignals(b);
ui->pb_Down->blockSignals(b);
ui->pb_Left->blockSignals(b);
ui->pb_Right->blockSignals(b);
}
void TaskSectionView::onVerticalClicked(bool b)
void TaskSectionView::turnOnUp()
{
Q_UNUSED(b);
ui->cbHoriz->blockSignals(true);
ui->cbVert->blockSignals(true);
ui->cbVert->setChecked(true);
ui->cbHoriz->setChecked(false);
ui->cbHoriz->blockSignals(false);
ui->cbVert->blockSignals(false);
}
void TaskSectionView::onNormalClicked(bool b)
{
Q_UNUSED(b);
ui->cbNormal->blockSignals(true);
ui->cbReverse->blockSignals(true);
ui->cbNormal->setChecked(true);
ui->cbReverse->setChecked(false);
ui->cbNormal->blockSignals(false);
ui->cbReverse->blockSignals(false);
}
void TaskSectionView::onReverseClicked(bool b)
{
Q_UNUSED(b);
ui->cbReverse->blockSignals(true);
ui->cbNormal->blockSignals(true);
ui->cbReverse->setChecked(true);
ui->cbNormal->setChecked(false);
ui->cbReverse->blockSignals(false);
ui->cbNormal->blockSignals(false);
}
void TaskSectionView::onCalcClicked(bool b)
{
Q_UNUSED(b);
blockButtons(true);
checkAll(false);
enableAll(false);
ui->pb_Up->setChecked(true);
ui->pb_Up->setEnabled(true);
blockButtons(false);
calcValues();
updateValues();
}
void TaskSectionView::turnOnDown()
{
blockButtons(true);
checkAll(false);
enableAll(false);
ui->pb_Down->setChecked(true);
ui->pb_Down->setEnabled(true);
blockButtons(false);
calcValues();
updateValues();
}
void TaskSectionView::turnOnLeft()
{
blockButtons(true);
checkAll(false);
enableAll(false);
ui->pb_Left->setChecked(true);
ui->pb_Left->setEnabled(true);
blockButtons(false);
calcValues();
updateValues();
}
void TaskSectionView::turnOnRight()
{
blockButtons(true);
checkAll(false);
enableAll(false);
ui->pb_Right->setChecked(true);
ui->pb_Right->setEnabled(true);
blockButtons(false);
calcValues();
updateValues();
}
void TaskSectionView::checkAll(bool b)
{
blockButtons(true);
ui->pb_Up->setChecked(b);
ui->pb_Down->setChecked(b);
ui->pb_Left->setChecked(b);
ui->pb_Right->setChecked(b);
blockButtons(false);
}
void TaskSectionView::enableAll(bool b)
{
blockButtons(true);
ui->pb_Up->setEnabled(b);
ui->pb_Down->setEnabled(b);
ui->pb_Left->setEnabled(b);
ui->pb_Right->setEnabled(b);
blockButtons(false);
}
void TaskSectionView::onUpClicked(bool b)
{
Q_UNUSED(b);
turnOnUp();
}
void TaskSectionView::onDownClicked(bool b)
{
Q_UNUSED(b);
turnOnDown();
}
void TaskSectionView::onLeftClicked(bool b)
{
Q_UNUSED(b);
turnOnLeft();
}
void TaskSectionView::onRightClicked(bool b)
{
Q_UNUSED(b);
turnOnRight();
}
void TaskSectionView::onResetClicked(bool b)
{
Q_UNUSED(b);
@ -275,10 +302,7 @@ void TaskSectionView::onResetClicked(bool b)
bool TaskSectionView::accept()
{
//calcValues();
updateValues();
std::string BaseName = m_base->getNameInDocument();
Gui::Command::doCommand(Gui::Command::Gui,"App.activeDocument().%s.ShowSectionLine=True",BaseName.c_str());
return true;
}
@ -287,7 +311,6 @@ bool TaskSectionView::reject()
std::string BaseName = m_base->getNameInDocument();
std::string PageName = m_base->findParentPage()->getNameInDocument();
std::string SectionName = m_section->getNameInDocument();
Gui::Command::doCommand(Gui::Command::Gui,"App.activeDocument().%s.ShowSectionLine=False",BaseName.c_str());
Gui::Command::doCommand(Gui::Command::Gui,"App.activeDocument().%s.removeView(App.activeDocument().%s)",
PageName.c_str(),SectionName.c_str());
Gui::Command::doCommand(Gui::Command::Gui,"App.activeDocument().removeObject('%s')",SectionName.c_str());
@ -310,6 +333,11 @@ QString TaskSectionView::formatVector(Base::Vector3d v)
return data;
}
void _printVect(char* label, Base::Vector3d v)
{
Base::Console().Message("printVect: %s (%3f,%.3f,%.3f)\n",label,v.x,v.y,v.z);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TaskDlgSectionView::TaskDlgSectionView(TechDraw::DrawViewPart* base, TechDraw::DrawViewSection* section) :
TaskDialog()

View File

@ -50,14 +50,20 @@ public:
virtual bool reject();
protected Q_SLOTS:
void onHorizontalClicked(bool b);
void onVerticalClicked(bool b);
void onNormalClicked(bool b);
void onReverseClicked(bool b);
void onCalcClicked(bool b);
void onUpClicked(bool b);
void onDownClicked(bool b);
void onLeftClicked(bool b);
void onRightClicked(bool b);
void onResetClicked(bool b);
protected:
void turnOnUp(void);
void turnOnDown(void);
void turnOnLeft(void);
void turnOnRight(void);
void checkAll(bool b);
void enableAll(bool b);
void blockButtons(bool b);
void changeEvent(QEvent *e);
void resetValues();
void calcValues();
@ -72,19 +78,17 @@ private:
Base::Vector3d sectionNormal;
Base::Vector3d sectionProjDir;
Base::Vector3d sectionOrigin;
Base::Vector3d sectionXDir;
char* sectionDir;
Base::Vector3d arrowDir;
std::string saveSym;
std::string saveLabel;
bool saveHorizSectionLine;
bool saveArrowUpSection;
Base::Vector3d saveSectionDirection;
Base::Vector3d saveSectionXDir;
Base::Vector3d saveSectionProjDir;
Base::Vector3d saveSectionOrigin;
Base::Vector3d saveSectionNormal;
};
class TaskDlgSectionView : public Gui::TaskView::TaskDialog

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>358</width>
<height>461</height>
<width>410</width>
<height>492</height>
</rect>
</property>
<property name="sizePolicy">
@ -23,7 +23,7 @@
</size>
</property>
<property name="windowTitle">
<string>Calculate Section Parameters</string>
<string>Quick Section Parameters</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
@ -35,25 +35,90 @@
</sizepolicy>
</property>
<property name="title">
<string>Section Line Parameters</string>
<string>Define Your Section</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout_4">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="symbolLabel">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Symbol</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="0" column="2">
<widget class="QLineEdit" name="leSymbol">
<property name="toolTip">
<string>Identifier for this section</string>
</property>
</widget>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>A</string>
<string>Origin Y</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::QuantitySpinBox" name="sb_OrgX">
<property name="toolTip">
<string>Location of section plane</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Origin X</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Origin Z</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::QuantitySpinBox" name="sb_OrgY">
<property name="toolTip">
<string>Location of section plane</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::QuantitySpinBox" name="sb_OrgZ">
<property name="toolTip">
<string>Location of section plane</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
@ -61,150 +126,146 @@
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<item row="0" column="2">
<widget class="QPushButton" name="pb_Down">
<property name="toolTip">
<string>Looking down</string>
</property>
<property name="text">
<string>Arrows</string>
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/actions/section-down.svg</normalon>
</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="cbHoriz">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="6">
<widget class="QPushButton" name="pb_Right">
<property name="toolTip">
<string>Looking right</string>
</property>
<property name="text">
<string>Horizontal</string>
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/actions/section-right.svg</normalon>
</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="cbVert">
<item row="0" column="4">
<widget class="QPushButton" name="pb_Left">
<property name="toolTip">
<string>Looking left</string>
</property>
<property name="text">
<string>Vertical</string>
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/actions/section-left.svg</normalon>
</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<widget class="QPushButton" name="pb_Up">
<property name="toolTip">
<string>Looking up</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Line</string>
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/actions/section-up.svg</normalon>
</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="cbReverse">
<property name="text">
<string>Up/Right</string>
<item row="0" column="3">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="cbNormal">
<property name="text">
<string>Down/Left</string>
<item row="0" column="5">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Section View Parameters</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1,1">
<item row="1" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>X</string>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="Gui::QuantitySpinBox" name="sbXY">
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Y</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="Gui::QuantitySpinBox" name="sbXX">
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::QuantitySpinBox" name="sbOrgY">
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::QuantitySpinBox" name="sbOrgX">
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Section Origin</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label">
<property name="text">
<string>X Axis </string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Z</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Gui::QuantitySpinBox" name="sbOrgZ">
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="Gui::QuantitySpinBox" name="sbXZ">
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</spacer>
</item>
</layout>
</item>
@ -270,15 +331,11 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pbCalc">
<property name="text">
<string>Calc</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbReset">
<property name="toolTip">
<string>Start over</string>
</property>
<property name="text">
<string>Reset</string>
</property>
@ -289,6 +346,19 @@
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
@ -298,6 +368,8 @@
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
</customwidgets>
<resources/>
<resources>
<include location="../../../../../Documents/CAD/DrawingModule/Resources/TechDraw.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -143,7 +143,7 @@ bool ViewProviderProjGroup::setEdit(int ModNum)
void ViewProviderProjGroup::unsetEdit(int ModNum)
{
Base::Console().Message("TRACE - VPPG::unSetEdit(%d) \n",ModNum);
Q_UNUSED(ModNum);
Gui::Control().closeDialog();
}

View File

@ -66,9 +66,6 @@ void ViewProviderViewPart::updateData(const App::Property* prop)
prop == &(getViewObject()->ArcCenterMarks) ||
prop == &(getViewObject()->CenterScale) ||
prop == &(getViewObject()->ShowSectionLine) ||
prop == &(getViewObject()->HorizSectionLine) ||
prop == &(getViewObject()->ArrowUpSection) ||
prop == &(getViewObject()->SymbolSection) ||
prop == &(getViewObject()->HorizCenterLine) ||
prop == &(getViewObject()->VertCenterLine) ) {
// redraw QGIVP