Skip to content

Convert container to container block #346

Description

@rgv-4292

I am trying to write an API to convert a container to a container block, but the function appears to be incomplete. When I run the code (following), it appears successful with the elements of the container becoming immutable, but the container is not a block instance and doesn't allow unlocking or undoing the operation. Is this a known issue or am I approaching this incorrectly?

`
import cadwork
import element_controller as ec
import geometry_controller as gc
import attribute_controller as ac
import utility_controller as uc

element_ids = ec.get_active_identifiable_element_ids()

ec.add_modified_elements_to_undo(element_ids)
container = ec.create_auto_container_from_standard(element_ids, 'Cont_', "Auto_Container")
container_elements = ec.get_container_content_elements(container)
ac.set_name([container], 'Container_' + str(container))

ref_length = gc.get_length(container)
ref_width = gc.get_width(container)
ref_height = gc.get_height(container)

ref_length = ref_length - 20
ref_width = ref_width - 20
ref_height = ref_height - 20

gc.set_length_real([container], ref_length)
gc.set_width_real([container], ref_width)
gc.set_height_real([container], ref_height)

ec.add_created_elements_to_undo([container])
container_name = ac.get_name(container)
block_container = ec.convert_container_to_container_block([container])
##ec.add_created_elements_to_undo([block_container])
uc.print_message("Container created: " + container_name, 0, 0)
`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions