Skip to content

Commit

Permalink
Arch: Fixed DAE export - fixes #2219
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Aug 28, 2015
1 parent daa024c commit f70d5be
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/Mod/Arch/importDAE.py
Expand Up @@ -111,7 +111,7 @@ def read(filename):
obj = FreeCAD.ActiveDocument.addObject("Mesh::Feature","Mesh")
obj.Mesh = newmesh

def export(exportList,filename):
def export(exportList,filename,tessellation=1):
"called when freecad exports a file"
if not checkCollada(): return
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
Expand All @@ -128,24 +128,14 @@ def export(exportList,filename):
vindex = []
nindex = []
findex = []
m = None
if obj.isDerivedFrom("Part::Feature"):
print "exporting object ",obj.Name, obj.Shape
m = obj.Shape.tessellate(1)
# vertex indices
for v in m[0]:
vindex.extend([v.x*scale,v.y*scale,v.z*scale])
# normals
for f in obj.Shape.Faces:
n = f.normalAt(0,0)
for i in range(len(f.tessellate(1)[1])):
nindex.extend([n.x,n.y,n.z])
# face indices
for i in range(len(m[1])):
f = m[1][i]
findex.extend([f[0],i,f[1],i,f[2],i])
m = Mesh.Mesh(obj.Shape.tessellate(tessellation))
elif obj.isDerivedFrom("Mesh::Feature"):
print "exporting object ",obj.Name, obj.Mesh
m = obj.Mesh
if m:
# vertex indices
for v in m.Topology[0]:
vindex.extend([v.x*scale,v.y*scale,v.z*scale])
Expand Down

0 comments on commit f70d5be

Please sign in to comment.