diff --git a/src/Mod/Arch/importIFC.py b/src/Mod/Arch/importIFC.py index 316885093..3169c8154 100644 --- a/src/Mod/Arch/importIFC.py +++ b/src/Mod/Arch/importIFC.py @@ -51,7 +51,7 @@ typesmap = { "Site": ["IfcSite"], structuralifcobjects = ( "IfcStructuralCurveMember", "IfcStructuralSurfaceMember", "IfcStructuralPointConnection", "IfcStructuralCurveConnection", "IfcStructuralSurfaceConnection", - "IfcStructuralAction", "IfcStructuralPointAction", + "IfcStructuralAction", "IfcStructuralPointAction", "IfcStructuralLinearAction", "IfcStructuralLinearActionVarying", "IfcStructuralPlanarAction" ) @@ -126,11 +126,11 @@ def getPreferences(): global ROOT_ELEMENT, GET_EXTRUSIONS, MERGE_MATERIALS global MERGE_MODE_ARCH, MERGE_MODE_STRUCT, CREATE_CLONES global FORCE_BREP, IMPORT_PROPERTIES, STORE_UID, SERIALIZE - p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch") + p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch") if FreeCAD.GuiUp and p.GetBool("ifcShowDialog",False): import FreeCADGui FreeCADGui.showPreferences("Import-Export",0) - DEBUG = p.GetBool("ifcDebug",False) + DEBUG = p.GetBool("ifcDebug",False) PREFIX_NUMBERS = p.GetBool("ifcPrefixNumbers",False) SKIP = p.GetString("ifcSkip","").split(",") SEPARATE_OPENINGS = p.GetBool("ifcSeparateOpenings",False) @@ -155,7 +155,7 @@ def explore(filename=None): """explore([filename]): opens a dialog showing the contents of an IFC file. If no filename is given, a dialog will pop up to choose a file.""" - + getPreferences() try: @@ -322,9 +322,9 @@ def insert(filename,docname,skip=[],only=[],root=None): skip can contain a list of ids of objects to be skipped, only can restrict the import to certain object ids (will also get their children) and root can be used to import only the derivates of a certain element type (default = ifcProduct).""" - + getPreferences() - + try: import ifcopenshell except: @@ -339,7 +339,7 @@ def insert(filename,docname,skip=[],only=[],root=None): FreeCAD.ActiveDocument = doc if DEBUG: print "done." - + global ROOT_ELEMENT if root: ROOT_ELEMENT = root @@ -748,7 +748,7 @@ def insert(filename,docname,skip=[],only=[],root=None): if obj.isDerivedFrom("Part::Feature"): if obj.Shape.isNull(): Arch.rebuildArchShape(obj) - + # processing remaining (normal) groups for host,children in groups.items(): if ifcfile[host].is_a("IfcGroup"): @@ -935,10 +935,10 @@ def export(exportList,filename): b = Draft.getCloneBase(o,strict=True) if b: clones.setdefault(b.Name,[]).append(o.Name) - + #print "clones table: ",clones #print objectslist - + # testing if more than one site selected (forbidden in IFC) if len(Draft.getObjectsOfType(objectslist,"Site")) > 1: FreeCAD.Console.PrintError("More than one site is selected, which is forbidden by IFC standards. Please export only one site by IFC file.\n") @@ -1147,7 +1147,7 @@ def export(exportList,filename): f = products[floor.Name] if children: ifcfile.createIfcRelContainedInSpatialStructure(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'StoreyLink','',children,f) - floors.append(floor.Name) + floors.append(floor.Name) for building in Draft.getObjectsOfType(objectslist,"Building"): objs = Draft.getGroupContents(building,walls=True,addgroups=True) objs = Arch.pruneIncluded(objs) @@ -1228,7 +1228,7 @@ def export(exportList,filename): isr = ifcfile.createIfcStyledRepresentation(context,"Style","Material",[isi]) imd = ifcfile.createIfcMaterialDefinitionRepresentation(None,None,[isr],mat) ifcfile.createIfcRelAssociatesMaterial(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'MaterialLink','',relobjs,mat) - + # groups sortedgroups = [] while groups: @@ -1257,14 +1257,14 @@ def export(exportList,filename): grp = ifcfile.createIfcGroup(ifcopenshell.guid.compress(uuid.uuid1().hex),history,name,'',None) products[g[0]] = grp ass = ifcfile.createIfcRelAssignsToGroup(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'GroupLink','',children,None,grp) - + if DEBUG: print "writing ",filename,"..." filename = decode(filename) ifcfile.write(filename) - + if STORE_UID: # some properties might have been changed FreeCAD.ActiveDocument.recompute() @@ -1279,7 +1279,7 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess productdef = None shapetype = "no shape" tostore = False - + # check for clones if not subtraction: for k,v in clones.items(): @@ -1401,7 +1401,7 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess pol = ifcfile.createIfcCompositeCurve(segments,False) profile = ifcfile.createIfcArbitraryClosedProfileDef("AREA",None,pol) - + if profile and not(DraftVecUtils.isNull(extrusionv)): xvc = ifcfile.createIfcDirection(tuple(r.Rotation.multVec(FreeCAD.Vector(1,0,0)))) zvc = ifcfile.createIfcDirection(tuple(r.Rotation.multVec(FreeCAD.Vector(0,0,1)))) @@ -1439,12 +1439,12 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess else: dataset = fcshape.Shells if DEBUG: print "Warning! object contains no solids" - + # if this is a clone, place back the shapes in null position if tostore: for shape in dataset: shape.Placement = FreeCAD.Placement() - + # new ifcopenshell serializer from ifcopenshell import geom if hasattr(geom,"serialise") and obj.isDerivedFrom("Part::Feature") and SERIALIZE: @@ -1497,7 +1497,7 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess if not fcsolid: if DEBUG: print "Error: Unable to triangulate shape" fcsolid = Part.Shape() - + for fcface in fcsolid.Faces: loops = [] verts = [v.Point for v in Part.Wire(Part.__sortEdges__(fcface.OuterWire.Edges)).Vertexes] @@ -1524,7 +1524,7 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess loops.append(bound) face = ifcfile.createIfcFace(loops) faces.append(face) - + if faces: shell = ifcfile.createIfcClosedShell(faces) shape = ifcfile.createIfcFacetedBrep(shell) @@ -1626,8 +1626,8 @@ def setRepresentation(representation): e.rotate(bc.Curve.Center,FreeCAD.Vector(0,0,1),math.degrees(a)) result.append(e) return result - - + + def getRotation(entity): "returns a FreeCAD rotation from an IfcProduct with a IfcMappedItem representation" try: