mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Documentation example fixes where I forgot to give things with representations a placement
This commit is contained in:
@@ -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 = {
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user