Arch: Fixed in IFC import
This commit is contained in:
parent
61919e89ab
commit
97663851ec
|
@ -602,8 +602,8 @@ def addFixture(fixture,baseobject):
|
|||
else:
|
||||
FreeCAD.Console.PrintMessage(translate("Arch","This object has no support for fixtures"))
|
||||
|
||||
def getTuples(data,scale=1,placement=None):
|
||||
"""getTuples(data,[scale,placement]): returns a tuple or a list of tuples from a vector
|
||||
def getTuples(data,scale=1,placement=None,normal=None):
|
||||
"""getTuples(data,[scale,placement,normal]): returns a tuple or a list of tuples from a vector
|
||||
or from the vertices of a shape. Scale can indicate a scale factor"""
|
||||
import Part
|
||||
if isinstance(data,FreeCAD.Vector):
|
||||
|
@ -616,7 +616,12 @@ def getTuples(data,scale=1,placement=None):
|
|||
import Part,DraftGeomUtils
|
||||
data = Part.Wire(DraftGeomUtils.sortEdges(data.Wires[0].Edges))
|
||||
verts = data.Vertexes
|
||||
#verts.reverse()
|
||||
try:
|
||||
if DraftVecUtils.angle(verts[1].Point,verts[0].Point,normal) >= 0:
|
||||
# inverting verts order if the direction is couterclockwise
|
||||
verts.reverse()
|
||||
except:
|
||||
pass
|
||||
for v in verts:
|
||||
pt = v.Point
|
||||
if placement:
|
||||
|
@ -662,7 +667,8 @@ def getBrepFacesData(obj,scale=1):
|
|||
for face in obj.Shape.Faces:
|
||||
f = []
|
||||
for wire in face.Wires:
|
||||
f.append(getTuples(wire,scale))
|
||||
t = getTuples(wire,scale,normal=face.normalAt(0,0))
|
||||
f.append(t)
|
||||
s.append(f)
|
||||
sols.append(s)
|
||||
return sols
|
||||
|
|
|
@ -927,24 +927,33 @@ def export(exportList,filename):
|
|||
|
||||
# process objects
|
||||
for obj in objectslist:
|
||||
if DEBUG: print "adding ",obj.Label
|
||||
otype = Draft.getType(obj)
|
||||
name = str(obj.Label)
|
||||
parent = Arch.getHost(obj)
|
||||
gdata = None
|
||||
|
||||
if otype in ["Group"]:
|
||||
# unsupported objects. TODO: support
|
||||
continue
|
||||
|
||||
if DEBUG: print "adding ",obj.Label
|
||||
|
||||
if not forcebrep:
|
||||
gdata = Arch.getExtrusionData(obj,scaling)
|
||||
if DEBUG: print "extrusion data for ",obj.Label," : ",gdata
|
||||
#if DEBUG: print "extrusion data for ",obj.Label," : ",gdata
|
||||
if not gdata:
|
||||
fdata = Arch.getBrepFacesData(obj,scaling)
|
||||
if DEBUG: print "brep data for ",obj.Label," : ",fdata
|
||||
#if DEBUG: print "brep data for ",obj.Label," : ",fdata
|
||||
if DEBUG: print " Brep"
|
||||
if not fdata:
|
||||
if obj.isDerivedFrom("Part::Feature"):
|
||||
print "IFC export: error retrieving the shape of object ", obj.Name
|
||||
continue
|
||||
else:
|
||||
if DEBUG: print " Extrusion"
|
||||
|
||||
spacer = ""
|
||||
for i in range(30-len(obj.Name)):
|
||||
for i in range(36-len(obj.Label)):
|
||||
spacer += " "
|
||||
if otype in ["Structure","Window"]:
|
||||
if hasattr(obj,"Role"):
|
||||
|
@ -953,7 +962,7 @@ def export(exportList,filename):
|
|||
tp = otype
|
||||
else:
|
||||
tp = otype
|
||||
txt.append(obj.Name + spacer + tp)
|
||||
txt.append(obj.Label + spacer + tp)
|
||||
|
||||
if otype == "Building":
|
||||
ifc.addBuilding( name=name )
|
||||
|
|
Loading…
Reference in New Issue
Block a user