Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Units are lost when exporting IFC #27

Open
rafhik opened this issue Nov 23, 2021 · 2 comments
Open

Units are lost when exporting IFC #27

rafhik opened this issue Nov 23, 2021 · 2 comments

Comments

@rafhik
Copy link

rafhik commented Nov 23, 2021

Hi,
Great job with this plugin. I have a problem when I create custom Psets. I have a PsetQuantityTakeOff dictionary but the values have no units when I import them in a IFC viewer. When I export to IFC all of them are converted to IFC Label.
Only if I change IfcQuantityLength by IfcLengthMeasure the export IFC has units (mm) although my model is in meters.
What have I do to have units in volumes and areas?
This is my code (where a, b, x y , z are calculated values):

    ifcDict = instance.definition.attribute_dictionary("IFC 2x3")
    ifcQuantities = ifcDict.attribute_dictionary("PsetQuantityTakeOff", true)
    ifcQuantitiesNetVolume = ifcQuantities.attribute_dictionary("NetVolume", true)
    
    ifcQuantitiesNetVolume.set_attribute "IfcQuantityVolume", "value", a.to_s
    ifcQuantitiesNetVolume.set_attribute "IfcQuantityVolume", "is_hidden", false
    ifcQuantitiesNetVolume.set_attribute "IfcQuantityVolume", "attribute_type", Float
    
    
    ifcQuantitiesGrossVolume = ifcQuantities.attribute_dictionary("GrossVolume", true)

    ifcQuantitiesGrossVolume.set_attribute "IfcQuantityVolume", "value", v.to_s
    ifcQuantitiesGrossVolume.set_attribute "IfcQuantityVolume", "is_hidden", false
    ifcQuantitiesGrossVolume.set_attribute "IfcQuantityVolume", "attribute_type", Float


    ifcQuantitiesGrossFootprintArea = ifcQuantities.attribute_dictionary("GrossFootprintArea", true)

    ifcQuantitiesGrossFootprintArea.set_attribute "IfcQuantityArea", "value", s.to_s
    ifcQuantitiesGrossFootprintArea.set_attribute "IfcQuantityArea", "is_hidden", false
    ifcQuantitiesGrossFootprintArea.set_attribute "IfcQuantityArea", "attribute_type", Float

    ifcQuantitiesNominalLength = ifcQuantities.attribute_dictionary("NominalLength", true)

    ifcQuantitiesNominalLength.set_attribute "IfcQuantityLength", "value", x.to_s
    ifcQuantitiesNominalLength.set_attribute "IfcQuantityLength", "is_hidden", false
    ifcQuantitiesNominalLength.set_attribute "IfcQuantityLength", "attribute_type", Float

    ifcQuantitiesNominalWidth = ifcQuantities.attribute_dictionary("NominalWidth", true)

    ifcQuantitiesNominalWidth.set_attribute "IfcQuantityLength", "value", y.to_s
    ifcQuantitiesNominalWidth.set_attribute "IfcQuantityLength", "is_hidden", false
    ifcQuantitiesNominalWidth.set_attribute "IfcQuantityLength", "attribute_type", Float

    ifcQuantitiesNominalHeight = ifcQuantities.attribute_dictionary("NominalHeight", true)

    ifcQuantitiesNominalHeight.set_attribute "IfcQuantityLength", "value", z.to_s
    ifcQuantitiesNominalHeight.set_attribute "IfcQuantityLength", "is_hidden", false
    ifcQuantitiesNominalHeight.set_attribute "IfcQuantityLength", "attribute_type", Float  


    ifcQuantities.set_attribute "Units", "value", "volume (m3) - area (m2) - length (m)"
    ifcQuantities.set_attribute "Units", "is_hidden", false
    ifcQuantities.set_attribute "Units", "attribute_type", String

Captura de pantalla 2021-11-23 a las 9 30 14

Thanks in advance and sorry by my poor English

@janbrouwer
Copy link
Contributor

Hi @rafhik,

Cool that you are diving in this deep into adding IFC properties!
On export I have to guess the best IFC type based on property name and ruby type (ia float, string) so all values that are not understood are mapped to the fallback type of IfcLabel, I could try to improve the "guessing" part, or maybe add additional "IFC manager specific" properties where one could write the IFC type, I have to think on that.

And for the meters vs millimeters, the IFC model units are hardcoded to mm at this time, would be nice to make that dependent on the curent Sketchup unit settings, but that would take some work...

@janbrouwer
Copy link
Contributor

Added IFC export suport for all Sketchup units
6422dd1

Didn't look at Quantities yet but this is a big step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants