Arch: Minor bugfixes, better doctrings and fixed transparency in OBJ exporter
This commit is contained in:
@@ -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"] = "{}"
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user