The IFC Exporter PML Object
- Last UpdatedMay 23, 2023
- 7 minute read
Defines the API for the PML object that can perform the export. It is recommended to use this object as mode data validation is undertaken. The main API methods and attributes are described. There are other internal functions.
|
NAME |
RESULT |
ACTION |
|---|---|---|
|
clearExportItems() |
NO RESULT |
Empty export list. |
|
export() |
STRING |
Export data and return a result string. |
|
getAttrLevel() |
STRING |
Get the attribute detail level. Value can be one of: || => No attribute. |A| => Set attributes only. |L| => All attributes, UDAs and DDSE data. |
|
getComponentLevel() |
BOOLEAN |
Get whether separate IFC entities should be created for each Nozzle/Piping Component and so on. |
|
getDataLevel() |
STRING |
Get export data detail level. For details of valid arguments, refer to setDataLevel(STRING) in this table. |
|
getDestination() |
STRING |
Get the path name of the destination file. |
|
getExportItems() |
ARRAY |
Get array of Database (DB) reference of elements to be exported. |
|
getExportStatus() |
STRING |
Get status of export operation. |
|
getGeomLevel() |
STRING |
Get the geometry detail level. Value can be one of: || => No geometry. |F| => Faceted geometry only. |G| => Geometry only. |
|
getInsu() |
REAL |
Get insulation translucency % value. |
|
getLevel(STRING) |
REAL |
Get the drawing level for the stated option. Valid options are: |PIPE| |NOZZ| |STRU| |CABLE| |
|
getLogDetail() |
REAL |
Get level of logging detail. |
|
getLogDetailText() |
STRING |
Get text description of logging detail. The value can be: |BRIEF| |FULL| |
|
getLogFile() |
STRING |
Get full path name of log file. |
|
getObst() |
REAL |
Get obstruction translucency % value. |
|
getOverwriteFlag() |
BOOLEAN |
Get destination file overwrite flag (true/false). |
|
getRefDatum() |
DBREF |
Get DB Reference Number of selected Reference Datum. |
|
getRefDatumOtion() |
BOOLEAN |
Get flag indicating use of Reference Datum (true/false). |
|
getRepre(STRING) |
BOOLEAN |
Get the representation Boolean flag setting for the stated option. Valid options are: |CLINE| |TUBE| |AUTOCOL| |HOLES| |
|
getResult() |
STRING |
Get result of export operation. |
|
getTolerance() |
REAL |
Get value of tolerance setting. |
|
getUserPostProcessor() |
STRING |
Get the User editable post-processor file name. |
|
getUserPreProcessor() |
STRING |
Get the User editable pre-processor file name. |
|
getVersion() |
STRING |
Get IFC schema version string. |
|
ifcexporterobj() |
NO RESULT |
Constructor. |
|
load(STRING) |
BOOLEAN |
Loads settings file. |
|
save(STRING) |
BOOLEAN |
Save to settings file. |
|
setComponentLevel(BOOLEAN) |
NO RESULT |
Set whether separate IFC entities should be created for each Nozzle/Piping Component and so on. |
|
setDataLevel(STRING) |
NO RESULT |
Set export data detail level. Value can be one of: |A| => Set attributes only. |F| => Faceted geometry only. |FA| => Faceted geometry and only set attributes. |FL| => Faceted geometry and all attributes, UDAs and DDSE data. |G| => Geometry only. |GA| => Geometry and only set attributes. |GL| => Geometry and all attributes, UDAs and DDSE data. |L| => All attributes, UDAs and DDSE data. |
|
setDbSource(DBREF) |
NO RESULT |
Add a DB element to export list. |
|
setDestination(STRING) |
NO RESULT |
Set path name of the destination file. |
|
setInsu(REAL) |
NO RESULT |
Set insulation translucency % value (0-99). |
|
setLevel(STRING,REAL) |
NO RESULT |
Set drawing level for element representation. First argument is one of: |CABLE| |NOZZ| |PIPE| |REST| |STRU| Second argument is an integer. |
|
setLogDetail(REAL) |
NO RESULT |
Set level of detail to be logged:
|
|
setLogFile(STRING) |
NO RESULT |
Set full path name of log file. |
|
setObst(REAL) |
NO RESULT |
Set obstruction translucency % value (0-99). |
|
setOverwriteFlag(BOOLEAN) |
NO RESULT |
Set flag to overwrite the destination file (true/false). |
|
setRefDatum(DBREF) |
NO RESULT |
Set the Reference Datum by DB Reference Number. |
|
setRefDatumByName(STRING) |
NO RESULT |
Set the Reference Datum by displayed name. For further information, refer to setRefDatumByName. |
|
setRefDatumOption(BOOLEAN) |
NO RESULT |
Set flag indicating use of Reference Datum (true/false). |
|
setRepre(STRING,BOOLEAN) |
NO RESULT |
Set the representation Boolean flag setting for the stated option. Valid options are: |CLINE| |TUBE| |AUTOCOL| |HOLES| |
|
setTolerance(REAL) |
NO RESULT |
Set facet tolerance value. Must be within the range of 0.1-20 mm (0.004-0.787 in). |
|
setUserPostProcessor() |
STRING |
Set the User editable post-processor function name. |
|
setUserPreProcessor() |
STRING |
Set the User editable pre-processor function name. |
|
setVersion(STRING) |
NO RESULT |
Set IFC version setting, must be one of the following: |IFC2x3| |IFC4| |
|
userPostProcess(STRING) |
NO RESULT |
Call User modifiable post-process function. Argument is name of external user created function. For example: |MyPostProcess| |
|
userPreProcess(STRING) |
NO RESULT |
Call User modifiable pre-process function. Argument is name of external user created function. For example: |MyPreProcess| |
The member data for the object are:
|
NAME |
RESULT |
STATUS |
ACTION |
|---|---|---|---|
|
dataLevel |
STRING |
SETTABLE |
Level of detail output: |A| => Set attributes only. |F| => Faceted geometry only. |FA| => Faceted geometry and only set attributes. |FL| => Faceted geometry and all attributes, UDAs and DDSE data. |G| => Geometry only. |GA| => Geometry and only set attributes. |GL| => Geometry and all attributes, UDAs and DDSE data. |L| => All attributes, UDAs and DDSE data. |
|
dbSources |
ARRAY |
SETTABLE |
Array of DB references of elements to export. |
|
holeSetting |
STRING |
SETTABLE |
String description of how holes are to be managed. Value can be one of: |On| |Off| |
|
insu |
REAL |
SETTABLE |
% translucency setting for insulation in range 0% to 100%. |
|
levels |
ARRAY |
SETTABLE |
Array of drawing level settings. For example: |CABLE| => 6 |NOZZ| => 6 |PIPE| => 6 |REST| => 6 |STRU| => 6 |
|
logDetail |
REAL |
SETTABLE |
Level of detail to be logged:
|
|
logFile |
STRING |
SETTABLE |
Path name of log file. |
|
obst |
REAL |
SETTABLE |
% translucency setting for Obstruction in range 0% to 100%. |
|
overWriteFlag |
BOOLEAN |
SETTABLE |
Flag if destination IFC file is to be overwritten. |
|
refDatum |
DBREF |
SETTABLE |
Reference Number of Reference Datum. |
|
repres |
ARRAY |
SETTABLE |
Array of representation Boolean flags. For example: |AUTOCOL| => true |CLINE| => false |HOLES| => true |TUBE| => true |
|
target |
STRING |
SETTABLE |
Path name of destination IFC file. |
|
tolerance |
REAL |
SETTABLE |
Facet tolerance value (mm). |
|
useRefDatum |
BOOLEAN |
SETTABLE |
Flag to signal if Reference Datum is to be used. |
|
version |
STRING |
SETTABLE |
IFC schema version string. Must be one of: |IFC2x3| |IFC4| |
|
exportStatus |
STRING |
GETTABLE |
String overall result of export operation. |
|
result |
STRING |
GETTABLE |
String result of export operation. Value could include one of: |Bad form data| |Could not execute the Export command| |Failure| |Partial failure| |Success| |
Attribute dbSource is an internally structured list for managing the list of exported elements. The first item in the list is used for display purposes. To get the proper list of exported elements, use getExportItems instead, which takes the elements from the second position.
Example Use of IfcExporterObj
The example indicates how the IfcExporterObj PML object can be used.
----------------------------------
-- Create exporter object
----------------------------------
!exporter = object IFCEXPORTEROBJ( )
------------------------------
-- Configure the object
------------------------------
-- Object to export
!ref = =2013286708/2
-- Step 1 - What to export
!exporter.setRefDatumByName(|IFCGLOBAL|)
!exporter.setRefDatumOption(true)
!exporter.setDbSource(!ref)
-- Step 2 - Where to export
!exporter.setDestination(|E:\STEP\Test\TestOutput.ifc|)
!exporter.setOverwriteFlag(true)
-- Step 3 - How to export
!exporter.setVersion(|IFC2x3|)
!exporter.setTolerance(10mm)
!exporter.setInsu(50)
!exporter.setObst(50)
!exporter.setLevel(|CABLE|,6)
!exporter.setLevel(|NOZZ|,6)
!exporter.setLevel(|PIPE|,6)
!exporter.setLevel(|REST|,6)
!exporter.setLevel(|STRU|,6)
!exporter.setRepre(|CLINE|,false)
!exporter.setRepre(|TUBE|,true)
!exporter.setRepre(|AUTOCOL|,true)
!exporter.setRepre(|HOLES|,true)
!exporter.setComponentLevel(true)
!exporter.setDataLevel(|GA|)
-- Step 4 - Logging
!exporter.setLogDetail(2)
!exporter.setLogFile(|E:\STEP\Test\TestOutput.log| )
------------
-- Export
------------
-- Process before export
!exporter.userPreProcess(|userPreExpProcess|)
-- Export
!result = !exporter.export()
-- Process after export
!exporter.userPostProcess(|userPostExpProcess|)
--------------
-- Wrap up
--------------
-- Output result
!!alert.message( !exporter.getExportStatus( ))
Export Pre- and Post-Processing Functions
There is scope to define additional operations before and after exporting a model. These are pre- and post-processing functions that might operate on the model before or after it has been exported. User defined pre- and post-processing functions can be called during the data transfer process.
Template functions called userPreExpProcess.pmlfnc and userPostExpProcess.pmlfnc are supplied. The supplied default templates are called automatically from the graphical user interface post-process function. If the PML exporter object is used, it is possible to provide the same additional functionality as required but they must be called manually when using the exporter object.
Note:
The templates do not do anything, but it is possible to use them as a framework for
your own requirements.
These can be invoked using the commands:
!exporter.userPreProcess()
!exporter.userPostProcess()
Alternatively, you may provide your own functions and inject them into the export process. This is achieved by providing a function or even a series of similar functions, <userFunction>.pmlfnc, for example, IFCPostProcessing.pmlfnc, in the PML search path and then plugging it or them into the system using the command line. These functions take one argument and must handle all PML errors internally. The functions return a string result value containing whatever message is to be transmitted to the running PML application. The template PML functions provide an example of how to structure the function.
These can be defined in the exporter object as below, but there are defaults of:
-
UserPreProcessor = |userPreExpProcess|
-
UserPostProcessor = |userPostExpProcess|
For example:
!exporter = object IFCEXPORTEROBJ( )
!exporter.setUserPreProcessor( |IFCPreProcessing| )
The string values are used to construct a function name, for example, userPreExpProcess.pmlfnc, which the System will attempt to invoke. The export process will not fail if these functions are not found. They are normal PML functions that must be available in the PML search path. A PML REHASH ALL command might be necessary to refresh the PML index files. All error handling must be contained in the files themselves.
When using the PML exporter object directly, there are API functions on the exporter object to set and get these values.
-
define method .setUserPreProcessor( !userPreProcessor is STRING )
-
define method .getUserPreProcessor( ) is STRING
-
define method .setUserPostProcessor( !userPostProcessor is STRING )
-
define method .getUserPostProcessor( ) is STRING
For example:
!exporter = object IFCEXPORTEROBJ( )
!exporter.setUserPreProcessor( |IFCPreProcessing| )
!exporter.userPreProcess()
!exporter.export()
!exporter.setUserPostProcessor( |IFCPostProcessing| )
!exporter.userPostProcess()
Please note that a parameter has been added to pre- or post-processing User function signatures to give User access to the exporter object itself. Note also that the User definable functions must have a signature similar to the ones below, with the single parameter to the exporter object. With the exporter object, all the API functions become available within the pre- or post-processing functions.
-
define function !!userPostExpProcess( !exporter is IFCEXPORTEROBJ ) is STRING
-
define function !!userPostExpProcess( !exporter is IFCEXPORTEROBJ ) is STRING
Pre-Processing Function
The example finds the elements that need their GUIDs to be set (UUIDIA), instead of just writing out the command message, the actual command syntax can be used to set the attribute.
define function !!IFCPreProcessing( !exporter is IFCEXPORTEROBJ ) is STRING
-- Start
!start = !!ce
-- loop through all elements to export
!items = !!ifcExportForm.exporter.getExportItems()
handle any
!!ce = !start
return |Failure|
endhandle
do !item values !items
-- collect all items to have their GUIDs set
var !unsetGUIDs coll all with ( unset( UUIDIA ) ) for $!item
do !unsetGUID values !unsetGUIDs
!!ce = !unsetGUID.dbref()
!name = name
!message = |Unset GUID on | & !name
write( !message )
write( |UUIDENTIFIER SET| )
enddo
enddo
-- Finished
!!ce = !start
return |Success|
endfunction
setRefDatumByName
The function call is to use the correct Reference Datum for applying transformations to the imported model. Internally, in the Application Data World, the elements have a special suffix of HDR which is not displayed.
!exporter.setRefDatumByName(|IFCREVIT|)
The command tells the importer to use the Reference Datum /IFCREVIT-HDR as the transformation data.
To use another zone that is outside the Application Data World and not controlled by this User Interface, then set the Reference Datum using the DB Reference Number. For example:
!exporter.setRefDatum(!refZone.DBREF())