From 2fa9369d4203f33c62afddfbe190bb4e089d1840 Mon Sep 17 00:00:00 2001 From: donovaly Date: Sun, 1 Dec 2019 20:44:07 +0100 Subject: [PATCH 1/3] TechDraw: add unit for rotation --- src/Mod/TechDraw/App/DrawView.cpp | 33 ++++++++++++------------------- src/Mod/TechDraw/App/DrawView.h | 2 +- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/Mod/TechDraw/App/DrawView.cpp b/src/Mod/TechDraw/App/DrawView.cpp index 0382f91259..3f3e0d35a2 100644 --- a/src/Mod/TechDraw/App/DrawView.cpp +++ b/src/Mod/TechDraw/App/DrawView.cpp @@ -60,9 +60,9 @@ using namespace TechDraw; //=========================================================================== const char* DrawView::ScaleTypeEnums[]= {"Page", - "Automatic", - "Custom", - NULL}; + "Automatic", + "Custom", + NULL}; App::PropertyFloatConstraint::Constraints DrawView::scaleRange = {Precision::Confusion(), std::numeric_limits::max(), pow(10,- Base::UnitsApi::getDecimals())}; @@ -340,12 +340,12 @@ void DrawView::handleChangedPropertyType( Scale.setValue(1.0); } } else { - // has Scale property that isn't float - Base::Console().Log("DrawPage::Restore - old document Scale is not a float!\n"); + // has Scale prop that isn't Float! + Base::Console().Log("DrawPage::Restore - old Document Scale is Not Float!\n"); + // no idea } } else if (prop->isDerivedFrom(App::PropertyLinkList::getClassTypeId()) - && strcmp(prop->getName(),"Source")==0) - { + && strcmp(prop->getName(),"Source")==0) { App::PropertyLinkGlobal glink; App::PropertyLink link; if (strcmp(glink.getTypeId().getName(),TypeName) == 0) { //property in file is plg @@ -363,19 +363,12 @@ void DrawView::handleChangedPropertyType( static_cast(prop)->setValue(link.getValue()); } } - // property X had App::PropertyFloat and was changed to App::PropertyLength - // sb PropertyDistance. some X,Y are relative to existing point on page - } else if (prop == &X && strcmp(TypeName, "App::PropertyFloat") == 0) { - App::PropertyFloat XProperty; - XProperty.setContainer(this); - // restore the PropertyFloat to be able to set its value - XProperty.Restore(reader); - X.setValue(XProperty.getValue()); - } else if (prop == &Y && strcmp(TypeName, "App::PropertyFloat") == 0) { - App::PropertyFloat YProperty; - YProperty.setContainer(this); - YProperty.Restore(reader); - Y.setValue(YProperty.getValue()); +// property Rotation had App::PropertyFloat and was changed to App::PropertyAngle + } else if (prop == &Rotation && strcmp(TypeName, "App::PropertyFloat") == 0) { + App::PropertyFloat RotationProperty; + RotationProperty.setContainer(this); + RotationProperty.Restore(reader); + Rotation.setValue(RotationProperty.getValue()); } } diff --git a/src/Mod/TechDraw/App/DrawView.h b/src/Mod/TechDraw/App/DrawView.h index 34782a662c..84ce5b1350 100644 --- a/src/Mod/TechDraw/App/DrawView.h +++ b/src/Mod/TechDraw/App/DrawView.h @@ -58,7 +58,7 @@ public: App::PropertyFloatConstraint Scale; App::PropertyEnumeration ScaleType; - App::PropertyFloat Rotation; + App::PropertyAngle Rotation; App::PropertyString Caption; /** @name methods override Feature */ From de1be3b38121be357460f0a3b3874eb6825feac9 Mon Sep 17 00:00:00 2001 From: donovaly Date: Sat, 7 Dec 2019 04:26:15 +0100 Subject: [PATCH 2/3] TD: add units for line widths - this also prevents negative values - also fix an issue in DrawViewBalloon introduced by me recently --- src/Mod/TechDraw/App/DrawViewBalloon.cpp | 4 +-- src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp | 30 +++++++++++++++++++ src/Mod/TechDraw/Gui/ViewProviderViewPart.h | 10 ++++--- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/Mod/TechDraw/App/DrawViewBalloon.cpp b/src/Mod/TechDraw/App/DrawViewBalloon.cpp index e6653d5302..ea70fb5fd4 100644 --- a/src/Mod/TechDraw/App/DrawViewBalloon.cpp +++ b/src/Mod/TechDraw/App/DrawViewBalloon.cpp @@ -136,8 +136,8 @@ void DrawViewBalloon::handleChangedPropertyType(Base::XMLReader &reader, const c // property OriginX had the App::PropertyFloat and was changed to App::PropertyLength if (prop == &OriginX && strcmp(TypeName, "App::PropertyFloat") == 0) { - App::PropertyInteger OriginXProperty; - // restore the PropertyInteger to be able to set its value + App::PropertyFloat OriginXProperty; + // restore the PropertyFloat to be able to set its value OriginXProperty.Restore(reader); OriginX.setValue(OriginXProperty.getValue()); } diff --git a/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp b/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp index 347c6013f4..9631bbf6f6 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp @@ -215,3 +215,33 @@ TechDraw::DrawViewPart* ViewProviderViewPart::getViewPart() const { return getViewObject(); } + +void ViewProviderViewPart::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop) +// transforms properties that had been changed +{ + // property LineWidth had the App::PropertyFloat and was changed to App::PropertyLength + if (prop == &LineWidth && strcmp(TypeName, "App::PropertyFloat") == 0) { + App::PropertyFloat LineWidthProperty; + // restore the PropertyFloat to be able to set its value + LineWidthProperty.Restore(reader); + LineWidth.setValue(LineWidthProperty.getValue()); + } + // property HiddenWidth had the App::PropertyFloat and was changed to App::PropertyLength + else if (prop == &HiddenWidth && strcmp(TypeName, "App::PropertyFloat") == 0) { + App::PropertyFloat HiddenWidthProperty; + HiddenWidthProperty.Restore(reader); + HiddenWidth.setValue(HiddenWidthProperty.getValue()); + } + // property IsoWidth had the App::PropertyFloat and was changed to App::PropertyLength + else if (prop == &IsoWidth && strcmp(TypeName, "App::PropertyFloat") == 0) { + App::PropertyFloat IsoWidthProperty; + IsoWidthProperty.Restore(reader); + IsoWidth.setValue(IsoWidthProperty.getValue()); + } + // property ExtraWidth had the App::PropertyFloat and was changed to App::PropertyLength + else if (prop == &ExtraWidth && strcmp(TypeName, "App::PropertyFloat") == 0) { + App::PropertyFloat ExtraWidthProperty; + ExtraWidthProperty.Restore(reader); + ExtraWidth.setValue(ExtraWidthProperty.getValue()); + } +} diff --git a/src/Mod/TechDraw/Gui/ViewProviderViewPart.h b/src/Mod/TechDraw/Gui/ViewProviderViewPart.h index f55d58e016..9d94223888 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderViewPart.h +++ b/src/Mod/TechDraw/Gui/ViewProviderViewPart.h @@ -43,10 +43,10 @@ public: /// destructor virtual ~ViewProviderViewPart(); - App::PropertyFloat LineWidth; - App::PropertyFloat HiddenWidth; - App::PropertyFloat IsoWidth; - App::PropertyFloat ExtraWidth; + App::PropertyLength LineWidth; + App::PropertyLength HiddenWidth; + App::PropertyLength IsoWidth; + App::PropertyLength ExtraWidth; App::PropertyBool ArcCenterMarks; App::PropertyFloat CenterScale; App::PropertyBool HorizCenterLine; @@ -64,6 +64,8 @@ public: public: virtual void onChanged(const App::Property *prop); virtual void updateData(const App::Property*); + virtual void handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property * prop); + virtual std::vector claimChildren(void) const; From c1f177b528e4163309fa3beee9dd139e9b4a4582 Mon Sep 17 00:00:00 2001 From: Mikhaylov-yv Date: Sat, 7 Dec 2019 18:01:59 +0300 Subject: [PATCH 3/3] Edit A4 --- .../Templates/RU_GOST/Leading/Portrait_A4.svg | 250 ++++++++++++------ 1 file changed, 170 insertions(+), 80 deletions(-) diff --git a/src/Mod/TechDraw/Templates/RU_GOST/Leading/Portrait_A4.svg b/src/Mod/TechDraw/Templates/RU_GOST/Leading/Portrait_A4.svg index 751a385968..4db5b9dcf7 100644 --- a/src/Mod/TechDraw/Templates/RU_GOST/Leading/Portrait_A4.svg +++ b/src/Mod/TechDraw/Templates/RU_GOST/Leading/Portrait_A4.svg @@ -1,4 +1,4 @@ - + @@ -986,12 +986,14 @@ style="font-style:normal;font-weight:normal;font-size:3.52777767px;line-height:1.5;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" x="169.70023" y="294.9917" - id="text985"> + Формат А4 + id="tspan987">Формат А4 + + РИК-35.000000.000СБ + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7.05555534px;line-height:1.5;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:0.26458332">РИК-35.000000.000СБ + + Название детали + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.64444447px;line-height:1.5;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:0.26458332">Название детали + + Полоса —————————————— + style="font-size:3.52777767px;stroke-width:0.26458332">Полоса —————————————— + + Лит. + style="font-size:3.52777767px;stroke-width:0.26458332">Лит. + + Масса + style="font-size:3.52777767px;stroke-width:0.26458332">Масса + + Масштаб + style="font-size:3.52777767px;stroke-width:0.26458332">Масштаб + + Лист + style="stroke-width:0.26458332">Лист + + Листов + style="stroke-width:0.26458332">Листов + + Изм + style="stroke-width:0.26458332">Изм + + Лист + style="stroke-width:0.26458332">Лист + + № докум. + style="stroke-width:0.26458332">№ докум. + + Подп. + style="stroke-width:0.26458332">Подп. + + Дата + style="stroke-width:0.26458332">Дата + + Разраб. + style="stroke-width:0.26458332">Разраб. + + Пров. + style="stroke-width:0.26458332">Пров. + + Т. контр. + style="stroke-width:0.26458332">Т. контр. + + Н. контр. + style="stroke-width:0.26458332">Н. контр. + + Утв. + style="stroke-width:0.26458332">Утв. + + ООО «Рога и копыта» + style="font-size:3.52777767px;stroke-width:0.26458332">ООО «Рога и копыта» + + Иванов И. И. + style="font-size:2.82222223px;stroke-width:0.26458332">Иванов И. И. + + Иванов И. И. + style="font-size:2.82222223px;stroke-width:0.26458332">Иванов И. И. + + Иванов И. И. + style="font-size:2.82222223px;stroke-width:0.26458332">Иванов И. И. + + 1 + style="stroke-width:0.26458332">1 + + 1 + style="stroke-width:0.26458332">1 + + 0.000 + style="font-size:4.23333311px;stroke-width:0.26458332">0.000 + + 1:1 + style="font-size:4.23333311px;stroke-width:0.26458332">1:1 + + 01.01.01 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.11666656px;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:0.26458332">01.01.01 + + 01.01.01 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.11666656px;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:0.26458332">01.01.01 + + 01.01.01 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.11666656px;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:0.26458332">01.01.01 + + 50×100 ГОСТ 103-2006 + id="tspan1619"> 50×100 ГОСТ 103-2006 + + 12Х18Н10Т ГОСТ 5949-75 + id="tspan1627"> 12Х18Н10Т ГОСТ 5949-75 + + + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:0.26458332px" /> + + + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:0.26458332px" /> + + + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:0.26458332px" /> + + + + РИК-35.000000.000СБ +