The IFC module
The IFC module's IFCExport() function provides a parametric equivalent to exporting an IFC2x3 model using Export Model . A Export Model software license is required for the IFCExport() function to Run properly in a parametric.
Here's an example of a script :
# creates calcs for all the members in job,
from version import CurrentVersion, VersionCompare
from member import *
mems = MultiMemberLocate("Locate members to export to IFC")
class DialogObject:
file_name = "IFC_Test.ifc"
obj = DialogObject()
if os.path.isdir( obj.path) == False:
m_nums = []
for m in mems:
|
To get help on the IFC module, you can use the SDS2 Python Prompt and the built-in Python functions dir() and help() :
SDS2 Python Prompt |
>>> import IFC # import the module
IFCExport(...)
|
I FCExport( boost::python::list , std::string , std::string , bool , bool , bool , bool , bool , std::string , Point3D , double )
boost::python::list ( 1st argument ) in the C++ signature takes a list of member numbers. In the example , this list is given the variable name m_nums and is generated using the following lines of code:
# creates a list of member numbers for user-located members
mems = MultiMemberLocate("Locate members to export to IFC")
IFCExport( m_nums , obj.file_name, obj.path, obj.holes, obj.bolts, obj.welds,
|
std::string ( 2nd argument ) is obj.file_name in the example. std::string ( 3nd argument ) is obj.path in the example . Both arguments take a string as their value. The user selects the file path and enters a file name in the dialog.
# code snippets related to creating a file name an file path
class DialogObject:
obj = DialogObject()
if os.path.isdir( obj.path ) == False: # if the directory does not exist
IFCExport( m_nums, obj .file_name , obj.path , obj.holes, obj.bolts, obj.welds,
|
bool ( 4th argument ), bool ( 5th argument ), bool ( 6th argument ) correspond to obj.holes , obj.bolts , obj.weld in the example . All three arguments take True or False as their values. The user can choose, on the dialog, whether or not to show holes and/or bolts and/or welds in the IFC file that is output. Checked ( ) on the dialog corresponds to True. Not checked ( ) corresponds to False. The parametrically generated dialog mimics the functionality of the " Export holes " " Export bolts " and " Export welds " options on the IFC Properties window for Export Model. The example uses the following code:
# code snippets for letting user set, on a dialog, items to include
class DialogObject:
obj = DialogObject()
|
bool ( 7th argument ) takes True or False as its value. Functionally, True is equivalent to checking the box for " Export Revit-compatible IFC files " on the IFC Properties window. The example shown near the top of this page sets this argument to False.
# code snippet that Revit compatibility to False
IFCExport( m_nums, obj.file_name, obj.path, obj.holes, obj.bolts, obj.welds,
False , False, "", Point3D(0.,0.,0.), 0.0 )bool ( 8th argument ) takes True or False as its value. Functionally, True is equivalent to checking the box for " Export task scheduling info " on the IFC Properties window. The example shown near the top of this page sets this argument to False.
# code snippet that sets the export of task scheduling info to False
IFCExport( m_nums, obj.file_name, obj.path, obj.holes, obj.bolts, obj.welds,
False, False , "", Point3D(0.,0.,0.), 0.0 )std::string ( 9th argument ) takes a string as its value. The string is the XML file name that is generated when the 8th argument (Export task scheduling info) is True. The example shown near the top of this page sets this argument to an empty string ("") since the 8th argument (in that example) is False.
# code snippet that sets the XML file name to an empty string
IFCExport( m_nums, obj.file_name, obj.path, obj.holes, obj.bolts, obj.welds,
False, False, "" , Point3D(0.,0.,0.), 0.0 )Point3D ( 10th argument ) corresponds to Point3D(0.,0.,0.) in the example and is the global coordinate of the origin point in the IFC file. Point3D is a parametric module. This equates to the functionality of the " Origin translation " settings on the IFC Properties window for Export Model. The example uses the following code to define this point:
# code snippet for defining the IFC file's origin point
IFCExport( m_nums, obj.file_name, obj.path, obj.holes, obj.bolts, obj.welds,
|
double ( 11th argument ) corresponds to 0.0 in the example and is the number of degrees of rotation that you want applied to the IFC model. This value equates to the functionality of the value that is entered to the " Rotate CCW around Z axis " entry field on the IFC Properties window for Export Model. The example uses the following code to define this point:
# code snippet that specifies 0.0 degrees of rotation
IFCExport( m_nums, obj.file_name, obj.path, obj.holes, obj.bolts, obj.welds,
False, False, "", Point3D(0.,0.,0.), 0.0 )