diff --git a/src/ifcopenshell-python/ifcopenshell/api/context/add_context.py b/src/ifcopenshell-python/ifcopenshell/api/context/add_context.py index cada87c4bb..9027b1ae2a 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/context/add_context.py +++ b/src/ifcopenshell-python/ifcopenshell/api/context/add_context.py @@ -111,7 +111,7 @@ class Usecase: # If we plan to store 3D geometry in our IFC model, we have to setup # a "Model" context. - model = ifcopenshell.api.run("context.add_context", model, context_type="Model") + model3d = ifcopenshell.api.run("context.add_context", model, context_type="Model") # And/Or, if we plan to store 2D geometry, we need a "Plan" context plan = ifcopenshell.api.run("context.add_context", model, context_type="Plan") @@ -121,44 +121,37 @@ class Usecase: # and common context, as most IFC models are assumed to be viewable # in 3D. body = ifcopenshell.api.run("context.add_context", model, - context_type="Model", context_identifier="Body", target_view="MODEL_VIEW", parent=model - ) + context_type="Model", context_identifier="Body", target_view="MODEL_VIEW", parent=model3d) # The 3D Axis subcontext is important if any "axis-based" parametric # geometry is going to be created. For example, a beam, or column # may be drawn using a single 3D axis line, and for this we need an # Axis subcontext. ifcopenshell.api.run("context.add_context", model, - context_type="Model", context_identifier="Axis", target_view="GRAPH_VIEW", parent=model - ) + context_type="Model", context_identifier="Axis", target_view="GRAPH_VIEW", parent=model3d) # The 3D Box subcontext is useful for clash detection or shape # analysis, or even lazy-loading of large models. ifcopenshell.api.run("context.add_context", model, - context_type="Model", context_identifier="Box", target_view="MODEL_VIEW", parent=model - ) + context_type="Model", context_identifier="Box", target_view="MODEL_VIEW", parent=model3d) # It's also important to have a 2D Axis subcontext for things like # walls and claddings which can be drawn using a 2D axis line. ifcopenshell.api.run("context.add_context", model, - context_type="Plan", context_identifier="Axis", target_view="GRAPH_VIEW", parent=plan - ) + context_type="Plan", context_identifier="Axis", target_view="GRAPH_VIEW", parent=plan) # A 2D annotation subcontext for plan views are important for door # swings, window cuts, and symbols for equipment like GPOs, fire # extinguishers, and so on. ifcopenshell.api.run("context.add_context", model, - context_type="Plan", context_identifier="Annotation", target_view="PLAN_VIEW", parent=plan - ) + context_type="Plan", context_identifier="Annotation", target_view="PLAN_VIEW", parent=plan) # You may also create 2D annotation subcontexts for sections and # elevation views. ifcopenshell.api.run("context.add_context", model, - context_type="Plan", context_identifier="Annotation", target_view="SECTION_VIEW", parent=plan - ) + context_type="Plan", context_identifier="Annotation", target_view="SECTION_VIEW", parent=plan) ifcopenshell.api.run("context.add_context", model, - context_type="Plan", context_identifier="Annotation", target_view="ELEVATION_VIEW", parent=plan - ) + context_type="Plan", context_identifier="Annotation", target_view="ELEVATION_VIEW", parent=plan) # Let's create a new wall. The wall does not have any geometry yet. wall = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcWall") @@ -172,6 +165,9 @@ class Usecase: # Assign our new body geometry back to our wall ifcopenshell.api.run("geometry.assign_representation", model, product=wall, representation=representation) + + # Place our wall at the origin + ifcopenshell.api.run("geometry.edit_object_placement", model, product=wall) """ self.file = file self.settings = { diff --git a/src/ifcopenshell-python/ifcopenshell/api/layer/assign_layer.py b/src/ifcopenshell-python/ifcopenshell/api/layer/assign_layer.py index 0fd6321e64..c64e354aed 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/layer/assign_layer.py +++ b/src/ifcopenshell-python/ifcopenshell/api/layer/assign_layer.py @@ -53,6 +53,7 @@ class Usecase: context=body, length=5, height=3, thickness=0.2) ifcopenshell.api.run("geometry.assign_representation", model, product=wall, representation=representation) + ifcopenshell.api.run("geometry.edit_object_placement", model, product=wall) # Now let's create a layer that contains walls layer = ifcopenshell.api.run("layer.add_layer", model, Name="AI-WALL") diff --git a/src/ifcopenshell-python/ifcopenshell/api/layer/unassign_layer.py b/src/ifcopenshell-python/ifcopenshell/api/layer/unassign_layer.py index 3a1d92c3f1..7a5750bc60 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/layer/unassign_layer.py +++ b/src/ifcopenshell-python/ifcopenshell/api/layer/unassign_layer.py @@ -45,6 +45,7 @@ class Usecase: context=body, length=5, height=3, thickness=0.2) ifcopenshell.api.run("geometry.assign_representation", model, product=wall, representation=representation) + ifcopenshell.api.run("geometry.edit_object_placement", model, product=wall) # Now let's create a layer that contains walls layer = ifcopenshell.api.run("layer.add_layer", model, Name="AI-WALL") diff --git a/src/ifcopenshell-python/ifcopenshell/api/material/assign_material.py b/src/ifcopenshell-python/ifcopenshell/api/material/assign_material.py index 6265e20121..c9873c3cc7 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/material/assign_material.py +++ b/src/ifcopenshell-python/ifcopenshell/api/material/assign_material.py @@ -125,6 +125,7 @@ class Usecase: context=body_context, length=5000, height=3000, thickness=200) ifcopenshell.api.run("geometry.assign_representation", model, product=wall, representation=axis) ifcopenshell.api.run("geometry.assign_representation", model, product=wall, representation=body) + ifcopenshell.api.run("geometry.edit_object_placement", model, product=wall) """ self.file = file self.settings = {"product": product, "type": type, "material": material} diff --git a/src/ifcopenshell-python/ifcopenshell/api/material/assign_profile.py b/src/ifcopenshell-python/ifcopenshell/api/material/assign_profile.py index e257470348..35837d0915 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/material/assign_profile.py +++ b/src/ifcopenshell-python/ifcopenshell/api/material/assign_profile.py @@ -75,6 +75,7 @@ class Usecase: body = ifcopenshell.api.run("geoemtry.add_profile_representation", context=body_context, profile=hea100, depth=1000) ifcopenshell.api.run("geometry.assign_representation", model, product=beam, representation=body) + ifcopenshell.api.run("geometry.edit_object_placement", model, product=beam) # Now let's change the profile to a HEA200 standard profile instead. # This will automatically change the body representation that we diff --git a/src/ifcopenshell-python/ifcopenshell/api/material/edit_profile_usage.py b/src/ifcopenshell-python/ifcopenshell/api/material/edit_profile_usage.py index 836171fb90..1662189d80 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/material/edit_profile_usage.py +++ b/src/ifcopenshell-python/ifcopenshell/api/material/edit_profile_usage.py @@ -79,6 +79,7 @@ class Usecase: body = ifcopenshell.api.run("geoemtry.add_profile_representation", context=body_context, profile=hea100, depth=1000) ifcopenshell.api.run("geometry.assign_representation", model, product=beam, representation=body) + ifcopenshell.api.run("geometry.edit_object_placement", model, product=beam) # Let's change the cardinal point to be the top center of the axis # line. This is represented by the number "8". Consult the IFC