- get_next_task() changes
Previously: if type had n occurrences and only 1 of them was requiring to have their own representation (e.g. one of the occurrences had openings), then all the occurrences would have their own representations even though it wasn't necessary.
Now get_next_task() is filter out products that should have their own representation and use a common representation of other occurrences. In the example above only this 1 product requiring unique representation will have it and all other n-1 will share type's representation.
To do so I've changed reuse_ok_() - now it's checking the condition for a single product instead of a list of them (previously we could only check whether all products in a list are okay to reuse type's representation or not).
Previously there was a check if provided products use multiple materials (I assumed it was to check whether they do have conflicting material styles). I've replaced it with check for whether current product has an overriding material style.
- removed ok_mapped_representations cache since it's no longer possible that we'll be checking reuse_ok_ for all products of a mapped representation multiple times.
- get_single_material_association now is using IfcObjectDefinition to allow both IfcProducts and IfcTypeProducts
- find_representation now has another implementation that will search for representation with matching IfcRepresentationContext
This improves four things:
1. Previously, we either used OBJECT_PLACEMENT or CARTESIAN_POINT, but couldn't handle scenarios where simultaneously both the placement and the coords were rubbish for a single object. Now we offset all far cartesian points, so it consistently works and we keep track of a per-object offset.
2. Previously, we applied the georeferencing conversion on every cartesian point which was very slow. The new method uses a simple XYZ translation which is super fast.
3. We now use numpy which should be much faster too.
4. Previously, objects were selectively offset based on whether they fell outside the distance limit. Now, we uniformly treat all non-geometric elements at 0,0,0 as insignificant positionally. This fixes the issue where half the model is offset and the other half isn't, but maintains the fix for situations where the site (typically) is at 0,0,0 and everything else is map coords.
Before - https://imgur.com/a/MMnGMBo .
Occurrences with openings wasn't reloaded if you'd change their representation items (add/remove a style, remove a representation item). Also type/occurrences representations were not always reloading.
After - https://imgur.com/a/vBDejb8
Similar thing will be added to switch representation and to representation update to solve issues like this - https://imgur.com/a/0DFIBj2 (issue is still present now).
TypeError is more correct since error occurs when user is trying to set some attribute value with None while atttribute doesn't support None type. ValueError is typically raised when provided value has a correct type but unsupported value.
It's py.types requirement, similar to 6e2edbf
Example issue without __all__:
import ifcopenshell
import ifcopenshell.api.project
# "create_file" is not exported from module "ifcopenshell.api.project"
ifcopenshell.api.project.create_file()