line break in text property value

I got a ifc from some other In this ifc the text property values had line breaks. See attached screen.

I had a look at the ifc code and the following character where used \X\0D\X\0A

I made a own example ...

...
#81=IFCPROPERTYSINGLEVALUE('MyProperty',$,IFCTEXT('Line break is possible inside a IfcText.\X\0D\X\0AThere was a line break.\X\0D\X\0AEven a empty line is possible.\X\0D\X\0A\X\0D\X\0ASome enumeration too\X\0D\X\0A- some text\X\0D\X\0A- more text\X\0D\X\0A- even more text\X\0D\X\0A- still some text'),$);
...

looks in BIMCollabZoom like this:

Some Viewer and cloud plattform do support it some not. This results in the following question. Is this official BuildingSmart IFC standard? If yes where to find this on the internet?

Furthermore I would be interested if there is a simple way of adding this by IfcOpenShell without knowing this charactercode.

Attached the ifc exported from FreeCAD and edited with editor.

cheers bernd

theoryshaw

Comments

  • Is this official BuildingSmart IFC standard? If yes where to find this on the internet?

    Don't really understand your question, it's just basic unicode if that is what you mean?

  • @Coen said:

    Is this official BuildingSmart IFC standard? If yes where to find this on the internet?

    Don't really understand your question, it's just basic unicode if that is what you mean?

    Does it mean \X\0D\X\0A is the unicode character for a line break?
    Are all unicode characters allowed in ifc? Is there some information about this available?

    If I get in contact with software support I can here the answer right now ... "this is not supported by ifc" If could post a link to some ifc page which says all unicode characters are allowed

  • Are all unicode characters allowed in ifc? Is there some information about this available?

    https://technical.buildingsmart.org/resources/ifcimplementationguidance/string-encoding/

  • @bernd said:
    Does it mean \X\0D\X\0A is the unicode character for a line break?

    This is a carriage return followed by a line feed, which is the Windows encoding for a new line, so not really standard.

    Coen
  • edited May 2023

    @brunopostle said:

    @bernd said:
    Does it mean \X\0D\X\0A is the unicode character for a line break?

    This is a carriage return followed by a line feed, which is the Windows encoding for a new line, so not really standard.

    Which part is the carriage return and which part is the line feed? Where do you know this from? I could not find anything on the internet in this regard.

  • The \X indicates that an encoded byte follows, so the whole thing is just two bytes in hex 0D0A (which has lots of search results). This is sometimes written \r\n, ie. a carriage return followed by a line feed.

    Gorgiousbernd
  • edited May 2023

    thanks very much I have been using IFC for over 10 years ... never understood the character for the special German letters ÄÜÖ in IFC. It is because I did not know about these \x and thus never found something on the internet ... Great information.
    It all makes sense now for me ...

  • BTW ... does BB gui shows the line breaks in property values ?

  • Blender itself doesn't support multi-line text fields so I don't think it is possible now. I think \n wil add a newline but this will depend on who's reading the value back :)

    For example if you add a text object annotation and modify the text literal with a line break, it will show up with a line break in the viewport. Not in the properties panel, though.

    Coen
  • edited May 2023

    Furthermore I would be interested if there is a simple way of adding this by IfcOpenShell without knowing this charactercode.

    In Python you can directly use Unicode and IfcOpenShell will handle the tranformations! See code snippet:

    import ifcopenshell
    import ifcopenshell.api
    import ifcopenshell.template
    
    # create base ifcfile
    ifcfile=ifcopenshell.template.create()
    
    # spatial structure
    project = ifcfile.by_type("IfcProject")[0]
    site = ifcopenshell.api.run("root.create_entity", ifcfile, ifc_class="IfcSite", name="My Site")
    ifcopenshell.api.run("aggregate.assign_object", ifcfile, product=site, relating_object=project)
    ifcopenshell.api.run("geometry.edit_object_placement", ifcfile, product=site)
    
    # test-unicode
    description_unicode = """This is a unicode-test
    Does Line break function? We'll see
    - hey
    - hoi
    
    Now test emoji, 'cause it's all unicode
    ???????"""
    
    # add product
    product = ifcfile.create_entity(
        "IfcBuildingElementProxy",
        GlobalId=ifcopenshell.guid.new(),
        Name="My Test Element",
        Description=description_unicode,
    )
    ifcopenshell.api.run(
        "spatial.assign_container",
        ifcfile,
        product=product,
        relating_structure=site,
    )
    
    # write
    ifcfile.write("unicode-test.ifc")
    

    Ifc file opened in notepad++

    ifc file opended in xbim viewer

    GorgiousbrunopostleberndCyrilCoenArv
  • I guess this means that a Unix line feed 0A (or \n) is sufficient, no need for a Windows 0D0A

  • @Martin156131 said:
    In Python you can directly use Unicode and IfcOpenShell will handle the tranformations! See code snippet:

    very cool example. Would it be possible to add your created ifc to your post. So anybody could test if his prefered viewer supports this.

  • @Martin156131 said:
    Now test emoji, 'cause it's all unicode
    ???????

    Cool! I think I will start using this emoji for the FireRating property.

    Martin156131JanF
  • ?️ IsExternal True
    ?️‍♂️LoadBearing True

    GorgiousNigelAceMartin156131bruno_perdigaoArv
  • edited May 2023

    Would it be possible to add your created ifc to your post. So anybody could test if his prefered viewer supports this.

    @bernd I added the ifc file! Some ifc viewer could have a problem, because there is no geometry in this file...

    I also did test this file with https://validate.buildingsmart.org/, there are two errors, however not related to the unicode byte enconding or that there are no geometry. I think it has something to do with the template function. Not sure


  • No unicode vision in BIMVision. :-(

    Martin156131
  • At least the line breaks work in BIMVision. Solibri does not even read and displays the line breaks ...

    CoenMartin156131
Sign In or Register to comment.