BIM - moved importers to subdir
This commit is contained in:
committed by
Yorik van Havre
parent
ca7bbb5943
commit
bd1edd292a
0
src/Mod/Arch/importers/__init__.py
Normal file
0
src/Mod/Arch/importers/__init__.py
Normal file
@@ -46,7 +46,6 @@ from DraftGeomUtils import vec
|
||||
from importIFCHelper import dd2dms
|
||||
from draftutils import params
|
||||
from draftutils.messages import _msg, _err
|
||||
from builtins import open as pyopen
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
@@ -55,6 +54,10 @@ __title__ = "FreeCAD IFC export"
|
||||
__author__ = ("Yorik van Havre", "Jonathan Wiedemann", "Bernd Hahnebach")
|
||||
__url__ = "https://www.freecad.org"
|
||||
|
||||
# Save the Python open function because it will be redefined
|
||||
if open.__module__ in ['__builtin__', 'io']:
|
||||
pyopen = open
|
||||
|
||||
# Templates and other definitions ****
|
||||
# Specific FreeCAD <-> IFC slang translations
|
||||
translationtable = {
|
||||
@@ -25,7 +25,6 @@ __url__ = "https://www.freecad.org"
|
||||
|
||||
import FreeCAD
|
||||
import Draft
|
||||
from builtins import open as pyopen
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
from draftutils.translate import translate
|
||||
@@ -44,7 +44,6 @@ import importIFCmulticore
|
||||
|
||||
from draftutils import params
|
||||
from draftutils.messages import _msg, _err
|
||||
from builtins import open as pyopen
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui as Gui
|
||||
@@ -56,6 +55,10 @@ __url__ = "https://www.freecad.org"
|
||||
DEBUG = False # Set to True to see debug messages. Otherwise, totally silent
|
||||
ZOOMOUT = True # Set to False to not zoom extents after import
|
||||
|
||||
# Save the Python open function because it will be redefined
|
||||
if open.__module__ in ['__builtin__', 'io']:
|
||||
pyopen = open
|
||||
|
||||
# Templates and other definitions ****
|
||||
# which IFC type must create which FreeCAD type
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
import FreeCAD, Arch, Draft, os, sys, time, Part, DraftVecUtils, uuid, math, re
|
||||
from draftutils import params
|
||||
from draftutils.translate import translate
|
||||
from builtins import open as pyopen
|
||||
|
||||
__title__="FreeCAD IFC importer"
|
||||
__author__ = "Yorik van Havre"
|
||||
@@ -55,7 +54,8 @@ supportedIfcTypes = ["IfcSite", "IfcBuilding", "IfcBuildingStorey", "IfcBeam", "
|
||||
"IfcPile", "IfcFooting", "IfcReinforcingBar", "IfcTendon"]
|
||||
# TODO : shading device not supported?
|
||||
|
||||
|
||||
if open.__module__ in ['__builtin__','io']:
|
||||
pyopen = open # because we'll redefine open below
|
||||
|
||||
def open(filename,skip=None):
|
||||
"called when freecad opens a file"
|
||||
@@ -1795,6 +1795,7 @@ def explorer(filename,schema="IFC2X3_TC1.exp"):
|
||||
tree.headerItem().setText(1, "")
|
||||
tree.headerItem().setText(2, "Item and Properties")
|
||||
bold = QtGui.QFont()
|
||||
bold.setWeight(75)
|
||||
bold.setBold(True)
|
||||
|
||||
#print(ifc.Entities)
|
||||
@@ -27,7 +27,6 @@ import FreeCAD
|
||||
import Draft
|
||||
import Mesh
|
||||
import Part
|
||||
from builtins import open as pyopen
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
@@ -38,7 +37,8 @@ else:
|
||||
def translate(ctxt, txt): return txt
|
||||
|
||||
|
||||
|
||||
if open.__module__ in ['__builtin__','io']:
|
||||
pythonopen = open
|
||||
|
||||
|
||||
def export(exportList, filename):
|
||||
@@ -52,7 +52,7 @@ def export(exportList, filename):
|
||||
}
|
||||
|
||||
# Write file
|
||||
outfile = pyopen(filename, "w")
|
||||
outfile = pythonopen(filename, "w")
|
||||
json.dump(data, outfile, separators = (',', ':'))
|
||||
outfile.close()
|
||||
|
||||
@@ -32,7 +32,6 @@ import Mesh
|
||||
import MeshPart
|
||||
import Part
|
||||
from draftutils import params
|
||||
from builtins import open as pyopen
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
from draftutils.translate import translate
|
||||
@@ -51,7 +50,8 @@ else:
|
||||
# and supports exporting faces with more than 3 vertices
|
||||
# and supports object colors / materials
|
||||
|
||||
|
||||
if open.__module__ in ['__builtin__','io']:
|
||||
pythonopen = open
|
||||
|
||||
def findVert(aVertex,aList):
|
||||
"finds aVertex in aList, returns index"
|
||||
@@ -260,7 +260,7 @@ def export(exportList,filename,colors=None):
|
||||
outfile.close()
|
||||
FreeCAD.Console.PrintMessage(translate("Arch","Successfully written") + " " + filename + "\n")
|
||||
if materials:
|
||||
outfile = pyopen(filenamemtl,"w")
|
||||
outfile = pythonopen(filenamemtl,"w")
|
||||
outfile.write("# FreeCAD v" + ver[0] + "." + ver[1] + " build" + ver[2] + " Arch module\n")
|
||||
outfile.write("# https://www.freecad.org\n")
|
||||
kinds = {"AmbientColor":"Ka ","DiffuseColor":"Kd ","SpecularColor":"Ks ","EmissiveColor":"Ke ","Transparency":"Tr ","Dissolve":"d "}
|
||||
@@ -306,7 +306,7 @@ def insert(filename,docname):
|
||||
doc = FreeCAD.newDocument(docname)
|
||||
FreeCAD.ActiveDocument = doc
|
||||
|
||||
with pyopen(filename,"r") as infile:
|
||||
with pythonopen(filename,"r") as infile:
|
||||
verts = []
|
||||
facets = []
|
||||
activeobject = None
|
||||
@@ -327,7 +327,7 @@ def insert(filename,docname):
|
||||
if line[:7] == "mtllib ":
|
||||
matlib = os.path.join(os.path.dirname(filename),line[7:])
|
||||
if os.path.exists(matlib):
|
||||
with pyopen(matlib,"r") as matfile:
|
||||
with pythonopen(matlib,"r") as matfile:
|
||||
mname = None
|
||||
color = None
|
||||
trans = None
|
||||
@@ -34,7 +34,6 @@ import Arch
|
||||
import Draft
|
||||
import Mesh
|
||||
import Part
|
||||
from builtins import open as pyopen
|
||||
|
||||
## @package importSH3D
|
||||
# \ingroup ARCH
|
||||
@@ -44,7 +43,8 @@ from builtins import open as pyopen
|
||||
|
||||
DEBUG = True
|
||||
|
||||
|
||||
if open.__module__ in ['__builtin__','io']:
|
||||
pyopen = open # because we'll redefine open below
|
||||
|
||||
|
||||
def open(filename):
|
||||
@@ -22,10 +22,10 @@
|
||||
|
||||
import os
|
||||
import FreeCAD
|
||||
from builtins import open as pyopen
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
|
||||
if open.__module__ in ['__builtin__','io']:
|
||||
pythonopen = open
|
||||
|
||||
def open(filename):
|
||||
|
||||
@@ -142,7 +142,7 @@ def checkShapeFileLibrary():
|
||||
return False
|
||||
b = u.read()
|
||||
fp = os.path.join(FreeCAD.getUserMacroDir(True),"shapefile.py")
|
||||
f = pyopen(fp,"wb")
|
||||
f = pythonopen(fp,"wb")
|
||||
f.write(b)
|
||||
f.close()
|
||||
try:
|
||||
@@ -44,7 +44,6 @@ import Part
|
||||
import OfflineRenderingUtils
|
||||
import json
|
||||
import textwrap
|
||||
from builtins import open as pyopen
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
@@ -53,7 +52,7 @@ else:
|
||||
FreeCADGui = None
|
||||
def translate(ctxt, txt): return txt
|
||||
|
||||
|
||||
if open.__module__ in ['__builtin__','io']: pythonopen = open
|
||||
|
||||
## @package importWebGL
|
||||
# \ingroup ARCH
|
||||
@@ -869,7 +868,7 @@ def export( exportList, filename, colors = None, camera = None ):
|
||||
|
||||
html = html.replace('$data', json.dumps(data, separators=(',', ':')) ) # Shape Data
|
||||
|
||||
outfile = pyopen(filename, "w")
|
||||
outfile = pythonopen(filename, "w")
|
||||
outfile.write( html )
|
||||
outfile.close()
|
||||
FreeCAD.Console.PrintMessage( translate("Arch", "Successfully written") + ' ' + filename + "\n" )
|
||||
Reference in New Issue
Block a user