exportIFC Namespace Reference

IFC file format exporter. More...

Functions

def buildAddress (obj, ifcfile)
 
def checkRectangle (edges)
 
def createAxis (ifcfile, obj, preferences)
 
def createCurve (ifcfile, wire, scaling=1.0)
 
def createProduct (ifcfile, obj, ifctype, uid, history, name, description, placement, representation, preferences)
 
def export (exportList, filename, colors=None, preferences=None)
 
def exportIFC2X3Attributes (obj, kwargs, scale=0.001)
 
def exportIfcAttributes (obj, kwargs, scale=0.001)
 
def getAxisContext (ifcfile)
 
def getBrepFlag (obj, preferences)
 
def getEdgesAngle (edge1, edge2)
 
def getIfcTypeFromObj (obj)
 
def getPreferences ()
 
def getProfile (ifcfile, p)
 
def getPropertyData (key, value, preferences)
 
def getRepresentation (ifcfile, context, obj, forcebrep=False, subtraction=False, tessellation=1, colors=None, preferences=None, forceclone=False, skipshape=False)
 
def getText (field, obj)
 
def getUID (obj, preferences)
 
def isStandardCase (obj, ifctype)
 
def writeJson (filename, ifcfile)
 

Variables

string ifctemplate
 
 pyopen = open
 
dictionary translationtable
 

Detailed Description

IFC file format exporter.

This module provides tools to export IFC files.

Function Documentation

◆ buildAddress()

def exportIFC.buildAddress (   obj,
  ifcfile 
)

Referenced by createProduct().

◆ checkRectangle()

def exportIFC.checkRectangle (   edges)
 checkRectangle(edges=[]): This function checks whether the given form is a rectangle
   or not. It will return True when edges form a rectangular shape or return False
   when edges do not form a rectangular shape.

References getEdgesAngle().

Referenced by getProfile().

◆ createAxis()

def exportIFC.createAxis (   ifcfile,
  obj,
  preferences 
)
Creates an axis for a given wall, if applicable

References createCurve(), and getAxisContext().

Referenced by getRepresentation().

◆ createCurve()

def exportIFC.createCurve (   ifcfile,
  wire,
  scaling = 1.0 
)

◆ createProduct()

def exportIFC.createProduct (   ifcfile,
  obj,
  ifctype,
  uid,
  history,
  name,
  description,
  placement,
  representation,
  preferences 
)
creates a product in the given IFC file

References buildAddress(), exportIFC2X3Attributes(), and exportIfcAttributes().

Referenced by export().

◆ export()

def exportIFC.export (   exportList,
  filename,
  colors = None,
  preferences = None 
)
Export the selected objects to IFC format.

Parameters
----------
colors:
    It defaults to `None`.
    It 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.

References exportIFCStructuralTools.associates(), createCurve(), createProduct(), exportIFCStructuralTools.createStructuralGroup(), exportIFCStructuralTools.createStructuralMember(), getBrepFlag(), getIfcTypeFromObj(), exportIFCHelper.getObjectsOfIfcType(), getPreferences(), getPropertyData(), getRepresentation(), getText(), getUID(), isStandardCase(), pyopen, exportIFCStructuralTools.setup(), writeJson(), and exportIFCHelper.writeUnits().

Referenced by importIFC.export().

◆ exportIFC2X3Attributes()

def exportIFC.exportIFC2X3Attributes (   obj,
  kwargs,
  scale = 0.001 
)

References getIfcTypeFromObj().

Referenced by createProduct().

◆ exportIfcAttributes()

def exportIFC.exportIfcAttributes (   obj,
  kwargs,
  scale = 0.001 
)

References getIfcTypeFromObj().

Referenced by createProduct().

◆ getAxisContext()

def exportIFC.getAxisContext (   ifcfile)
gets or creates an axis context

Referenced by createAxis().

◆ getBrepFlag()

def exportIFC.getBrepFlag (   obj,
  preferences 
)
returns True if the object must be exported as BREP

Referenced by export().

◆ getEdgesAngle()

def exportIFC.getEdgesAngle (   edge1,
  edge2 
)
 getEdgesAngle(edge1, edge2): returns a angle between two edges.

References draftgeoutils.general.vec().

Referenced by checkRectangle().

◆ getIfcTypeFromObj()

def exportIFC.getIfcTypeFromObj (   obj)

◆ getPreferences()

def exportIFC.getPreferences ( )
Retrieve the IFC preferences available in import and export.

Referenced by export().

◆ getProfile()

def exportIFC.getProfile (   ifcfile,
  p 
)
returns an IFC profile definition from a shape

References checkRectangle(), createCurve(), and draftgeoutils.general.vec().

Referenced by getRepresentation().

◆ getPropertyData()

def exportIFC.getPropertyData (   key,
  value,
  preferences 
)

Referenced by export().

◆ getRepresentation()

def exportIFC.getRepresentation (   ifcfile,
  context,
  obj,
  forcebrep = False,
  subtraction = False,
  tessellation = 1,
  colors = None,
  preferences = None,
  forceclone = False,
  skipshape = False 
)
returns an IfcShapeRepresentation object or None. forceclone can be False (does nothing),
"store" or True (stores the object as clone base) or a Vector (creates a clone)

References DraftVecUtils.angle(), createAxis(), createCurve(), getProfile(), DraftVecUtils.isNull(), DraftVecUtils.neg(), ArchComponent.Component.rebase(), and importDAE.triangulate().

Referenced by export().

◆ getText()

def exportIFC.getText (   field,
  obj 
)
Returns the value of a text property of an object

Referenced by export().

◆ getUID()

def exportIFC.getUID (   obj,
  preferences 
)
gets or creates an UUID for an object

Referenced by export().

◆ isStandardCase()

def exportIFC.isStandardCase (   obj,
  ifctype 
)

Referenced by export().

◆ writeJson()

def exportIFC.writeJson (   filename,
  ifcfile 
)
writes an .ifcjson file

References pyopen.

Referenced by export().

Variable Documentation

◆ ifctemplate

string exportIFC.ifctemplate
Initial value:
1= """ISO-10303-21;
2HEADER;
3FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1');
4FILE_NAME('$filename','$timestamp',('$owner','$email'),('$company'),'IfcOpenShell','IfcOpenShell','');
5FILE_SCHEMA(('$ifcschema'));
6ENDSEC;
7DATA;
8#1=IFCPERSON($,$,'$owner',$,$,$,$,$);
9#2=IFCORGANIZATION($,'$company',$,$,$);
10#3=IFCPERSONANDORGANIZATION(#1,#2,$);
11#4=IFCAPPLICATION(#2,'$version','FreeCAD','118df2cf_ed21_438e_a41');
12#5=IFCOWNERHISTORY(#3,#4,$,.ADDED.,$now,#3,#4,$now);
13#6=IFCDIRECTION((1.,0.,0.));
14#7=IFCDIRECTION((0.,0.,1.));
15#8=IFCCARTESIANPOINT((0.,0.,0.));
16#9=IFCAXIS2PLACEMENT3D(#8,#7,#6);
17#10=IFCDIRECTION((0.,1.,0.));
18#12=IFCDIMENSIONALEXPONENTS(0,0,0,0,0,0,0);
19#13=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.);
20#14=IFCSIUNIT(*,.AREAUNIT.,$,.SQUARE_METRE.);
21#15=IFCSIUNIT(*,.VOLUMEUNIT.,$,.CUBIC_METRE.);
22#16=IFCSIUNIT(*,.PLANEANGLEUNIT.,$,.RADIAN.);
23#17=IFCMEASUREWITHUNIT(IFCPLANEANGLEMEASURE(0.017453292519943295),#16);
24#18=IFCCONVERSIONBASEDUNIT(#12,.PLANEANGLEUNIT.,'DEGREE',#17);
25ENDSEC;
26END-ISO-10303-21;
27"""

◆ pyopen

exportIFC.pyopen = open

Referenced by export(), and writeJson().

◆ translationtable

dictionary exportIFC.translationtable
Initial value:
1= {
2 "Foundation": "Footing",
3 "Floor": "BuildingStorey",
4 "Rebar": "ReinforcingBar",
5 "HydroEquipment": "SanitaryTerminal",
6 "ElectricEquipment": "ElectricAppliance",
7 "Furniture": "FurnishingElement",
8 "Stair Flight": "StairFlight",
9 "Curtain Wall": "CurtainWall",
10 "Pipe Segment": "PipeSegment",
11 "Pipe Fitting": "PipeFitting",
12 "VisGroup": "Group",
13 "Undefined": "BuildingElementProxy",
14}