Skip to content

polyline creation : join_elements does not return the resulting element #365

Description

@usai-sylvain

I am trying to create a polyline by joining some lines :

    points = [cadwork.point_3d(0,0,0), cadwork.point_3d(100,0,0), cadwork.point_3d(0,100,0), cadwork.point_3d(100,100,0)]
    polyline_segments = []
    
    for i, point in enumerate(points):
        ec.create_node(point)
        if i < len(points) - 1:
            line = ec.create_line_points(points[i], points[(i+1)%len(points)])
            polyline_segments.append(line)
    results = ec.join_elements(polyline_segments)
    print("polyline_segments: ", polyline_segments)
    print("results: ", results)
    return

result :

[65329958, 65329956, 65329954]
None
Image

The result does look like a polyline in the model (selecting one segment selects the other segments too, length is the length of the full polyline, "Active Lines : 3") but I still get individidual ids when I print get_active_identifiable_element_ids :

    all_element_ids = ec.get_active_identifiable_element_ids()
    for i, element_id in enumerate(all_element_ids):
        print(f"element_id: {element_id}, index: {i}")
    return

result :

element_id: 65329958, index: 0
element_id: 65329956, index: 1
element_id: 65329954, index: 2

Is there a better way to approach this ? or should I always expect to deal with the sub element ids ?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions