Skip to content

Selection

Model Selection#

Pick objects#

1
2
3
4
5
6
from pytekla import wrap

model = wrap("Model.Model")

# The returned value is a 'ModelObjectWrapper' Python generator
picked_objects = model.pick_objects(object_type="part", prompt="Select parts from the model")

Get all objects#

1
2
3
4
5
6
from pytekla import wrap

model = wrap("Model.Model")

# The returned value is a 'ModelObjectWrapper' Python generator
all_objects = model.get_all_objects()

Get selected objects#

1
2
3
4
5
6
from pytekla import wrap

model = wrap("Model.Model")

# The returned value is a 'ModelObjectWrapper' Python generator
selected_objects = model.get_selected_objects()

Get objects with types#

1
2
3
4
5
6
from pytekla import wrap

model = wrap("Model.Model")

# The returned value is a 'ModelObjectWrapper' Python generator
objects_with_types = model.get_objects_with_types(["Beam", "Assembly"])

Get objects by filter#

1
2
3
4
5
6
from pytekla import wrap

model = wrap("Model.Model")

# The returned value is a 'ModelObjectWrapper' Python generator
objects_by_filter = model.get_objects_by_filter("Steel_All")

Get objects by bounding box#

1
2
3
4
5
6
from pytekla import wrap

model = wrap("Model.Model")

# The returned value is a 'ModelObjectWrapper' Python generator
objects_by_bounding_box = model.get_objects_by_bounding_box((0, 0, 0), (5000, 5000, 5000))

Drawing Selection#

Get active drawing#

1
2
3
4
5
6
from pytekla import wrap

drawing_handler = wrap("Drawing.DrawingHandler")

# DrawingDbObjectWrapper instance
active_drawing = drawing_handler.get_active_drawing()

Get all drawings#

1
2
3
4
5
from pytekla import wrap

drawing_handler = wrap("Drawing.DrawingHandler")

drawings = drawing_handler.get_drawings()