简体   繁体   中英

Combining several polygons

with my python script I create a cross-section out of several polygons. They are different surfaces with different material parameter. My problem is that I have severall polygons which are very close to each other but not connected. For further calculations I need to connect these polygons. I don´t want to have one big polygon. I just want to have the small gaps closed between the different polygons and they should stay still seperated by bounds.

Somehow I tried a lot but at the end everything got to a big single polygon.

Here a code snippet: I create so called "sections" with the section_multiplane and out of this i create the polygons with the shapely polygon tool. And these polygons, in this case just as example, are very close to each other and I just want to close the gap between these two.

sections = mesh_kr.section_multiplane(plane_origin=mesh_kr.bounds[0], 
                                   plane_normal=[1,0,0], 
                                   heights=x_levels)

sections_belag = mesh_belag.section_multiplane(plane_origin=mesh_kr.bounds[0], 
                                   plane_normal=[1,0,0], 
                                   heights=x_levels)

poly_kr = sections[20].polygons_full[0]
poly_belag = sections_belag[20].polygons_full[0]

Need to edit I can easily generate vertices of the polygons. So maybe there is a way to combine the vertices?

sorry for elaborating not correctly. i added 2 pictures to this answer here. As you can see in the zoomed picture, there is a gap between the two meshes. And I´m looking for something that this gap gets closed, by connecting the two meshes together. But the goal is that the meshes will stay as seperated meshes. 在此处输入图像描述

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM