Cleaning in the Arch module
This commit is contained in:
parent
c12c62fa5a
commit
801196bb14
|
@ -34,7 +34,7 @@ class _CommandSectionPlane:
|
||||||
return {'Pixmap' : 'Arch_SectionPlane',
|
return {'Pixmap' : 'Arch_SectionPlane',
|
||||||
'Accel': "S, P",
|
'Accel': "S, P",
|
||||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_SectionPlane","Section Plane"),
|
'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):
|
def Activated(self):
|
||||||
sel = FreeCADGui.Selection.getSelection()
|
sel = FreeCADGui.Selection.getSelection()
|
||||||
|
@ -47,6 +47,8 @@ class _CommandSectionPlane:
|
||||||
for o in sel:
|
for o in sel:
|
||||||
if o.isDerivedFrom("Part::Feature"):
|
if o.isDerivedFrom("Part::Feature"):
|
||||||
g.append(o)
|
g.append(o)
|
||||||
|
elif o.isDerivedFrom("App::DocumentObjectGroup"):
|
||||||
|
g.append(o)
|
||||||
obj.Objects = g
|
obj.Objects = g
|
||||||
page = FreeCAD.ActiveDocument.addObject("Drawing::FeaturePage","Page")
|
page = FreeCAD.ActiveDocument.addObject("Drawing::FeaturePage","Page")
|
||||||
template = Draft.getParam("template")
|
template = Draft.getParam("template")
|
||||||
|
@ -179,6 +181,7 @@ class _ArchDrawingView:
|
||||||
if hasattr(obj,"Source"):
|
if hasattr(obj,"Source"):
|
||||||
if obj.Source:
|
if obj.Source:
|
||||||
if obj.Source.Objects:
|
if obj.Source.Objects:
|
||||||
|
objs = Draft.getGroupContents(obj.Sourc.Objects)
|
||||||
svg = ''
|
svg = ''
|
||||||
|
|
||||||
# generating SVG
|
# generating SVG
|
||||||
|
@ -188,7 +191,7 @@ class _ArchDrawingView:
|
||||||
import ArchVRM
|
import ArchVRM
|
||||||
render = ArchVRM.Renderer()
|
render = ArchVRM.Renderer()
|
||||||
render.setWorkingPlane(obj.Source.Placement)
|
render.setWorkingPlane(obj.Source.Placement)
|
||||||
render.addObjects(obj.Source.Objects)
|
render.addObjects(objs)
|
||||||
render.cut(obj.Source.Shape)
|
render.cut(obj.Source.Shape)
|
||||||
svg += render.getViewSVG(linewidth=linewidth)
|
svg += render.getViewSVG(linewidth=linewidth)
|
||||||
svg += render.getSectionSVG(linewidth=linewidth*2)
|
svg += render.getSectionSVG(linewidth=linewidth*2)
|
||||||
|
@ -197,7 +200,7 @@ class _ArchDrawingView:
|
||||||
else:
|
else:
|
||||||
# render using the Drawing module
|
# render using the Drawing module
|
||||||
shapes = []
|
shapes = []
|
||||||
for o in obj.Source.Objects:
|
for o in objs:
|
||||||
if o.isDerivedFrom("Part::Feature"):
|
if o.isDerivedFrom("Part::Feature"):
|
||||||
shapes.append(o.Shape)
|
shapes.append(o.Shape)
|
||||||
if shapes:
|
if shapes:
|
||||||
|
|
|
@ -78,17 +78,19 @@ class _CommandWindow:
|
||||||
return {'Pixmap' : 'Arch_Window',
|
return {'Pixmap' : 'Arch_Window',
|
||||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Window","Window"),
|
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Window","Window"),
|
||||||
'Accel': "W, N",
|
'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):
|
def Activated(self):
|
||||||
sel = FreeCADGui.Selection.getSelection()
|
sel = FreeCADGui.Selection.getSelection()
|
||||||
FreeCAD.ActiveDocument.openTransaction("Window")
|
FreeCAD.ActiveDocument.openTransaction("Create Window")
|
||||||
if sel:
|
for obj in sel:
|
||||||
for obj in sel:
|
makeWindow(obj)
|
||||||
makeWindow(obj)
|
|
||||||
else:
|
|
||||||
rect = Draft.makeRectangle(1,1)
|
|
||||||
makeWindow(rect)
|
|
||||||
FreeCAD.ActiveDocument.commitTransaction()
|
FreeCAD.ActiveDocument.commitTransaction()
|
||||||
|
|
||||||
class _Window(ArchComponent.Component):
|
class _Window(ArchComponent.Component):
|
||||||
|
|
|
@ -58,10 +58,10 @@ class ArchWorkbench(Workbench):
|
||||||
|
|
||||||
def Initialize(self):
|
def Initialize(self):
|
||||||
import DraftTools,DraftGui,Arch_rc,Arch
|
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_Floor","Arch_Building","Arch_Site",
|
||||||
"Arch_Window","Arch_Axis",
|
"Arch_Window","Arch_Roof","Arch_Axis",
|
||||||
"Arch_SectionPlane","Arch_Roof","Arch_Add","Arch_Remove"]
|
"Arch_SectionPlane","Arch_Add","Arch_Remove"]
|
||||||
self.drafttools = ["Draft_Line","Draft_Wire","Draft_Rectangle",
|
self.drafttools = ["Draft_Line","Draft_Wire","Draft_Rectangle",
|
||||||
"Draft_Polygon","Draft_Arc",
|
"Draft_Polygon","Draft_Arc",
|
||||||
"Draft_Circle","Draft_Dimension",
|
"Draft_Circle","Draft_Dimension",
|
||||||
|
@ -100,6 +100,12 @@ class ArchWorkbench(Workbench):
|
||||||
FreeCADGui.addWorkbench(ArchWorkbench)
|
FreeCADGui.addWorkbench(ArchWorkbench)
|
||||||
FreeCAD.addImportType("Industry Foundation Classes (*.ifc)","importIFC")
|
FreeCAD.addImportType("Industry Foundation Classes (*.ifc)","importIFC")
|
||||||
FreeCAD.addExportType("Wavefront OBJ - Arch module (*.obj)","importOBJ")
|
FreeCAD.addExportType("Wavefront OBJ - Arch module (*.obj)","importOBJ")
|
||||||
FreeCAD.addImportType("Collada (*.dae)","importDAE")
|
# check for pycollada
|
||||||
FreeCAD.addExportType("Collada (*.dae)","importDAE")
|
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")
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ def getIfcOpenShell():
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def read(filename):
|
def read(filename):
|
||||||
"Parses an IFC file with IfcOpenShell"
|
"Parses an IFC file"
|
||||||
|
|
||||||
# parsing the IFC file
|
# parsing the IFC file
|
||||||
t1 = time.time()
|
t1 = time.time()
|
||||||
|
@ -186,7 +186,7 @@ def read(filename):
|
||||||
IfcImport.CleanUp()
|
IfcImport.CleanUp()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# use the internal python parser
|
# use only the internal python parser
|
||||||
|
|
||||||
# getting walls
|
# getting walls
|
||||||
for w in ifc.getEnt("IfcWallStandardCase"):
|
for w in ifc.getEnt("IfcWallStandardCase"):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user