Skip to content

Commit

Permalink
Arch: Minor bugfixes, better doctrings and fixed transparency in OBJ …
Browse files Browse the repository at this point in the history
…exporter
  • Loading branch information
yorikvanhavre committed Jun 15, 2019
1 parent 5ea062f commit 0620cae
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/Mod/Arch/ArchIFC.py
Expand Up @@ -45,6 +45,7 @@ def getIfcProduct(IfcType):
name = "IfcBuildingElementProxy"
if name in ArchIFCSchema.IfcProducts:
return ArchIFCSchema.IfcProducts[name]
return None

def getIfcProductAttribute(ifcProduct, name):

Expand Down Expand Up @@ -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"] = "{}"
Expand Down
5 changes: 4 additions & 1 deletion src/Mod/Arch/importDAE.py
Expand Up @@ -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")
Expand Down
4 changes: 3 additions & 1 deletion src/Mod/Arch/importIFC.py
Expand Up @@ -1466,7 +1466,9 @@ def createIfcPresentationStyleAssignment(self,name,r,g,b,t=0):

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()

Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Arch/importOBJ.py
Expand Up @@ -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):
Expand Down

0 comments on commit 0620cae

Please sign in to comment.