Collaboration with other software
About model and data exchange with 3rd party solutions: Revit, Solibri, dRofus, Bluebeam, structural analysis solutions, and IFC, BCF and DXF/DWG-based exchange, etc.

Cleaning up cross section display of IFC imported objects

Paul King
Mentor
I recently did some troubleshooting & discovered why IFC files from Engineers look so bad in cross section, and so figured out a workaround for anyone who needs it:

The problem

IFC Files brought in to ArchiCAD by the IFC translator file often generate objects formed from many co-planar polygons. Hundreds of meaningless & unwanted diagonal lines then display in cross section views, making them all but useless for production drawings.

I found the problem is caused by the way the object GDL 3D script is being auto coded during import.
There is already a parameter in most (but not all) auto created objects that allows user to switch off display of the extraneous polygons - but only for the 3D window. Not hard to extend this 'contours only' display mode functionality to cross sections as well if you are happy tinkering with the GDL, but manually opening, editing GDL scripts, then resaving hundreds or even thousands of library objects every time an Engineer sends you an updated IFC file is not feasible.


Here is how to fix them en masse: (this is a far faster workaround than anything else I have yet found, avoids the need to convert everything to morphs … and is much easier than it sounds!)

Prerequisite – ensure you have download & installed ‘Useful File Utilities’ http://www.replsoft.com/ufusetup.exe and the ‘Batch Replacer’ plugin for this software http://www.replsoft.com/batchreplacer.zip
(or could use any other text editor that can do batched file search & replace operations)

** EDIT just found NotePad+ is actually better & more reliable with search & replace http://portableapps.com/apps/development/notepadpp_portable **

Note: the Useful File Utilities software can only be used 15 times for free before it requires purchase.

1. From ArchiCAD , Import your IFC file(s) into a new empty ArchiCAD file

2. Go to library manager, and save all the embedded objects created to an external folder


Now we need to convert these objects into XML text file format.

3. Open a command line window (e.g. from Windows start , click the ‘run’ icon and type ‘cmd’) Note :Ensure you run CMD window as an administrator

4. Paste in the following command:

"C:\Program Files\GRAPHISOFT\ArchiCAD 17"\LP_XMLConverter l2x "[source]" "[destination]"

Where [source] = full path to the library folder you just made, [destination]=full path to a preferred destination folder - these can be the same.
Note: you need to include the quote marks for all paths with spaces.
Note: probably best to paste these paths in too – just cut the path text required from your windows explorer address bar.


5. Hit enter - This should initiate the translation. If not, you probably made a typo (or a paste-o).


Now we need to replace the offending 3D script text in each xml file.

6. Open ‘Useful File Utilities’.

7. Browse to and select the [destination] folder.

8. Click Operations/Send to basket – this will find all the XML files in all the subfolders in that directory and make them available for the replacement operation.

9. Click Plug-ins/Batch Replacer.

10. Use the “Load from File” button to load the attached file (which I prepared earlier) – this will set these up all the requred ‘search and replace’ settings for you

11. Click the ‘Start Replace’ button.

12. XML files should all be modified automatically.


Now we need to covert these files back into ordinary library objects

13. Go back to the Comand Line window.

14. Past in the following command:

"C:\Program Files\GRAPHISOFT\ArchiCAD 17"\LP_XMLConverter x2l "[source]" "[destination]"

Where [source] = full path to the XML folder you just converted, [destination]=full path to the original archicad library folder. Note: probably best to paste these paths in too – just cut path text from windows explorer address bar as before.

15. Hit enter - This should initiate the translation and overwrite the original IFC objects. If not, again you probably made a typo.

16. Now, from your archiCAD file, open library manager again

17. Add the folder of updated objects to loaded libraries, and delete the embedded library equivalents. Reload Libraries


You should now be up & running, now with the ability to just switch off unwanted polygons displaying in sections.


Notes:

• If you do this with a test ArchiCAD file – and confirm it works, you can then just replace the library objects in a real working file with the ones you just created.
• For minor IFC updates similarly you may not need to repeat the whole process – can again just replace the embedded objects with the library from previous version.
• Switching off display of the polygons in 3D also switches them off in plan view, due to the way 2D view is scripted.
• With certian objects it seems the contours can not be properly defined in 3D or section views what ever you do (eg inclined square hollow section members with rounded corners rather than sharp corners), so you may need to toggle display of contours only mode to ‘off’ within ArchiCAD, accepting the excess polygons displaying in section (and plan view). Or you could covert just these objects to morphs and try to manipulate their display from there.
• Certain objects may need to have their ‘Show Only Contours in 3D’ parameter toggled off and back on to reset the display mode.
• This method *should* in theory work for any IFC import project, and can be adapted for imports from other sources, or in fact any other situation where there are multiple objects all needing the same changes made (object materials, new parameters, rotations, scale, 2D display method etc).

Anyone wanting to know the GDL changes involved , these are

To sort out the display context problem in 3D script:

Find this string : IF (GLOB_CONTEXT - 3) % 10 = 0 AND gs_ifc_showOnlyContourEdgesIn3D <> 0 THEN hiddenEdge = 1
and Replace with: IF (GLOB_CONTEXT - 3) % 10 <=1 AND gs_ifc_showOnlyContourEdgesIn3D <> 0 THEN hiddenEdge = 1

To sort out certain random objects created with the required display parameter hidden from user, and set to ‘off’

Find this string: <ParFlg_Hidden/>


and Replace with: [nothing]

Any suggestions/improvements, let me know.

Cheers
Paul King
PAUL KING | https://www.prime.net.nz
ArchiCAD 8-28 | Twinmotion 2024
Windoze 11 PC | Intel Core i9 10900K | Nvidia Gforce RTX 3080 | 32 Gb DDR3 | 2x4K monitor extended desktop
2 REPLIES 2
Laszlo Nagy
Community Admin
Community Admin
Hi Paul,

I have not tried this out now, but I think this will be a very, very useful workaround for this situation.

Do you think this could also work for SketchUp imports? I suppose it would although in case of SketchUp one would probably do this by one SketchUp element at a time. But you may have more experience with it.
Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac28
Paul King
Mentor
laszlonagy wrote:
Hi Paul,

I have not tried this out now, but I think this will be a very, very useful workaround for this situation.

Do you think this could also work for SketchUp imports? I suppose it would although in case of SketchUp one would probably do this by one SketchUp element at a time. But you may have more experience with it.
Hi Laszlo

I don't see why a similar process would not work for any imported objects.
The idea is that it edits a whole library of objects at once, assuming the same thing needs to be done to all - and imported dumb objects that display too many polygons would fit this category. You would probably start with one object to check what ArchiCAD import forgets to do automatically, then adjust the search & replace criteria accordingly for the XML file representing the whole library
PAUL KING | https://www.prime.net.nz
ArchiCAD 8-28 | Twinmotion 2024
Windoze 11 PC | Intel Core i9 10900K | Nvidia Gforce RTX 3080 | 32 Gb DDR3 | 2x4K monitor extended desktop