Skip to content

How to get a scene for each selected element using python in cadwork? #131

Answered by Brunner246
lucas-ita asked this question in General
Discussion options

You must be logged in to vote

We will check this behaviour, looks like an unexpected behaviour. As an List[elementId] is explicitly passed as a parameter, only this should be added to the scene.

import element_controller as ec
import scene_controller as sc
import visualization_controller as vc


def main():
    element_ids = ec.get_active_identifiable_element_ids()
    vc.set_inactive(element_ids) # this should not be necessary in the future (bug)
    print(f"{len(element_ids)} active elements.")
    for index, element_id in enumerate(element_ids):
        scene_name = f"Scene {index}"
        if sc.add_scene(scene_name):
            sc.add_elements_to_scene(scene_name, [element_id])


if __name__ == '__main__':
    main

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by lucas-ita
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #127 on March 01, 2024 09:58.