From 8a4f23471834f9d7e4b628d4c10987238a5a4d65 Mon Sep 17 00:00:00 2001 From: Roy-043 Date: Sun, 2 Apr 2023 19:29:59 +0200 Subject: [PATCH 1/2] [Arch] Remove obsolete code related to the Drawing WB --- src/Mod/Arch/ArchPanel.py | 157 ++---------- src/Mod/Arch/ArchSectionPlane.py | 128 +--------- .../Resources/icons/Arch_Panel_Sheet_Tree.svg | 234 ++++++++++++++++++ src/Mod/Arch/TestArch.py | 1 - 4 files changed, 256 insertions(+), 264 deletions(-) create mode 100644 src/Mod/Arch/Resources/icons/Arch_Panel_Sheet_Tree.svg diff --git a/src/Mod/Arch/ArchPanel.py b/src/Mod/Arch/ArchPanel.py index 58d2ae80a6..5774a89116 100644 --- a/src/Mod/Arch/ArchPanel.py +++ b/src/Mod/Arch/ArchPanel.py @@ -89,28 +89,7 @@ def makePanel(baseobj=None,length=0,width=0,thickness=0,placement=None,name="Pan return obj -def makePanelView(panel,page=None,name="PanelView"): - - """makePanelView(panel,[page]) : Creates a Drawing view of the given panel - in the given or active Page object (a new page will be created if none exists).""" - - if not page: - for o in FreeCAD.ActiveDocument.Objects: - if o.isDerivedFrom("Drawing::FeaturePage"): - page = o - break - if not page: - page = FreeCAD.ActiveDocument.addObject("Drawing::FeaturePage",translate("Arch","Page")) - page.Template = Draft.getParam("template",FreeCAD.getResourceDir()+'Mod/Drawing/Templates/A3_Landscape.svg') - view = FreeCAD.ActiveDocument.addObject("Drawing::FeatureViewPython",name) - page.addObject(view) - PanelView(view) - view.Source = panel - view.Label = translate("Arch","View of")+" "+panel.Label - return view - - -def makePanelCut(panel,name="PanelView"): +def makePanelCut(panel,name="PanelCut"): """makePanelCut(panel) : Creates a 2D view of the given panel in the 3D space, positioned at the origin.""" @@ -816,116 +795,12 @@ class _ViewProviderPanel(ArchComponent.ViewProviderComponent): ArchComponent.ViewProviderComponent.updateData(self,obj,prop) -class PanelView: - - "A Drawing view for Arch Panels" - - def __init__(self, obj): - - obj.Proxy = self - - # setProperties of ArchComponent will be overwritten - # thus setProperties from ArchComponent will be explicit called to get the properties - ArchComponent.ViewProviderComponent.setProperties(self, vobj) - - self.setProperties(obj) - obj.X = 10 - obj.Y = 10 - - def setProperties(self,obj): - - pl = obj.PropertiesList - if not "Source" in pl: - obj.addProperty("App::PropertyLink","Source","PanelView",QT_TRANSLATE_NOOP("App::Property","The linked object")) - if not "LineWidth" in pl: - obj.addProperty("App::PropertyFloat","LineWidth","PanelView",QT_TRANSLATE_NOOP("App::Property","The line width of the rendered objects")) - obj.LineWidth = 0.35 - if not "LineColor" in pl: - obj.addProperty("App::PropertyColor","LineColor","PanelView",QT_TRANSLATE_NOOP("App::Property","The color of the panel outline")) - obj.LineColor = (0.0,0.0,0.0) - if not "FontSize" in pl: - obj.addProperty("App::PropertyLength","FontSize","PanelView",QT_TRANSLATE_NOOP("App::Property","The size of the tag text")) - if not "TextColor" in pl: - obj.addProperty("App::PropertyColor","TextColor","PanelView",QT_TRANSLATE_NOOP("App::Property","The color of the tag text")) - obj.TextColor = (0.0,0.0,1.0) - if not "TextX" in pl: - obj.addProperty("App::PropertyFloat","TextX","PanelView",QT_TRANSLATE_NOOP("App::Property","The X offset of the tag text")) - obj.TextX = 10 - if not "TextY" in pl: - obj.addProperty("App::PropertyFloat","TextY","PanelView",QT_TRANSLATE_NOOP("App::Property","The Y offset of the tag text")) - obj.TextY = 10 - if not "FontName" in pl: - obj.addProperty("App::PropertyString","FontName","PanelView",QT_TRANSLATE_NOOP("App::Property","The font of the tag text")) - obj.FontName = "sans" - self.Type = "PanelView" - - def onDocumentRestored(self,obj): - - self.setProperties(obj) - - def execute(self, obj): - - if obj.Source: - if hasattr(obj.Source.Proxy,"BaseProfile"): - p = obj.Source.Proxy.BaseProfile - n = obj.Source.Proxy.ExtrusionVector - import TechDraw - svg1 = "" - svg2 = "" - result = "" - svg1 = TechDraw.projectToSVG(p,DraftVecUtils.neg(n)) - if svg1: - w = str(obj.LineWidth/obj.Scale) #don't let linewidth be influenced by the scale... - svg1 = svg1.replace('stroke-width="0.35"','stroke-width="'+w+'"') - svg1 = svg1.replace('stroke-width="1"','stroke-width="'+w+'"') - svg1 = svg1.replace('stroke-width:0.01','stroke-width:'+w) - svg1 = svg1.replace('scale(1,-1)','scale('+str(obj.Scale)+',-'+str(obj.Scale)+')') - if obj.Source.Tag: - svg2 = '' - svg2 += ''+obj.Source.Tag+'\n' - result += ' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + [Yorik van Havre] + + + Arch_Panel_Sheet_Tree + 2016-12-17 + http://www.freecadweb.org/wiki/index.php?title=Artwork + + + FreeCAD + + + FreeCAD/src/Mod/Arch/Resources/icons/Arch_Panel_Sheet_Tree.svg + + + FreeCAD LGPL2+ + + + https://www.gnu.org/copyleft/lesser.html + + + [agryson] Alexander Gryson + + + + + + + + + + + + + + diff --git a/src/Mod/Arch/TestArch.py b/src/Mod/Arch/TestArch.py index d1b4be500c..f1907bf880 100644 --- a/src/Mod/Arch/TestArch.py +++ b/src/Mod/Arch/TestArch.py @@ -613,7 +613,6 @@ class ArchTest(unittest.TestCase): def testSection(self): App.Console.PrintLog ('Checking Arch Section...\n') s = Arch.makeSectionPlane([]) - #v = Arch.makeSectionView(s) # obsolete, uses the Drawing module self.failUnless(s,"Arch Section failed") def testSpace(self): From d116f82abc1f9bcba4d32c47af6e0928c247866a Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Mon, 3 Apr 2023 09:19:23 +0200 Subject: [PATCH 2/2] Update Arch.qrc Added Arch_Panel_Sheet_Tree.svg --- src/Mod/Arch/Resources/Arch.qrc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Mod/Arch/Resources/Arch.qrc b/src/Mod/Arch/Resources/Arch.qrc index 08e60d4b1d..551e61015a 100644 --- a/src/Mod/Arch/Resources/Arch.qrc +++ b/src/Mod/Arch/Resources/Arch.qrc @@ -44,6 +44,7 @@ icons/Arch_Panel_Clone.svg icons/Arch_Panel_Cut.svg icons/Arch_Panel_Sheet.svg + icons/Arch_Panel_Sheet_Tree.svg icons/Arch_Panel_Tree.svg icons/Arch_Pipe.svg icons/Arch_Pipe_Tree.svg