diff --git a/src/Mod/Arch/Arch.py b/src/Mod/Arch/Arch.py index 05890af2d4..0505e68305 100644 --- a/src/Mod/Arch/Arch.py +++ b/src/Mod/Arch/Arch.py @@ -19,9 +19,9 @@ #* * #*************************************************************************** -__title__= "FreeCAD Arch API" +__title__ = "FreeCAD Arch API" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" ## \defgroup ARCH Arch # \ingroup PYTHONWORKBENCHES diff --git a/src/Mod/Arch/ArchAxis.py b/src/Mod/Arch/ArchAxis.py index ea200ca9ee..5816966423 100644 --- a/src/Mod/Arch/ArchAxis.py +++ b/src/Mod/Arch/ArchAxis.py @@ -37,9 +37,9 @@ else: return txt # \endcond -__title__="FreeCAD Axis System" +__title__ = "FreeCAD Axis System" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" ## @package ArchAxis # \ingroup ARCH diff --git a/src/Mod/Arch/ArchBuilding.py b/src/Mod/Arch/ArchBuilding.py index 7a47eaf801..a1192c271d 100644 --- a/src/Mod/Arch/ArchBuilding.py +++ b/src/Mod/Arch/ArchBuilding.py @@ -1,5 +1,4 @@ # -*- coding: utf8 -*- - #*************************************************************************** #* Copyright (c) 2011 Yorik van Havre * #* * @@ -35,9 +34,9 @@ else: return txt # \endcond -__title__="FreeCAD Building" +__title__ = "FreeCAD Building" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" ## @package ArchBuilding # \ingroup ARCH diff --git a/src/Mod/Arch/ArchBuildingPart.py b/src/Mod/Arch/ArchBuildingPart.py index 08e8e29f99..ec9a8274ce 100644 --- a/src/Mod/Arch/ArchBuildingPart.py +++ b/src/Mod/Arch/ArchBuildingPart.py @@ -1,5 +1,4 @@ # -*- coding: utf8 -*- - #*************************************************************************** #* Copyright (c) 2018 Yorik van Havre * #* * @@ -51,9 +50,9 @@ if sys.version_info.major >= 3: # This module provides tools to build BuildingPart objects. # BuildingParts are used to group different Arch objects -__title__="FreeCAD Arch BuildingPart" +__title__ = "FreeCAD Arch BuildingPart" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" BuildingTypes = ['Undefined', diff --git a/src/Mod/Arch/ArchCommands.py b/src/Mod/Arch/ArchCommands.py index bdb87b3494..2d3afdbdac 100644 --- a/src/Mod/Arch/ArchCommands.py +++ b/src/Mod/Arch/ArchCommands.py @@ -1,5 +1,4 @@ # -*- coding: utf8 -*- - #*************************************************************************** #* Copyright (c) 2011 Yorik van Havre * #* * @@ -35,13 +34,13 @@ else: return txt # \endcond -__title__="FreeCAD Arch Commands" +__title__ = "FreeCAD Arch Commands" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" ## @package ArchCommands # \ingroup ARCH -# \brief Utility functions for theArch Workbench +# \brief Utility functions for the Arch Workbench # # This module provides general functions used by Arch tools # and utility commands @@ -64,7 +63,7 @@ def string_replace(text, pattern, replacement): if sys.version_info.major < 3: text = text.encode("utf8") return text.replace(pattern, replacement) - + def getStringList(objects): '''getStringList(objects): returns a string defining a list @@ -1201,7 +1200,7 @@ def cleanArchSplitter(objects=None): def rebuildArchShape(objects=None): - """rebuildArchShape([objects]): takes the faces from the base shape of the given (or selected + """rebuildArchShape([objects]): takes the faces from the base shape of the given (or selected if objects is None) Arch objects, and tries to rebuild a valid solid from them.""" import FreeCAD,FreeCADGui,Part if not objects: diff --git a/src/Mod/Arch/ArchComponent.py b/src/Mod/Arch/ArchComponent.py index 09c625428d..a8039d9851 100644 --- a/src/Mod/Arch/ArchComponent.py +++ b/src/Mod/Arch/ArchComponent.py @@ -27,9 +27,9 @@ Examples TODO put examples here. """ -__title__="FreeCAD Arch Component" +__title__ = "FreeCAD Arch Component" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" import FreeCAD,Draft,ArchCommands,math,sys,json,os,ArchIFC,ArchIFCSchema from FreeCAD import Vector @@ -779,7 +779,7 @@ class Component(ArchIFC.IfcProduct): subvolume = o.Subvolume.Shape.copy() if hasattr(o,"Placement"): subvolume.Placement = subvolume.Placement.multiply(o.Placement) - + if subvolume: if base.Solids and subvolume.Solids: if placement: diff --git a/src/Mod/Arch/ArchCurtainWall.py b/src/Mod/Arch/ArchCurtainWall.py index 95f43cd4f7..3226d37518 100644 --- a/src/Mod/Arch/ArchCurtainWall.py +++ b/src/Mod/Arch/ArchCurtainWall.py @@ -1,5 +1,4 @@ # -*- coding: utf8 -*- - #*************************************************************************** #* Copyright (c) 2020 Yorik van Havre * #* * @@ -21,9 +20,9 @@ #* * #*************************************************************************** -__title__="FreeCAD Arch Curtain Wall" +__title__ = "FreeCAD Arch Curtain Wall" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" import math,sys import FreeCAD diff --git a/src/Mod/Arch/ArchEquipment.py b/src/Mod/Arch/ArchEquipment.py index 0b3cb650ad..d9645dab88 100644 --- a/src/Mod/Arch/ArchEquipment.py +++ b/src/Mod/Arch/ArchEquipment.py @@ -1,5 +1,4 @@ # -*- coding: utf8 -*- - #*************************************************************************** #* Copyright (c) 2014 Yorik van Havre * #* * @@ -21,9 +20,9 @@ #* * #*************************************************************************** -__title__="FreeCAD Equipment" +__title__ = "FreeCAD Equipment" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" import FreeCAD,Draft,ArchComponent,DraftVecUtils,ArchCommands from FreeCAD import Units diff --git a/src/Mod/Arch/ArchFloor.py b/src/Mod/Arch/ArchFloor.py index 5ebc04b984..7ebf61a3b4 100644 --- a/src/Mod/Arch/ArchFloor.py +++ b/src/Mod/Arch/ArchFloor.py @@ -1,5 +1,4 @@ # -*- coding: utf8 -*- - #*************************************************************************** #* Copyright (c) 2011 Yorik van Havre * #* * @@ -51,9 +50,9 @@ else: # Floors are used to group different Arch objects situated # at a same level -__title__="FreeCAD Arch Floor" +__title__ = "FreeCAD Arch Floor" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" def makeFloor(objectslist=None,baseobj=None,name="Floor"): """Obsolete, superseded by ArchBuildingPart.makeFloor. @@ -93,7 +92,7 @@ def makeFloor(objectslist=None,baseobj=None,name="Floor"): class _CommandFloor: - """The command definition for the Arch workbench's gui tool, Arch Floor. + """The command definition for the Arch workbench's gui tool, Arch Floor. A tool for creating Arch floors. @@ -116,7 +115,7 @@ class _CommandFloor: 'ToolTip': QT_TRANSLATE_NOOP("Arch_Floor","Creates a Building Part object that represents a level, including selected objects")} def IsActive(self): - """Determine whether or not the Arch Floor tool is active. + """Determine whether or not the Arch Floor tool is active. Inactive commands are indicated by a greyed-out icon in the menus and toolbars. """ @@ -176,7 +175,7 @@ class _Floor(ArchIFC.IfcProduct): Turns a into a floor object, then takes a list of objects to own as its children. - + The floor can be based off either a group, or a python feature. Learn more about groups here: https://wiki.freecadweb.org/Std_Group @@ -254,7 +253,7 @@ class _Floor(ArchIFC.IfcProduct): def execute(self,obj): """Method run when the object is recomputed. - + Move its children if its placement has changed since the previous recompute. Set any child Walls and Structures to have the height of the floor if they have not Height value set. @@ -341,7 +340,7 @@ class _ViewProviderFloor: """Add display modes' data to the coin scenegraph. Add each display mode as a coin node, whose parent is this view - provider. + provider. Each display mode's node includes the data needed to display the object in that mode. This might include colors of faces, or the draw style of diff --git a/src/Mod/Arch/ArchFrame.py b/src/Mod/Arch/ArchFrame.py index 7be2d02667..af8c87223d 100644 --- a/src/Mod/Arch/ArchFrame.py +++ b/src/Mod/Arch/ArchFrame.py @@ -42,9 +42,9 @@ else: # Frames are objects made of a profile and an object with # edges along which the profile gets extruded -__title__="FreeCAD Arch Frame" +__title__ = "FreeCAD Arch Frame" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" def makeFrame(baseobj,profile,name=translate("Arch","Frame")): diff --git a/src/Mod/Arch/ArchIFC.py b/src/Mod/Arch/ArchIFC.py index f2502b22d1..d750ff4a06 100644 --- a/src/Mod/Arch/ArchIFC.py +++ b/src/Mod/Arch/ArchIFC.py @@ -174,7 +174,7 @@ class IfcRoot: def getIfcAttributeSchema(self, ifcTypeSchema, name): """Get the schema of an IFC attribute with the given name. - + Convert the IFC attribute's name from the human readable version Arch uses, and convert it to the less readable name it has in the IFC schema. @@ -260,17 +260,17 @@ class IfcRoot: obj.IfcData = IfcData if attribute["is_enum"]: - obj.addProperty("App::PropertyEnumeration", - attribute["name"], - "IFC Attributes", + obj.addProperty("App::PropertyEnumeration", + attribute["name"], + "IFC Attributes", QT_TRANSLATE_NOOP("App::Property", "Description of IFC attributes are not yet implemented")) setattr(obj, attribute["name"], attribute["enum_values"]) else: import ArchIFCSchema propertyType = "App::" + ArchIFCSchema.IfcTypes[attribute["type"]]["property"] - obj.addProperty(propertyType, - attribute["name"], - "IFC Attributes", + obj.addProperty(propertyType, + attribute["name"], + "IFC Attributes", QT_TRANSLATE_NOOP("App::Property", "Description of IFC attributes are not yet implemented")) def addIfcAttributeValueExpressions(self, obj, attribute): @@ -420,7 +420,7 @@ class IfcRoot: if r in IfcTypes: obj.IfcType = r FreeCAD.Console.PrintMessage("Upgrading "+obj.Label+" IfcRole property to IfcType\n") - + if "IfcAttributes"in obj.PropertiesList: obj.IfcData = obj.IfcAttributes obj.removeProperty("IfcAttributes") diff --git a/src/Mod/Arch/ArchIFCSchema.py b/src/Mod/Arch/ArchIFCSchema.py index 4332d38b12..1f7b3aa127 100644 --- a/src/Mod/Arch/ArchIFCSchema.py +++ b/src/Mod/Arch/ArchIFCSchema.py @@ -5,11 +5,11 @@ Provides the data as IfcContexts, IfcProducts and IfcTypes. import FreeCAD, os, json -ifcVersions = ["IFC4", "IFC2X3"] +ifcVersions = ["IFC4", "IFC2X3"] IfcVersion = ifcVersions[FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetInt("IfcVersion",0)] with open(os.path.join(FreeCAD.getResourceDir(), "Mod", "Arch", "Presets", -"ifc_contexts_" + IfcVersion + ".json")) as f: +"ifc_contexts_" + IfcVersion + ".json")) as f: IfcContexts = json.load(f) with open(os.path.join(FreeCAD.getResourceDir(), "Mod", "Arch", "Presets", diff --git a/src/Mod/Arch/ArchIFCView.py b/src/Mod/Arch/ArchIFCView.py index 72e0ad66bc..d10c688eaf 100644 --- a/src/Mod/Arch/ArchIFCView.py +++ b/src/Mod/Arch/ArchIFCView.py @@ -142,13 +142,13 @@ class IfcContextUI: def createLineEdit(self, name): """Creates a form with the name specified. - + Parameters ---------- name: str The name of the datapoint within the RepresentationContexts attribute being edited. - + Returns ------- diff --git a/src/Mod/Arch/ArchNesting.py b/src/Mod/Arch/ArchNesting.py index 78c761c827..05e2f3c54f 100644 --- a/src/Mod/Arch/ArchNesting.py +++ b/src/Mod/Arch/ArchNesting.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - #*************************************************************************** #* Copyright (c) 2017 Yorik van Havre * #* * @@ -431,7 +430,7 @@ class Nester: #for i,p in enumerate(faceverts): # Draft.makeText([str(i)],point=p) return - + if pol.isValid(): nofitpol.append(pol) #Part.show(pol) diff --git a/src/Mod/Arch/ArchPanel.py b/src/Mod/Arch/ArchPanel.py index a763f078df..cde7ef1823 100644 --- a/src/Mod/Arch/ArchPanel.py +++ b/src/Mod/Arch/ArchPanel.py @@ -43,10 +43,9 @@ else: # Panels consist of a closed shape that gets extruded to # produce a flat object. - -__title__="FreeCAD Panel" +__title__ = "FreeCAD Panel" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" # Description l w t diff --git a/src/Mod/Arch/ArchPipe.py b/src/Mod/Arch/ArchPipe.py index 91c91686d6..914634b360 100644 --- a/src/Mod/Arch/ArchPipe.py +++ b/src/Mod/Arch/ArchPipe.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - #*************************************************************************** #* Copyright (c) 2016 Yorik van Havre * #* * @@ -42,9 +41,9 @@ else: # This module provides tools to build Pipe and Pipe connector objects. # Pipes are tubular objects extruded along a base line. -__title__ = "Arch Pipe tools" +__title__ = "Arch Pipe tools" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" def makePipe(baseobj=None,diameter=0,length=0,placement=None,name="Pipe"): @@ -248,7 +247,7 @@ class _ArchPipe(ArchComponent.Component): import Draft if Draft.getType(obj.Base) == "BezCurve": v1 = obj.Base.Placement.multVec(obj.Base.Points[1])-w.Vertexes[0].Point - else: + else: v1 = w.Vertexes[1].Point-w.Vertexes[0].Point v2 = DraftGeomUtils.getNormal(p) rot = FreeCAD.Rotation(v2,v1) diff --git a/src/Mod/Arch/ArchPrecast.py b/src/Mod/Arch/ArchPrecast.py index 00a3af0163..80dfbc4056 100644 --- a/src/Mod/Arch/ArchPrecast.py +++ b/src/Mod/Arch/ArchPrecast.py @@ -19,9 +19,9 @@ #* * #*************************************************************************** -__title__= "FreeCAD Precast concrete module" +__title__ = "FreeCAD Precast concrete module" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" """This module contains tools to build basic precast concrete elements: Beams, pillars, slabs and panels""" @@ -867,7 +867,7 @@ class _PrecastTaskPanel: self.valueTread = FreeCADGui.UiLoader().createWidget("Gui::InputField") self.grid.addWidget(self.labelTread,18,0,1,1) self.grid.addWidget(self.valueTread,18,1,1,1) - + # signals/slots QtCore.QObject.connect(self.valueChamfer,QtCore.SIGNAL("valueChanged(double)"),self.setChamfer) QtCore.QObject.connect(self.valueDentLength,QtCore.SIGNAL("valueChanged(double)"),self.setDentLength) diff --git a/src/Mod/Arch/ArchProfile.py b/src/Mod/Arch/ArchProfile.py index 77cefe47f2..3a5b8fdc73 100644 --- a/src/Mod/Arch/ArchProfile.py +++ b/src/Mod/Arch/ArchProfile.py @@ -19,9 +19,9 @@ #* * #*************************************************************************** -__title__= "FreeCAD Profile" +__title__ = "FreeCAD Profile" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" ## @package ArchProfile # \ingroup ARCH @@ -109,7 +109,7 @@ def makeProfile(profile=[0,'REC','REC100x100','R',100,100]): class Arch_Profile: - + """The FreeCAD Arch_Profile command definition""" def GetResources(self): diff --git a/src/Mod/Arch/ArchProject.py b/src/Mod/Arch/ArchProject.py index ac8b5b9894..863e15f88c 100644 --- a/src/Mod/Arch/ArchProject.py +++ b/src/Mod/Arch/ArchProject.py @@ -1,5 +1,4 @@ # -*- coding: utf8 -*- - #*************************************************************************** #* Copyright (c) 2011 Yorik van Havre * #* * @@ -44,9 +43,9 @@ else: # # This module provides tools to build Project objects. -__title__="FreeCAD Project" +__title__ = "FreeCAD Project" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" def makeProject(sites=None, name="Project"): """Create an Arch project. @@ -81,12 +80,12 @@ def makeProject(sites=None, name="Project"): return obj class _CommandProject: - """The command definition for the Arch workbench's gui tool, Arch Project. + """The command definition for the Arch workbench's gui tool, Arch Project. A tool for creating Arch projects. Creates a project from the objects selected by the user that have the Site - IfcType, if any. + IfcType, if any. Find documentation on the end user usage of Arch Project here: https://wiki.freecadweb.org/Arch_Project @@ -100,7 +99,7 @@ class _CommandProject: 'ToolTip': QT_TRANSLATE_NOOP("Arch_Project", "Creates a project entity aggregating the selected sites.")} def IsActive(self): - """Determine whether or not the Arch Project tool is active. + """Determine whether or not the Arch Project tool is active. Inactive commands are indicated by a greyed-out icon in the menus and toolbars. """ @@ -110,7 +109,7 @@ class _CommandProject: """Executed when Arch Project is called. Create a project from the objects selected by the user that have the - Site IfcType, if any. + Site IfcType, if any. """ selection = FreeCADGui.Selection.getSelection() diff --git a/src/Mod/Arch/ArchRebar.py b/src/Mod/Arch/ArchRebar.py index 585898b3c6..592c5b96a3 100644 --- a/src/Mod/Arch/ArchRebar.py +++ b/src/Mod/Arch/ArchRebar.py @@ -43,9 +43,9 @@ else: # Rebars (or Reinforcing Bars) are metallic bars placed # inside concrete structures to reinforce them. -__title__="FreeCAD Rebar" +__title__ = "FreeCAD Rebar" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" def makeRebar(baseobj=None,sketch=None,diameter=None,amount=1,offset=None,name="Rebar"): diff --git a/src/Mod/Arch/ArchReference.py b/src/Mod/Arch/ArchReference.py index 9d02d522c5..8010ebe6e9 100644 --- a/src/Mod/Arch/ArchReference.py +++ b/src/Mod/Arch/ArchReference.py @@ -19,9 +19,9 @@ #* * #*************************************************************************** -__title__="FreeCAD Arch External Reference" +__title__ = "FreeCAD Arch External Reference" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" import FreeCAD @@ -171,7 +171,7 @@ class ArchReference: self.reload = False def getFile(self,obj,filename=None): - + "gets a valid file, if possible" if not filename: @@ -202,7 +202,7 @@ class ArchReference: return filename def getPartsList(self,obj,filename=None): - + "returns a list of Part-based objects in a FCStd file" parts = {} @@ -291,9 +291,9 @@ class ArchReference: return None def splitall(self,path): - + "splits a path between its components" - + allparts = [] while 1: parts = os.path.split(path) @@ -369,7 +369,7 @@ class ViewProviderArchReference: return None def updateData(self,obj,prop): - + if (prop == "Shape") and hasattr(obj.ViewObject,"UpdateColors") and obj.ViewObject.UpdateColors: if obj.Shape and not obj.Shape.isNull(): colors = obj.Proxy.getColors(obj) @@ -379,7 +379,7 @@ class ViewProviderArchReference: todo.delay(self.recolorize,obj.ViewObject) def recolorize(self,vobj): - + if hasattr(vobj,"DiffuseColor") and hasattr(vobj,"UpdateColors") and vobj.UpdateColors: vobj.DiffuseColor = vobj.DiffuseColor @@ -460,7 +460,7 @@ class ViewProviderArchReference: FreeCAD.openDocument(self.Object.File) def loadInventor(self,obj): - + "loads an openinventor file and replace the root node of this object" # check inventor contents @@ -481,7 +481,7 @@ class ViewProviderArchReference: flatlines = lwnode shaded = lwnode.getChild(0) wireframe = lwnode.getChild(1) - + # check node contents rootnode = obj.ViewObject.RootNode if rootnode.getNumChildren() < 3: @@ -503,7 +503,7 @@ class ViewProviderArchReference: switch.replaceChild(2,wireframe) def unloadInventor(self,obj): - + "restore original nodes" if (not hasattr(self,"orig_flatlines")) or (not self.orig_flatlines): @@ -523,18 +523,18 @@ class ViewProviderArchReference: FreeCAD.Console.PrintError("Invalid root node in "+obj.Label+"\n") return - # replace root node of object + # replace root node of object switch.replaceChild(0,self.orig_flatlines) switch.replaceChild(1,self.orig_shaded) switch.replaceChild(2,self.orig_wireframe) - + # discard old content self.orig_flatlines = None self.orig_shaded = None self.orig_wireframe = None def getInventorString(self,obj): - + "locates and loads an iv file saved together with an object, if existing" filename = obj.Proxy.getFile(obj) diff --git a/src/Mod/Arch/ArchRoof.py b/src/Mod/Arch/ArchRoof.py index 1fa090b2f9..cb81df88a5 100644 --- a/src/Mod/Arch/ArchRoof.py +++ b/src/Mod/Arch/ArchRoof.py @@ -54,7 +54,7 @@ else: __title__ = "FreeCAD Roof" __author__ = "Yorik van Havre", "Jonathan Wiedemann" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" def adjust_list_len (lst, newLn, val): diff --git a/src/Mod/Arch/ArchSchedule.py b/src/Mod/Arch/ArchSchedule.py index 5eecf12acc..9a11a60e5f 100644 --- a/src/Mod/Arch/ArchSchedule.py +++ b/src/Mod/Arch/ArchSchedule.py @@ -1,5 +1,4 @@ # -*- coding: utf8 -*- - #*************************************************************************** #* Copyright (c) 2015 Yorik van Havre * #* * @@ -47,7 +46,7 @@ else: __title__ = "Arch Schedule" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" verbose = True # change this for silent recomputes diff --git a/src/Mod/Arch/ArchSite.py b/src/Mod/Arch/ArchSite.py index 116fdc47e4..b75ba6c665 100644 --- a/src/Mod/Arch/ArchSite.py +++ b/src/Mod/Arch/ArchSite.py @@ -1,5 +1,4 @@ # -*- coding: utf8 -*- - #*************************************************************************** #* Copyright (c) 2011 Yorik van Havre * #* * @@ -47,9 +46,9 @@ else: # Sites are containers for Arch objects, and also define a # terrain surface -__title__="FreeCAD Site" +__title__= "FreeCAD Site" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" def makeSite(objectslist=None,baseobj=None,name="Site"): diff --git a/src/Mod/Arch/ArchSpace.py b/src/Mod/Arch/ArchSpace.py index 6de3ea2da6..344902f162 100644 --- a/src/Mod/Arch/ArchSpace.py +++ b/src/Mod/Arch/ArchSpace.py @@ -1,5 +1,4 @@ # -*- coding: utf8 -*- - #*************************************************************************** #* Copyright (c) 2013 Yorik van Havre * #* * @@ -21,9 +20,9 @@ #* * #*************************************************************************** -__title__="FreeCAD Arch Space" +__title__= "FreeCAD Arch Space" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" SpaceTypes = [ "Undefined", @@ -715,7 +714,7 @@ class _ViewProviderSpace(ArchComponent.ViewProviderComponent): self.label.whichChild = 0 else: self.label.whichChild = -1 - + elif prop == "ShapeColor": if hasattr(vobj,"ShapeColor"): self.fmat.diffuseColor.setValue((vobj.ShapeColor[0],vobj.ShapeColor[1],vobj.ShapeColor[2])) diff --git a/src/Mod/Arch/ArchStairs.py b/src/Mod/Arch/ArchStairs.py index 4aa8084092..fa511ce7e9 100644 --- a/src/Mod/Arch/ArchStairs.py +++ b/src/Mod/Arch/ArchStairs.py @@ -19,9 +19,9 @@ #* * #*************************************************************************** -__title__="FreeCAD Arch Stairs" +__title__= "FreeCAD Arch Stairs" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" import FreeCAD,ArchComponent,ArchCommands,Draft,DraftVecUtils,math,ArchPipe diff --git a/src/Mod/Arch/ArchStructure.py b/src/Mod/Arch/ArchStructure.py index 63a691d4a4..96daa3851c 100644 --- a/src/Mod/Arch/ArchStructure.py +++ b/src/Mod/Arch/ArchStructure.py @@ -48,9 +48,9 @@ else: # elements that have a structural function, that is, that # support other parts of the building. -__title__="FreeCAD Structure" +__title__= "FreeCAD Structure" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" #Reads preset profiles and categorizes them @@ -116,7 +116,7 @@ def makeStructure(baseobj=None,length=None,width=None,height=None,name="Structur elif height and not length: obj.Width = w obj.Length = h - + if not height and not length: obj.IfcType = "Undefined" elif obj.Length > obj.Height: @@ -344,7 +344,7 @@ class _CommandStructure: self.Activated() def _createItemlist(self, baselist): - + "create nice labels for presets in the task panel" ilist=[] diff --git a/src/Mod/Arch/ArchTruss.py b/src/Mod/Arch/ArchTruss.py index e4b22f6be0..fa5743894d 100644 --- a/src/Mod/Arch/ArchTruss.py +++ b/src/Mod/Arch/ArchTruss.py @@ -1,5 +1,4 @@ # -*- coding: utf8 -*- - #*************************************************************************** #* Copyright (c) 2020 Yorik van Havre * #* * @@ -21,9 +20,9 @@ #* * #*************************************************************************** -__title__="FreeCAD Arch Truss" +__title__ = "FreeCAD Arch Truss" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" import math,sys import FreeCAD diff --git a/src/Mod/Arch/ArchVRM.py b/src/Mod/Arch/ArchVRM.py index b3b6445b3b..a4f9d38466 100644 --- a/src/Mod/Arch/ArchVRM.py +++ b/src/Mod/Arch/ArchVRM.py @@ -46,21 +46,21 @@ class Renderer: """ Creates a renderer with a default Draft WorkingPlane Use like this: - + import ArchVRM p = ArchVRM.Renderer() p.add(App.ActiveDocument.ActiveObject) p.sort() p.buildDummy() """ - + self.reset() if wp: self.wp = wp else: import WorkingPlane self.wp = WorkingPlane.plane() - + if DEBUG: print("Renderer initialized on " + str(self.wp)) def __str__(self): @@ -155,7 +155,7 @@ class Renderer: def reorient(self): "reorients the faces on the WP" #print("VRM: start reorient") - if not self.faces: + if not self.faces: return self.faces = [self.projectFace(f) for f in self.faces] if self.sections: @@ -167,7 +167,7 @@ class Renderer: def removeHidden(self): "removes faces pointing outwards" - if not self.faces: + if not self.faces: return faces = [] for f in self.faces: @@ -218,7 +218,7 @@ class Renderer: v2 = self.wp.getLocalCoords(edge.Vertexes[-1].Point) return Part.LineSegment(v1,v2).toShape() return edge - + def flattenFace(self,face): "Returns a face where all vertices have Z = 0" wires = [] @@ -281,10 +281,10 @@ class Renderer: def isInside(self,vert,face): "Returns True if the vert is inside the face in Z projection" - + if not face: return False - + # http://paulbourke.net/geometry/insidepoly/ count = 0 p = self.wp.getLocalCoords(vert.Point) @@ -307,10 +307,10 @@ class Renderer: "Checks if face1 overlaps face2 in Z direction" face1 = self.flattenFace(face1) face2 = self.flattenFace(face2) - + if (not face1) or (not face2): return False - + # first we check if one of the verts is inside the other face for v in face1[0].Vertexes: if self.isInside(v,face2): @@ -648,4 +648,4 @@ class Renderer: svg += '"/>\n' svg += '\n' return svg - + diff --git a/src/Mod/Arch/ArchWall.py b/src/Mod/Arch/ArchWall.py index f63eb347f0..3404239f0d 100644 --- a/src/Mod/Arch/ArchWall.py +++ b/src/Mod/Arch/ArchWall.py @@ -53,9 +53,9 @@ else: # usually vertical, typically obtained by giving a thickness to a base line, # then extruding it vertically. -__title__="FreeCAD Wall" +__title__ = "FreeCAD Wall" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" def makeWall(baseobj=None,height=None,length=None,width=None,align="Center",face=None,name=None): """Create a wall based on a given object, and returns the generated wall. @@ -1269,15 +1269,15 @@ class _Wall(ArchComponent.Component): else: self.basewires = obj.Base.Shape.Wires - # Found case that after sorting below, direction of + # Found case that after sorting below, direction of # edges sorted are not as 'expected' thus resulted in - # bug - e.g. a Dwire with edges/vertexes in clockwise - # order, 1st vertex is Forward as expected. After - # sorting below, edges sorted still in clockwise order - # - no problem, but 1st vertex of each edge become + # bug - e.g. a Dwire with edges/vertexes in clockwise + # order, 1st vertex is Forward as expected. After + # sorting below, edges sorted still in clockwise order + # - no problem, but 1st vertex of each edge become # Reverse rather than Forward. - # See FC discussion - + # See FC discussion - # https://forum.freecadweb.org/viewtopic.php?f=23&t=48275&p=413745#p413745 #self.basewires = [] diff --git a/src/Mod/Arch/ArchWindow.py b/src/Mod/Arch/ArchWindow.py index f64e6da83b..d7ce6b2a18 100644 --- a/src/Mod/Arch/ArchWindow.py +++ b/src/Mod/Arch/ArchWindow.py @@ -48,9 +48,9 @@ else: # of wires, and that can be inserted into other Arch objects, # by defining a volume that gets subtracted from them. -__title__="FreeCAD Window" +__title__ = "FreeCAD Window" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" # presets WindowPartTypes = ["Frame","Solid panel","Glass panel","Louvre"] diff --git a/src/Mod/Arch/InitGui.py b/src/Mod/Arch/InitGui.py index d6317f3efd..56a3ce01fe 100644 --- a/src/Mod/Arch/InitGui.py +++ b/src/Mod/Arch/InitGui.py @@ -1,4 +1,3 @@ -"""Initialization of the Arch workbench (graphical interface).""" # *************************************************************************** # * Copyright (c) 2011 Yorik van Havre * # * * @@ -19,6 +18,9 @@ # * USA * # * * # *************************************************************************** + +"""Initialization of the Arch workbench (graphical interface).""" + import os import FreeCAD import FreeCADGui diff --git a/src/Mod/Arch/OfflineRenderingUtils.py b/src/Mod/Arch/OfflineRenderingUtils.py index e6c1c08c4b..bfd1776779 100755 --- a/src/Mod/Arch/OfflineRenderingUtils.py +++ b/src/Mod/Arch/OfflineRenderingUtils.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - #*************************************************************************** #* Copyright (c) 2019 Yorik van Havre * #* * @@ -249,7 +248,7 @@ def saveDiffuseColor(colorlist): else: return bytes((i,)) # if too many colors, bail out and use only the first one for now... - if len(colorlist) > 254: + if len(colorlist) > 254: colorlist = colorlist[:1] print("debug: too many colors, reducing") output = tochr(len(colorlist))+3*tochr(0) diff --git a/src/Mod/Arch/TestArch.py b/src/Mod/Arch/TestArch.py index 6e71b68dff..07c07b974c 100644 --- a/src/Mod/Arch/TestArch.py +++ b/src/Mod/Arch/TestArch.py @@ -1,5 +1,3 @@ -# Unit test for the Arch module - #*************************************************************************** #* Copyright (c) 2013 Yorik van Havre * #* * @@ -23,6 +21,8 @@ #* * #***************************************************************************/ +# Unit test for the Arch module + import os import unittest diff --git a/src/Mod/Arch/exportIFC.py b/src/Mod/Arch/exportIFC.py index df8a55a28d..e85e8080f3 100644 --- a/src/Mod/Arch/exportIFC.py +++ b/src/Mod/Arch/exportIFC.py @@ -53,9 +53,9 @@ from draftutils.messages import _msg, _err if FreeCAD.GuiUp: import FreeCADGui -__title__ = "FreeCAD IFC export" +__title__ = "FreeCAD IFC export" __author__ = ("Yorik van Havre", "Jonathan Wiedemann", "Bernd Hahnebach") -__url__ = "https://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" # Save the Python open function because it will be redefined if open.__module__ in ['__builtin__', 'io']: @@ -479,7 +479,7 @@ def export(exportList, filename, colors=None, preferences=None): ifctype = "IfcBuildingElementProxy" # getting the representation - + # ignore the own shape for assembly objects skipshape = False if assemblyElements: @@ -1642,7 +1642,7 @@ def getIfcTypeFromObj(obj): else: # it makes no sense to return IfcPart::Cylinder for a Part::Cylinder # this is not a ifctype at all - ifctype = None + ifctype = None # print("Return value of getIfcTypeFromObj: {}".format(ifctype)) return ifctype diff --git a/src/Mod/Arch/exportIFCHelper.py b/src/Mod/Arch/exportIFCHelper.py index 4b8c98cff7..fb113e6ab0 100644 --- a/src/Mod/Arch/exportIFCHelper.py +++ b/src/Mod/Arch/exportIFCHelper.py @@ -38,10 +38,10 @@ def getObjectsOfIfcType(objects, ifcType): def writeUnits(ifcfile,unit="metre"): - + """adds additional units settings to the given ifc file if needed""" # so far, only metre or foot possible (which is all revit knows anyway) - + if unit == "foot": d1 = ifcfile.createIfcDimensionalExponents(1,0,0,0,0,0,0); d2 = ifcfile.createIfcMeasureWithUnit(ifcfile.createIfcRatioMeasure(0.3048),ifcfile[13]) @@ -395,7 +395,7 @@ class recycler: if self.compress: self.psas[key] = c return c - + def createIfcRectangleProfileDef(self,name,mode,pt,b,h): key = "RECT"+str(name)+str(mode)+str(pt)+str(b)+str(h) if self.compress and self.mergeProfiles and key in self.profiledefs: diff --git a/src/Mod/Arch/import3DS.py b/src/Mod/Arch/import3DS.py index 9942aa9a8a..11d1a0c6fb 100644 --- a/src/Mod/Arch/import3DS.py +++ b/src/Mod/Arch/import3DS.py @@ -1,5 +1,5 @@ #*************************************************************************** -#* Copyright (c) 2016 Yorik van Havre * +#* Copyright (c) 2016 Yorik van Havre * #* * #* This program is free software; you can redistribute it and/or modify * #* it under the terms of the GNU Lesser General Public License (LGPL) * @@ -22,9 +22,9 @@ from __future__ import print_function import os,FreeCAD,Mesh -__title__="FreeCAD 3DS importer" +__title__ = "FreeCAD 3DS importer" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" DEBUG = True @@ -45,11 +45,11 @@ def check3DS(): return False else: return True - + def open(filename): "called when freecad wants to open a file" - if not check3DS(): + if not check3DS(): return docname = (os.path.splitext(os.path.basename(filename))[0]).encode("utf8") doc = FreeCAD.newDocument(docname) @@ -61,7 +61,7 @@ def open(filename): def insert(filename,docname): "called when freecad wants to import a file" - if not check3DS(): + if not check3DS(): return try: doc = FreeCAD.getDocument(docname) diff --git a/src/Mod/Arch/importDAE.py b/src/Mod/Arch/importDAE.py index a8036fd62d..35a49e8083 100644 --- a/src/Mod/Arch/importDAE.py +++ b/src/Mod/Arch/importDAE.py @@ -34,9 +34,9 @@ else: # # This module provides tools to import and export Collada (.dae) files. -__title__="FreeCAD Collada importer" +__title__ = "FreeCAD Collada importer" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" DEBUG = True @@ -47,9 +47,9 @@ except NameError: pass def checkCollada(): - + "checks if collada if available" - + global collada COLLADA = None try: @@ -59,12 +59,12 @@ def checkCollada(): return False else: return True - - + + def triangulate(shape): - + "triangulates the given face" - + p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch") mesher = p.GetInt("ColladaMesher",0) tessellation = p.GetFloat("ColladaTessellation",1.0) @@ -83,12 +83,12 @@ def triangulate(shape): SegPerRadius=segsperradius,SecondOrder=secondorder,Optimize=optimize, AllowQuad=allowquads).Topology - + def open(filename): "called when freecad wants to open a file" - if not checkCollada(): + if not checkCollada(): return docname = (os.path.splitext(os.path.basename(filename))[0]).encode("utf8") doc = FreeCAD.newDocument(docname) @@ -102,7 +102,7 @@ def insert(filename,docname): "called when freecad wants to import a file" - if not checkCollada(): + if not checkCollada(): return try: doc = FreeCAD.getDocument(docname) @@ -129,9 +129,9 @@ def decode(name): def read(filename): - + "reads a DAE file" - + global col col = collada.Collada(filename, ignore=[collada.DaeUnsupportedError]) # Read the unitmeter info from dae file and compute unit to convert to mm @@ -186,12 +186,12 @@ def read(filename): def export(exportList,filename,tessellation=1,colors=None): - + """export(exportList,filename,tessellation=1,colors=None) -- exports FreeCAD contents to a DAE file. colors is an optional dictionary of objName:shapeColorTuple or objName:diffuseColorList elements to be used in non-GUI mode if you want to be able to export colors. Tessellation is used when breaking curved surfaces into triangles.""" - + if not checkCollada(): return p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch") scale = p.GetFloat("ColladaScalingFactor",1.0) diff --git a/src/Mod/Arch/importGBXML.py b/src/Mod/Arch/importGBXML.py index 86a6a92466..3c54de64e8 100644 --- a/src/Mod/Arch/importGBXML.py +++ b/src/Mod/Arch/importGBXML.py @@ -19,9 +19,9 @@ #* * #*************************************************************************** -__title__= "FreeCAD GbXml exporter" +__title__ = "FreeCAD GbXml exporter" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" import os,FreeCAD,Draft @@ -32,15 +32,15 @@ else: def translate(ctx,txt): return txt # \endcond - + ## @package importGBXML # \ingroup ARCH # \brief GBXML file format exporter # # This module provides tools to export GBXML files. - + def export(objectslist,filename): - + if len(objectslist) != 1: FreeCAD.Console.PrintError(translate("Arch","This exporter can currently only export one site object")+"\n") return @@ -48,13 +48,13 @@ def export(objectslist,filename): if Draft.getType(site) != "Site": FreeCAD.Console.PrintError(translate("Arch","This exporter can currently only export one site object")+"\n") return - + filestream = pyopen(filename,"wb") - + # header filestream.write( '\n' ) filestream.write( '\n' % FreeCAD.Version()[0]+FreeCAD.Version()[1]+FreeCAD.Version()[2] ) - filestream.write( '\n' % (building.Name,building.BuildingType) ) filestream.write( ' $f\n' % str(building.Area.getValueAs("m^2")) ) - + # spaces for space in Draft.getObjectsOfType(Draft.get_group_contents(building.Group, addgroups=True), "Space"): @@ -100,7 +100,7 @@ def export(objectslist,filename): filestream.write( ' $f\n' % space.Area.getValueAs("m^2") ) filestream.write( ' $f\n' % FreeCAD.Units.Quantity(space.Shape.Volume,FreeCAD.Units.Volume).getValueAs("m^3") ) filestream.write( ' \n' % space.Name ) - + # shells for solid in space.Shape.Solids: filestream.write( ' \n' ) @@ -116,7 +116,7 @@ def export(objectslist,filename): filestream.write( ' \n' ) filestream.write( ' \n' ) filestream.write( ' \n' ) - + # surfaces for i,face in enumerate(space.Shape.Faces): filestream.write( ' \n' ) filestream.write( ' \n' ) filestream.write( ' \n' ) - + filestream.write( ' \n' ) - + filestream.write( ' \n' ) - + filestream.write( '\n' ) - + filestream.write( '' ) -''' +''' 18000.00000 Lab corridor @@ -179,7 +179,7 @@ def export(objectslist,filename): - + @@ -206,19 +206,19 @@ def export(objectslist,filename): - - - - + + + + 21E2 ... repeat - - - + + + Floor @@ -268,8 +268,8 @@ def export(objectslist,filename): - - + + Surface 4 @@ -415,7 +415,7 @@ def export(objectslist,filename): - + ... repeat diff --git a/src/Mod/Arch/importIFC.py b/src/Mod/Arch/importIFC.py index f873f4c591..60959f17a7 100644 --- a/src/Mod/Arch/importIFC.py +++ b/src/Mod/Arch/importIFC.py @@ -49,9 +49,9 @@ from draftutils.messages import _msg, _err if FreeCAD.GuiUp: import FreeCADGui as Gui -__title__ = "FreeCAD IFC importer - Enhanced ifcopenshell-only version" +__title__ = "FreeCAD IFC importer - Enhanced IfcOpenShell-only version" __author__ = ("Yorik van Havre", "Jonathan Wiedemann", "Bernd Hahnebach") -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" DEBUG = False # Set to True to see debug messages. Otherwise, totally silent ZOOMOUT = True # Set to False to not zoom extents after import diff --git a/src/Mod/Arch/importIFCHelper.py b/src/Mod/Arch/importIFCHelper.py index 7f980276c1..abf2e937d7 100644 --- a/src/Mod/Arch/importIFCHelper.py +++ b/src/Mod/Arch/importIFCHelper.py @@ -453,7 +453,7 @@ def getColorFromStyledItem(styled_item): # this is an error in the IFC file in my opinion else: # never seen an ifc with more than one Styles in IfcStyledItem - # the above seams to only apply for IFC2x3, IFC4 can have them + # the above seams to only apply for IFC2x3, IFC4 can have them # see https://forum.freecadweb.org/viewtopic.php?f=39&t=33560&p=437056#p437056 # Get the `IfcPresentationStyleAssignment`, there should only be one, diff --git a/src/Mod/Arch/importOBJ.py b/src/Mod/Arch/importOBJ.py index 5135ecbac3..af43fe55c8 100644 --- a/src/Mod/Arch/importOBJ.py +++ b/src/Mod/Arch/importOBJ.py @@ -248,10 +248,10 @@ def export(exportList,filename,colors=None): outfile.write("f" + f + "\n") outfile.close() FreeCAD.Console.PrintMessage(translate("Arch","Successfully written") + " " + decode(filename) + "\n") - if materials: + if materials: outfile = pythonopen(filenamemtl,"w") outfile.write("# FreeCAD v" + ver[0] + "." + ver[1] + " build" + ver[2] + " Arch module\n") - outfile.write("# http://www.freecadweb.org\n") + outfile.write("# https://www.freecadweb.org\n") kinds = {"AmbientColor":"Ka ","DiffuseColor":"Kd ","SpecularColor":"Ks ","EmissiveColor":"Ke ","Transparency":"Tr "} done = [] # store names to avoid duplicates for mat in materials: diff --git a/src/Mod/Arch/importSH3D.py b/src/Mod/Arch/importSH3D.py index 37b351c9ce..31ebe74c8f 100644 --- a/src/Mod/Arch/importSH3D.py +++ b/src/Mod/Arch/importSH3D.py @@ -20,9 +20,9 @@ #*************************************************************************** from __future__ import print_function -__title__ = "FreeCAD SweetHome3D importer" +__title__ = "FreeCAD SweetHome3D Importer" __author__ = "Yorik van Havre" -__url__ = "http://www.freecadweb.org" +__url__ = "https://www.freecadweb.org" import os,zipfile,xml.sax,FreeCAD,Part,Draft,Arch,Mesh,tempfile,math,Sketcher @@ -46,7 +46,7 @@ def open(filename): FreeCAD.ActiveDocument = doc read(filename) return doc - + def insert(filename,docname): "called when freecad wants to import a file" @@ -74,7 +74,7 @@ def decode(name): def read(filename): "reads the file and creates objects in the active document" - + z = zipfile.ZipFile(filename) homexml = z.read("Home.xml") handler = SH3DHandler(z) @@ -105,15 +105,15 @@ def read(filename): class SH3DHandler(xml.sax.ContentHandler): def __init__(self,z): - + self.makeIndividualWalls = False self.z = z self.windows = [] self.furniture = [] self.lines = {} - + def startElement(self, tag, attributes): - + if tag == "wall": name = attributes["id"] p1 = FreeCAD.Vector(float(attributes["xStart"])*10,float(attributes["yStart"])*10,0) @@ -127,7 +127,7 @@ class SH3DHandler(xml.sax.ContentHandler): wall.Label = name else: self.lines.setdefault(str(thickness)+";"+str(height),[]).append(line) - + elif tag == "pieceOfFurniture": name = attributes["name"] data = self.z.read(attributes["model"]) @@ -156,7 +156,7 @@ class SH3DHandler(xml.sax.ContentHandler): obj = FreeCAD.ActiveDocument.addObject("Mesh::Feature",name) obj.Mesh = m self.furniture.append(obj) - + elif tag == "doorOrWindow": name = attributes["name"] data = self.z.read(attributes["model"]) diff --git a/src/Mod/Arch/importSHP.py b/src/Mod/Arch/importSHP.py index f31a6e78fb..304a439859 100644 --- a/src/Mod/Arch/importSHP.py +++ b/src/Mod/Arch/importSHP.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- #*************************************************************************** -#* * #* Copyright (c) 2020 Yorik van Havre * #* * #* This program is free software; you can redistribute it and/or modify * @@ -53,7 +52,7 @@ def insert(filename,docname,record=None): if not checkShapeFileLibrary(): return - + import shapefile import Part @@ -61,7 +60,7 @@ def insert(filename,docname,record=None): # doc at https://github.com/GeospatialPython/pyshp shp = shapefile.Reader(filename) - + # check which record to use for elevation if not record: fields = ["None"] + [field[0] for field in shp.fields] @@ -74,7 +73,7 @@ def insert(filename,docname,record=None): fields) if reply[1] and reply[0] != "None": record = reply[0] - + # build shapes shapes = [] for shaperec in shp.shapeRecords(): @@ -114,7 +113,7 @@ def insert(filename,docname,record=None): FreeCAD.Console.PrintWarning(translate("Arch","No shape found in this file")+"\n") def getFields(filename): - + """returns the fields found in the given file""" if not checkShapeFileLibrary(): @@ -124,7 +123,7 @@ def getFields(filename): return [field[0] for field in shp.fields] def checkShapeFileLibrary(): - + """Looks for and/or installs the ShapeFile library""" try: @@ -135,10 +134,10 @@ def checkShapeFileLibrary(): import addonmanager_utilities import FreeCADGui from PySide import QtGui - reply = QtGui.QMessageBox.question(FreeCADGui.getMainWindow(), - translate("Arch","Shapefile module not found"), + reply = QtGui.QMessageBox.question(FreeCADGui.getMainWindow(), + translate("Arch","Shapefile module not found"), translate("Arch","The shapefile python library was not found on your system. Would you like to download it now from https://github.com/GeospatialPython/pyshp? It will be placed in your macros folder."), - QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, + QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No) if reply == QtGui.QMessageBox.Yes: u = addonmanager_utilities.urlopen(url) diff --git a/src/Mod/Arch/importWebGL.py b/src/Mod/Arch/importWebGL.py index 09e70e57aa..3bc1f75c94 100644 --- a/src/Mod/Arch/importWebGL.py +++ b/src/Mod/Arch/importWebGL.py @@ -22,7 +22,7 @@ """FreeCAD webgl exporter options: importWebGL.wireframeStyle = "faceloop" (can also be "multimaterial" or None) -importWebGL.template = a complete html file, where $CameraData is a placeholder for the +importWebGL.template = a complete html file, where $CameraData is a placeholder for the FreeCAD camera, and $ObjectsData a placeholder for the FreeCAD objects. importWebGL.linewidth = an integer, specifying the width of lines in "faceloop" mode""" @@ -42,7 +42,7 @@ else: # \ingroup ARCH # \brief WebGL file format exporter # -# This module provides tools to export HTML files containing the +# This module provides tools to export HTML files containing the # exported objects in WebGL format and a simple three.js-based viewer. tab = " " # the tab size @@ -86,7 +86,7 @@ template = """ controls.noPan = false; controls.staticMoving = true; controls.dynamicDampingFactor = 0.3; - controls.keys = [ 65, 83, 68 ]; + controls.keys = [ 65, 83, 68 ]; $ObjectsData // placeholder for the FreeCAD objects @@ -116,7 +116,7 @@ template = """ if open.__module__ in ['__builtin__','io']: pythonopen = open - + def export(exportList,filename,colors=None,camera=None): "exports the given objects to an .html file" @@ -125,10 +125,10 @@ def export(exportList,filename,colors=None,camera=None): outfile.write(html) outfile.close() FreeCAD.Console.PrintMessage(translate("Arch", "Successfully written", utf8_decode=True) + ' ' + filename + "\n") - + def getHTML(objectsList,colors=None,camera=None): "returns the complete HTML code of a viewer for the given objects" - + # get objects data objectsData = '' for obj in objectsList: @@ -140,10 +140,10 @@ def getHTML(objectsList,colors=None,camera=None): t = template.replace("$CameraData",getCameraData(camera)) t = t.replace("$ObjectsData",objectsData) return t - + def getCameraData(camera=None): "returns the position and direction of the camera as three.js snippet" - + result = "" if camera: global cameraPosition @@ -167,11 +167,11 @@ def getCameraData(camera=None): result += tab+"camera.lookAt( scene.position );\n"+tab # print(result) return result - + def getObjectData(obj,wireframeMode=wireframeStyle,color=None): - """returns the geometry data of an object as three.js snippet. + """returns the geometry data of an object as three.js snippet. wireframeMode can be multimaterial, faceloop, or None""" - + result = "" wires = [] @@ -196,7 +196,7 @@ def getObjectData(obj,wireframeMode=wireframeStyle,color=None): elif obj.isDerivedFrom("Mesh::Feature"): mesh = obj.Mesh result = "var geom = new THREE.Geometry();\n" - # adding vertices data + # adding vertices data for p in mesh.Points: v = p.Vector i = p.Index @@ -208,7 +208,7 @@ def getObjectData(obj,wireframeMode=wireframeStyle,color=None): for f in mesh.Facets: pointIndices = tuple([ int(i) for i in f.PointIndices ]) result += tab+"geom.faces.push( new THREE.Face3"+str(pointIndices).replace("L","")+" );\n" - + if result: # adding a base material if color: @@ -220,7 +220,7 @@ def getObjectData(obj,wireframeMode=wireframeStyle,color=None): rgb = "#888888" # test color result += tab+"var basematerial = new THREE.MeshBasicMaterial( { color: 0x"+str(rgb)[1:]+" } );\n" #result += tab+"var basematerial = new THREE.MeshLambertMaterial( { color: 0x"+str(rgb)[1:]+" } );\n" - + if wireframeMode == "faceloop": # adding the mesh to the scene with a wireframe copy result += tab+"var mesh = new THREE.Mesh( geom, basematerial );\n" @@ -233,7 +233,7 @@ def getObjectData(obj,wireframeMode=wireframeStyle,color=None): result += str(p.x)+", "+str(p.y)+", "+str(p.z)+"));\n" result += tab+"var line = new THREE.Line(wire, linematerial);\n" result += tab+"scene.add(line);\n" - + elif wireframeMode == "multimaterial": # adding a wireframe material result += tab+"var wireframe = new THREE.MeshBasicMaterial( { color: " @@ -241,10 +241,10 @@ def getObjectData(obj,wireframeMode=wireframeStyle,color=None): result += tab+"var material = [ basematerial, wireframe ];\n" result += tab+"var mesh = new THREE.SceneUtils.createMultiMaterialObject( geom, material );\n" result += tab+"scene.add( mesh );\n"+tab - + else: # adding the mesh to the scene with simple material result += tab+"var mesh = new THREE.Mesh( geom, basematerial );\n" result += tab+"scene.add( mesh );\n"+tab - + return result