GeometryGym / GeometryGymIFCExamples

Examples to demonstrate use of https://github.com/jmirtsch/GeometryGymIFC classes
MIT License
60 stars 34 forks source link

Modify the IfcObject's property/quantity #8

Open pmorshed opened 2 years ago

pmorshed commented 2 years ago

Hi, Is it possible to modify the IfcObject's property/quantity value and then save ifc file with updated fields? If so, can you give a simple example?

jmirtsch commented 2 years ago

Yes, this is possible.
GG provides a method to find a property set (or quantity set) by name. You can create it if it doesn't exist.

There is a method on a pset to add a property. This will displace any existing property of the same name. You do need to be careful. A property (or quantity) set might be common to multiple elements. And the property/quantity itself might be referenced in multiple property/quantity sets. So it's best to check, and duplicate the pset (if it is common) and generate the property anew rather than simply change the assigned value.

If you want to generate an example file and have problems, you can create a pull request and I'll review it.