OSArch Community

What is ifcopenshell.api.run ... "edit_object_placement" useful for?

  1. B

    a minimalisic spatial structure is added to a ifcfile as follows ... from https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.7.0/src/blenderbim/scripts/obj2ifc.py#L116-L127

            site = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcSite", name="My Site")
    
            building = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuilding", name="My Building")
    
            self.storey = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuildingStorey", name="My Storey" )
    
    
            ifcopenshell.api.run("aggregate.assign_object", self.file, product=site, relating_object=project)
    
            ifcopenshell.api.run("aggregate.assign_object", self.file, product=building, relating_object=site)
    
            ifcopenshell.api.run("aggregate.assign_object", self.file, product=self.storey, relating_object=building)
    
    
    
            ifcopenshell.api.run("geometry.edit_object_placement", self.file, product=site)
    
            ifcopenshell.api.run("geometry.edit_object_placement", self.file, product=building)
    
            ifcopenshell.api.run("geometry.edit_object_placement", self.file, product=self.storey)

    What does the lines ifcopenshell.api.run("geometry.edit_object_placement", self.file, product=site) exactly do?

  2. C

    What does the lines ifcopenshell.api.run("geometry.edit_object_placement", self.file, product=site) exactly do?

    I think it allows for a transformation of an object?

    In this code snippet it's used to make an array of beams

    
    for i in range(0, length_total_x, center_to_center_distance):
    
    
    
                matrix_x = numpy.array(
    
                                (
    
                                    (1.0, 0.0, 0.0, i),
    
                                    (1.0, 1.0, 1.0, profile_offset_y),
    
                                    (0.0, 0.0, 0.0, 0.0),
    
                                    (0.0, 0.0, 0.0, 1.0),
    
                                )
    
                            )
    
    
    
                matrix_x = numpy.array(matrix_x)
    
    
                occurrence =  run("root.create_entity", model, ifc_class="IfcBeam", name=beam_name)
    
                representation = run("geometry.add_profile_representation", model, context=representations["body"], profile=profile, depth=beam_length_y) 
    
    
    
                run("geometry.edit_object_placement",model, product=occurrence, matrix=matrix_x) 
    
                run("spatial.assign_container", model, relating_structure=storey, product=occurrence)
    
                run("geometry.assign_representation", model, product=occurrence, representation=representation)
    
                run("style.assign_representation_styles", model, shape_representation=representation, styles=[style])
    

  3. B

    But why is it needed for Spatial structure objects without representation?

  4. M

    @bernd just because they do not have a representation doesn't mean that it shouldn't have a placement. For example, the placement of a building storey uses its Z ordinate to specify the elevation. Similarly, a placement at the building or site level makes it easy to shift the entire building / site relative to it.

Login or Register to reply.