Arch: Minor bugfixes, better doctrings and fixed transparency in OBJ exporter

This commit is contained in:
Yorik van Havre
2019-06-15 16:53:43 -03:00
parent 5ea062f669
commit 0620caea33
4 changed files with 11 additions and 3 deletions

View File

@@ -45,6 +45,7 @@ def getIfcProduct(IfcType):
name = "IfcBuildingElementProxy"
if name in ArchIFCSchema.IfcProducts:
return ArchIFCSchema.IfcProducts[name]
return None
def getIfcProductAttribute(ifcProduct, name):
@@ -81,6 +82,8 @@ def addIfcProductAttribute(obj, attribute):
"Adds a given attribute property"
if not hasattr(obj,"IfcData"):
return
IfcData = obj.IfcData
if "attributes" not in IfcData:
IfcData["attributes"] = "{}"

View File

@@ -189,7 +189,10 @@ def read(filename):
def export(exportList,filename,tessellation=1,colors=None):
"called when freecad exports a file"
"""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")

View File

@@ -1466,7 +1466,9 @@ class recycler:
def export(exportList,filename,colors=None):
"exports FreeCAD contents to an IFC file"
"""export(exportList,filename,colors=None) -- exports FreeCAD contents to an IFC 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."""
getPreferences()

View File

@@ -220,7 +220,7 @@ def export(exportList,filename,colors=None):
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")
kinds = {"AmbientColor":"Ka ","DiffuseColor":"Kd ","SpecularColor":"Ks ","EmissiveColor":"Ke ","Transparency":"d "}
kinds = {"AmbientColor":"Ka ","DiffuseColor":"Kd ","SpecularColor":"Ks ","EmissiveColor":"Ke ","Transparency":"Tr "}
done = [] # store names to avoid duplicates
for mat in materials:
if isinstance(mat,tuple):