Cleaning in the Arch module

This commit is contained in:
Yorik van Havre 2012-05-18 15:59:53 -03:00
parent c12c62fa5a
commit 801196bb14
4 changed files with 29 additions and 18 deletions

View File

@ -34,7 +34,7 @@ class _CommandSectionPlane:
return {'Pixmap' : 'Arch_SectionPlane',
'Accel': "S, P",
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_SectionPlane","Section Plane"),
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_SectionPlane","Adds a section plane object to the document")}
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_SectionPlane","Creates a section plane object, including the selected objects")}
def Activated(self):
sel = FreeCADGui.Selection.getSelection()
@ -47,6 +47,8 @@ class _CommandSectionPlane:
for o in sel:
if o.isDerivedFrom("Part::Feature"):
g.append(o)
elif o.isDerivedFrom("App::DocumentObjectGroup"):
g.append(o)
obj.Objects = g
page = FreeCAD.ActiveDocument.addObject("Drawing::FeaturePage","Page")
template = Draft.getParam("template")
@ -179,6 +181,7 @@ class _ArchDrawingView:
if hasattr(obj,"Source"):
if obj.Source:
if obj.Source.Objects:
objs = Draft.getGroupContents(obj.Sourc.Objects)
svg = ''
# generating SVG
@ -188,7 +191,7 @@ class _ArchDrawingView:
import ArchVRM
render = ArchVRM.Renderer()
render.setWorkingPlane(obj.Source.Placement)
render.addObjects(obj.Source.Objects)
render.addObjects(objs)
render.cut(obj.Source.Shape)
svg += render.getViewSVG(linewidth=linewidth)
svg += render.getSectionSVG(linewidth=linewidth*2)
@ -197,7 +200,7 @@ class _ArchDrawingView:
else:
# render using the Drawing module
shapes = []
for o in obj.Source.Objects:
for o in objs:
if o.isDerivedFrom("Part::Feature"):
shapes.append(o.Shape)
if shapes:

View File

@ -78,17 +78,19 @@ class _CommandWindow:
return {'Pixmap' : 'Arch_Window',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Window","Window"),
'Accel': "W, N",
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Window","Creates a window object from scratch or from a selected object (wire, rectangle or sketch)")}
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Window","Creates a window object from a selected object (wire, rectangle or sketch)")}
def IsActive(self):
if FreeCADGui.Selection.getSelection():
return True
else:
return False
def Activated(self):
sel = FreeCADGui.Selection.getSelection()
FreeCAD.ActiveDocument.openTransaction("Window")
if sel:
for obj in sel:
makeWindow(obj)
else:
rect = Draft.makeRectangle(1,1)
makeWindow(rect)
FreeCAD.ActiveDocument.openTransaction("Create Window")
for obj in sel:
makeWindow(obj)
FreeCAD.ActiveDocument.commitTransaction()
class _Window(ArchComponent.Component):

View File

@ -58,10 +58,10 @@ class ArchWorkbench(Workbench):
def Initialize(self):
import DraftTools,DraftGui,Arch_rc,Arch
self.archtools = ["Arch_Wall","Arch_Structure","Arch_Cell",
self.archtools = ["Arch_Wall","Arch_Structure",
"Arch_Floor","Arch_Building","Arch_Site",
"Arch_Window","Arch_Axis",
"Arch_SectionPlane","Arch_Roof","Arch_Add","Arch_Remove"]
"Arch_Window","Arch_Roof","Arch_Axis",
"Arch_SectionPlane","Arch_Add","Arch_Remove"]
self.drafttools = ["Draft_Line","Draft_Wire","Draft_Rectangle",
"Draft_Polygon","Draft_Arc",
"Draft_Circle","Draft_Dimension",
@ -100,6 +100,12 @@ class ArchWorkbench(Workbench):
FreeCADGui.addWorkbench(ArchWorkbench)
FreeCAD.addImportType("Industry Foundation Classes (*.ifc)","importIFC")
FreeCAD.addExportType("Wavefront OBJ - Arch module (*.obj)","importOBJ")
FreeCAD.addImportType("Collada (*.dae)","importDAE")
FreeCAD.addExportType("Collada (*.dae)","importDAE")
# check for pycollada
try:
import collada
except:
FreeCAD.Console.PrintError("pycollada not found, no collada support.\n")
else:
FreeCAD.addImportType("Collada (*.dae)","importDAE")
FreeCAD.addExportType("Collada (*.dae)","importDAE")

View File

@ -108,7 +108,7 @@ def getIfcOpenShell():
return True
def read(filename):
"Parses an IFC file with IfcOpenShell"
"Parses an IFC file"
# parsing the IFC file
t1 = time.time()
@ -186,7 +186,7 @@ def read(filename):
IfcImport.CleanUp()
else:
# use the internal python parser
# use only the internal python parser
# getting walls
for w in ifc.getEnt("IfcWallStandardCase"):