[TD]Fix handling of CL flip parameter

This commit is contained in:
wandererfan
2020-03-20 20:40:09 -04:00
committed by WandererFan
parent 1cfe6d2cc7
commit 30a0047cd4
2 changed files with 25 additions and 14 deletions

View File

@@ -802,17 +802,24 @@ TechDraw::BaseGeom* CenterLine::scaledGeometry(TechDraw::DrawViewPart* partFeat)
TechDraw::BaseGeom* newGeom = nullptr;
Base::Vector3d p1 = ends.first;
Base::Vector3d p2 = ends.second;
gp_Pnt gp1(p1.x,p1.y,p1.z);
gp_Pnt gp2(p2.x,p2.y,p2.z);
TopoDS_Edge e = BRepBuilderAPI_MakeEdge(gp1, gp2);
TopoDS_Shape s = TechDraw::scaleShape(e, scale);
TopoDS_Edge newEdge = TopoDS::Edge(s);
newGeom = TechDraw::BaseGeom::baseFactory(newEdge);
newGeom->classOfEdge = ecHARD;
newGeom->hlrVisible = true;
newGeom->cosmetic = true;
newGeom->source(CENTERLINE);
newGeom->setCosmeticTag(getTagAsString());
if (!p1.IsEqual(p2, 0.00001)) {
gp_Pnt gp1(p1.x,p1.y,p1.z);
gp_Pnt gp2(p2.x,p2.y,p2.z);
TopoDS_Edge e = BRepBuilderAPI_MakeEdge(gp1, gp2);
TopoDS_Shape s = TechDraw::scaleShape(e, scale);
TopoDS_Edge newEdge = TopoDS::Edge(s);
newGeom = TechDraw::BaseGeom::baseFactory(newEdge);
newGeom->classOfEdge = ecHARD;
newGeom->hlrVisible = true;
newGeom->cosmetic = true;
newGeom->source(CENTERLINE);
newGeom->setCosmeticTag(getTagAsString());
} else {
Base::Console().Warning("Centerline endpoints are equal. Could not draw.\n");
//what to do here? //return current geom?
return m_geometry;
}
return newGeom;
}

View File

@@ -185,6 +185,7 @@ void TaskCenterLine::setUiPrimary()
ui->rbAligned->setEnabled(false);
else
ui->rbAligned->setEnabled(true);
if (m_type == 1) // only if line, feature is enabled
ui->cbFlip->setEnabled(true);
else
@@ -238,6 +239,7 @@ void TaskCenterLine::setUiEdit()
ui->cbFlip->setChecked(true);
else
ui->cbFlip->setChecked(false);
if (m_cl->m_type == 1) // only if line, feature is enabled
ui->cbFlip->setEnabled(true);
else
@@ -264,14 +266,16 @@ void TaskCenterLine::createCenterLine(void)
m_mode = CenterLine::CLMODE::ALIGNED;
}
bool flip = ui->cbFlip->isChecked();
TechDraw::CenterLine* cl = CenterLine::CenterLineBuilder(m_partFeat,
m_subNames,
m_mode);
m_mode,
flip);
if (cl != nullptr) {
cl->setShifts(hShift, vShift);
cl->setExtend(extendBy);
cl->setRotate(rotate);
cl->m_flip2Line = ui->cbFlip->checkState();
cl->m_flip2Line = ui->cbFlip->isChecked();
App::Color ac;
ac.setValue<QColor>(ui->cpLineColor->color());
cl->m_format.m_color = ac;
@@ -310,7 +314,7 @@ void TaskCenterLine::updateCenterLine(void)
m_cl->m_hShift = ui->qsbHorizShift->rawValue();
m_cl->m_extendBy = ui->qsbExtend->rawValue();
m_cl->m_type = m_type;
m_cl->m_flip2Line = ui->cbFlip->checkState();
m_cl->m_flip2Line = ui->cbFlip->isChecked();
m_partFeat->replaceCenterLine(m_cl);
m_partFeat->refreshCLGeoms();
m_partFeat->requestPaint();