[TD]ANSI/ASME section line conformance

This commit is contained in:
wandererfan
2024-02-19 08:48:56 -05:00
committed by WandererFan
parent e6fa334a7b
commit fc4cd682bb
10 changed files with 30 additions and 65 deletions

View File

@@ -522,3 +522,8 @@ int Preferences::LineCapIndex()
return getPreferenceGroup("General")->GetInt("EdgeCapStyle", 0x20);
}
//! returns 0 (use ANSI style section cut line) or 1 (use ISO style section cut line)
int Preferences::sectionLineConvention()
{
return getPreferenceGroup("Standards")->GetInt("SectionLineStandard", 1);
}

View File

@@ -124,6 +124,8 @@ public:
static std::string currentLineDefFile();
static std::string currentElementDefFile();
static int sectionLineConvention();
};

View File

@@ -156,19 +156,6 @@ double PreferencesGui::edgeFuzz()
return Preferences::getPreferenceGroup("General")->GetFloat("EdgeFuzz", 10.0);
}
// this is for the iso vs ansi positioning of arrows and text. rename to sectionLineConvention?
Qt::PenStyle PreferencesGui::sectionLineStyle()
{
Qt::PenStyle sectStyle = static_cast<Qt::PenStyle> (Preferences::getPreferenceGroup("Decorations")->GetInt("SectionLine", 2));
return sectStyle;
}
bool PreferencesGui::sectionLineMarks()
{
return Preferences::getPreferenceGroup("Decorations")->GetBool("SectionLineMarks", true);
}
QString PreferencesGui::weldingDirectory()
{
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Symbols/Welding/AWS/";

View File

@@ -63,9 +63,6 @@ static double dimArrowSize();
static double edgeFuzz();
static Qt::PenStyle sectionLineStyle();
static bool sectionLineMarks();
static QString weldingDirectory();
static bool showGrid();

View File

@@ -173,12 +173,6 @@ QColor QGIHighlight::getHighlightColor()
return PreferencesGui::sectionLineQColor();
}
//obs??
Qt::PenStyle QGIHighlight::getHighlightStyle()
{
return PreferencesGui::sectionLineStyle();
}
int QGIHighlight::getHoleStyle()
{
return TechDraw::Preferences::mattingStyle();

View File

@@ -67,7 +67,6 @@ public:
protected:
QColor getHighlightColor();
Qt::PenStyle getHighlightStyle();
void makeHighlight();
void makeReference();
void setTools();

View File

@@ -33,6 +33,8 @@
#include <Base/Parameter.h>
#include <Base/Tools.h>
#include <Mod/TechDraw/App/Preferences.h>
#include "QGISectionLine.h"
#include "PreferencesGui.h"
#include "QGIArrow.h"
@@ -73,7 +75,6 @@ QGISectionLine::QGISectionLine() :
addToGroup(m_symbol2);
setWidth(Rez::guiX(0.75)); //a default?
setStyle(getSectionStyle());
setColor(getSectionColor());
}
@@ -81,7 +82,7 @@ QGISectionLine::QGISectionLine() :
void QGISectionLine::draw()
{
prepareGeometryChange();
int format = getPrefSectionStandard();
int format = Preferences::sectionLineConvention();
if (format == ANSISTANDARD) { //"ASME"/"ANSI"
extensionEndsTrad();
} else {
@@ -128,7 +129,7 @@ void QGISectionLine::makeSectionLine()
void QGISectionLine::makeArrows()
{
int format = getPrefSectionStandard();
int format = Preferences::sectionLineConvention();
if (format == ANSISTANDARD) {
makeArrowsTrad();
} else {
@@ -193,7 +194,7 @@ void QGISectionLine::makeArrowsTrad()
void QGISectionLine::makeSymbols()
{
int format = getPrefSectionStandard();
int format = Preferences::sectionLineConvention();
if (format == ANSISTANDARD) {
makeSymbolsTrad();
} else {
@@ -471,25 +472,6 @@ QColor QGISectionLine::getSectionColor()
return PreferencesGui::sectionLineQColor();
}
//SectionLineStyle
void QGISectionLine::setSectionStyle(int style)
{
Qt::PenStyle sectStyle = static_cast<Qt::PenStyle> (style);
setStyle(sectStyle);
}
Qt::PenStyle QGISectionLine::getSectionStyle()
{
return PreferencesGui::sectionLineStyle();
}
//ASME("traditional") vs ISO("reference arrow method") arrows
int QGISectionLine::getPrefSectionStandard()
{
return Preferences::getPreferenceGroup("Standards")->GetInt("SectionLineStandard", ISOSTANDARD);
}
void QGISectionLine::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) {
QStyleOptionGraphicsItem myOption(*option);
myOption.state &= ~QStyle::State_Selected;

View File

@@ -62,7 +62,6 @@ public:
void setDirection(Base::Vector3d dir);
void setArrowDirections(Base::Vector3d dir1, Base::Vector3d dir2);
void setFont(QFont f, double fsize);
void setSectionStyle(int style);
void setSectionColor(QColor c);
void setPathMode(bool mode) { m_pathMode = mode; }
bool pathMode() { return m_pathMode; }
@@ -86,7 +85,6 @@ protected:
void makeSymbolsISO();
void makeChangePointMarks();
void setTools();
int getPrefSectionStandard();
void extensionEndsISO();
void extensionEndsTrad();
double getArrowRotation(Base::Vector3d arrowDir);

View File

@@ -637,6 +637,7 @@ void QGIViewPart::drawAllSectionLines()
void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b)
{
// Base::Console().Message("QGIVP::drawSectionLine()\n");
TechDraw::DrawViewPart* viewPart = static_cast<TechDraw::DrawViewPart*>(getViewObject());
if (!viewPart)
return;
@@ -665,7 +666,6 @@ void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b
QGISectionLine* sectionLine = new QGISectionLine();
addToGroup(sectionLine);
sectionLine->setSymbol(const_cast<char*>(viewSection->SectionSymbol.getValue()));
sectionLine->setSectionStyle(vp->SectionLineStyle.getValue());
App::Color color = Preferences::getAccessibleColor(vp->SectionLineColor.getValue());
sectionLine->setSectionColor(color.asValue<QColor>());
sectionLine->setPathMode(false);
@@ -754,7 +754,6 @@ void QGIViewPart::drawComplexSectionLine(TechDraw::DrawViewSection* viewSection,
QGISectionLine* sectionLine = new QGISectionLine();
addToGroup(sectionLine);
sectionLine->setSymbol(const_cast<char*>(viewSection->SectionSymbol.getValue()));
sectionLine->setSectionStyle(vp->SectionLineStyle.getValue());
App::Color color = Preferences::getAccessibleColor(vp->SectionLineColor.getValue());
sectionLine->setSectionColor(color.asValue<QColor>());
sectionLine->setPathMode(true);

View File

@@ -107,25 +107,15 @@ ViewProviderViewPart::ViewProviderViewPart()
ADD_PROPERTY_TYPE(ArcCenterMarks ,(defShowCenters), dgroup, App::Prop_None, "Center marks on/off");
ADD_PROPERTY_TYPE(CenterScale, (defScale), dgroup, App::Prop_None, "Center mark size adjustment, if enabled");
std::string bodyName = LineGenerator::getLineStandardsBody();
if (bodyName == "ISO") {
SectionLineStyle.setEnums(ISOLineName::ISOLineNameEnums);
HighlightLineStyle.setEnums(ISOLineName::ISOLineNameEnums);
} else if (bodyName == "ANSI") {
SectionLineStyle.setEnums(ANSILineName::ANSILineNameEnums);
HighlightLineStyle.setEnums(ANSILineName::ANSILineNameEnums);
} else if (bodyName == "ASME") {
SectionLineStyle.setEnums(ASMELineName::ASMELineNameEnums);
HighlightLineStyle.setEnums(ASMELineName::ASMELineNameEnums);
}
//properties that affect Section Line
ADD_PROPERTY_TYPE(ShowSectionLine ,(true) ,sgroup, App::Prop_None, "Show/hide section line if applicable");
ADD_PROPERTY_TYPE(SectionLineStyle, (PreferencesGui::sectionLineStyle()), sgroup, App::Prop_None,
ADD_PROPERTY_TYPE(SectionLineStyle, (Preferences::SectionLineStyle()), sgroup, App::Prop_None,
"Set section line style if applicable");
ADD_PROPERTY_TYPE(SectionLineColor, (prefSectionColor()), sgroup, App::Prop_None,
"Set section line color if applicable");
ADD_PROPERTY_TYPE(SectionLineMarks, (PreferencesGui::sectionLineMarks()), sgroup, App::Prop_None,
bool marksDefault = Preferences::sectionLineConvention() == 1 ? true : false;
ADD_PROPERTY_TYPE(SectionLineMarks, (marksDefault), sgroup, App::Prop_None,
"Show marks at direction changes for ComplexSection");
//properties that affect Detail Highlights
@@ -135,7 +125,7 @@ ViewProviderViewPart::ViewProviderViewPart()
"Set highlight line color if applicable");
ADD_PROPERTY_TYPE(HighlightAdjust, (0.0), hgroup, App::Prop_None, "Adjusts the rotation of the Detail highlight");
ADD_PROPERTY_TYPE(ShowAllEdges ,(false) ,dgroup, App::Prop_None, "Temporarily show invisible lines");
ADD_PROPERTY_TYPE(ShowAllEdges ,(false),dgroup, App::Prop_None, "Temporarily show invisible lines");
// Faces related properties
ADD_PROPERTY_TYPE(FaceColor, (Preferences::getPreferenceGroup("Colors")->GetUnsigned("FaceColor", 0xFFFFFF)),
@@ -143,6 +133,18 @@ ViewProviderViewPart::ViewProviderViewPart()
ADD_PROPERTY_TYPE(FaceTransparency, (Preferences::getPreferenceGroup("Colors")->GetBool("ClearFace", false) ? 100 : 0),
fgroup, App::Prop_None, "Set transparency of faces");
FaceTransparency.setConstraints(&intPercent);
std::string bodyName = LineGenerator::getLineStandardsBody();
if (bodyName == "ISO") {
SectionLineStyle.setEnums(ISOLineName::ISOLineNameEnums);
HighlightLineStyle.setEnums(ISOLineName::ISOLineNameEnums);
} else if (bodyName == "ANSI") {
SectionLineStyle.setEnums(ANSILineName::ANSILineNameEnums);
HighlightLineStyle.setEnums(ANSILineName::ANSILineNameEnums);
} else if (bodyName == "ASME") {
SectionLineStyle.setEnums(ASMELineName::ASMELineNameEnums);
HighlightLineStyle.setEnums(ASMELineName::ASMELineNameEnums);
}
}
ViewProviderViewPart::~ViewProviderViewPart()