[TD]fix Dimension export to DXF
This commit is contained in:
committed by
WandererFan
parent
460d153d6c
commit
866da5980c
@@ -782,26 +782,23 @@ private:
|
||||
} else if (dvd->Type.isValue("Radius")) {
|
||||
Base::Vector3d textLocn(dvd->X.getValue() + parentX, dvd->Y.getValue() + parentY, 0.0);
|
||||
arcPoints pts = dvd->getArcPoints();
|
||||
pointPair arrowPts = dvd->getArrowPositions();
|
||||
Base::Vector3d center = pts.center;
|
||||
center.y = -center.y;
|
||||
Base::Vector3d arcPoint = pts.onCurve.first;
|
||||
arcPoint.y = -arcPoint.y;
|
||||
center = center + parentPos;
|
||||
arcPoint = arcPoint + parentPos;
|
||||
Base::Vector3d lineDir = (arrowPts.first - arrowPts.second).Normalize();
|
||||
Base::Vector3d arcPoint = center + lineDir * pts.radius;
|
||||
writer.exportRadialDim(center, textLocn, arcPoint, dimText);
|
||||
} else if(dvd->Type.isValue("Diameter")){
|
||||
Base::Vector3d textLocn(dvd->X.getValue() + parentX, dvd->Y.getValue() + parentY, 0.0);
|
||||
arcPoints pts = dvd->getArcPoints();
|
||||
pointPair arrowPts = dvd->getArrowPositions();
|
||||
Base::Vector3d center = pts.center;
|
||||
center.y = -center.y;
|
||||
double radius = pts.radius;
|
||||
Base::Vector3d lineDir = (textLocn - center).Normalize();
|
||||
Base::Vector3d end1 = center + lineDir * radius;
|
||||
end1.y = -end1.y;
|
||||
Base::Vector3d end2 = center - lineDir * radius;
|
||||
end2.y = -end2.y;
|
||||
end1 = end1 + parentPos;
|
||||
end2 = end2 + parentPos;
|
||||
center = center + parentPos;
|
||||
Base::Vector3d lineDir = (arrowPts.first - arrowPts.second).Normalize();
|
||||
Base::Vector3d end1 = center + lineDir * pts.radius;
|
||||
Base::Vector3d end2 = center - lineDir * pts.radius;
|
||||
writer.exportDiametricDim(textLocn, end1, end2, dimText);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,13 +154,33 @@ DrawViewDimension::DrawViewDimension(void)
|
||||
|
||||
//initialize the descriptive geometry.
|
||||
//TODO: should this be more like DVP with a "geometry object"?
|
||||
resetLinear();
|
||||
resetAngular();
|
||||
resetArc();
|
||||
m_hasGeometry = false;
|
||||
}
|
||||
|
||||
DrawViewDimension::~DrawViewDimension()
|
||||
{
|
||||
delete measurement;
|
||||
measurement = nullptr;
|
||||
}
|
||||
|
||||
void DrawViewDimension::resetLinear(void)
|
||||
{
|
||||
m_linearPoints.first = Base::Vector3d(0,0,0);
|
||||
m_linearPoints.second = Base::Vector3d(0,0,0);
|
||||
}
|
||||
|
||||
void DrawViewDimension::resetAngular(void)
|
||||
{
|
||||
m_anglePoints.ends.first = Base::Vector3d(0,0,0);
|
||||
m_anglePoints.ends.second = Base::Vector3d(0,0,0);
|
||||
m_anglePoints.vertex = Base::Vector3d(0,0,0);
|
||||
}
|
||||
|
||||
void DrawViewDimension::resetArc(void)
|
||||
{
|
||||
m_arcPoints.isArc = false;
|
||||
m_arcPoints.center = Base::Vector3d(0,0,0);
|
||||
m_arcPoints.onCurve.first = Base::Vector3d(0,0,0);
|
||||
@@ -169,13 +189,6 @@ DrawViewDimension::DrawViewDimension(void)
|
||||
m_arcPoints.arcEnds.second = Base::Vector3d(0,0,0);
|
||||
m_arcPoints.midArc = Base::Vector3d(0,0,0);
|
||||
m_arcPoints.arcCW = false;
|
||||
m_hasGeometry = false;
|
||||
}
|
||||
|
||||
DrawViewDimension::~DrawViewDimension()
|
||||
{
|
||||
delete measurement;
|
||||
measurement = nullptr;
|
||||
}
|
||||
|
||||
void DrawViewDimension::onChanged(const App::Property* prop)
|
||||
@@ -408,6 +421,10 @@ App::DocumentObjectExecReturn *DrawViewDimension::execute(void)
|
||||
|
||||
const std::vector<std::string> &subElements = References2D.getSubValues();
|
||||
|
||||
resetLinear();
|
||||
resetAngular();
|
||||
resetArc();
|
||||
|
||||
if ( Type.isValue("Distance") ||
|
||||
Type.isValue("DistanceX") ||
|
||||
Type.isValue("DistanceY") ) {
|
||||
@@ -564,7 +581,7 @@ App::DocumentObjectExecReturn *DrawViewDimension::execute(void)
|
||||
pts.arcEnds.second = Base::Vector3d(aoe->endPnt.x,aoe->endPnt.y,0.0);
|
||||
pts.midArc = Base::Vector3d(aoe->midPnt.x,aoe->midPnt.y,0.0);
|
||||
pts.arcCW = aoe->cw;
|
||||
pts.onCurve.first = Base::Vector3d(aoe->midPnt.x,aoe->midPnt.y,0.0);
|
||||
pts.onCurve.first = pts.center + Base::Vector3d(1,0,0) * rAvg; //arbitrary point on edge
|
||||
pts.onCurve.second = pts.center + Base::Vector3d(-1,0,0) * rAvg; //arbitrary point on edge
|
||||
}
|
||||
} else if (base && base->geomType == TechDraw::GeomType::BSPLINE) {
|
||||
|
||||
@@ -198,6 +198,10 @@ protected:
|
||||
pointPair m_linearPoints;
|
||||
pointPair m_arrowPositions;
|
||||
|
||||
void resetLinear(void);
|
||||
void resetAngular(void);
|
||||
void resetArc(void);
|
||||
|
||||
private:
|
||||
static const char* TypeEnums[];
|
||||
static const char* MeasureTypeEnums[];
|
||||
|
||||
Reference in New Issue
Block a user