@@ -81,6 +81,48 @@ namespace geode
8181 return mapping;
8282 }
8383
84+ void BRepBuilder::replace_components_meshes_by_others (
85+ BRep&& other, const ModelCopyMapping& mapping )
86+ {
87+ for ( const auto & in2out :
88+ mapping.at ( Corner3D::component_type_static () ).in2out_map () )
89+ {
90+ this ->unregister_mesh_component ( brep_.corner ( in2out.first ) );
91+ this ->set_corner_mesh (
92+ in2out.first , other.corner ( in2out.second ).mesh ().clone () );
93+ this ->corner_mesh_builder ( in2out.first )->set_id ( in2out.first );
94+ }
95+ for ( const auto & in2out :
96+ mapping.at ( Line3D::component_type_static () ).in2out_map () )
97+ {
98+ this ->unregister_mesh_component ( brep_.line ( in2out.first ) );
99+ this ->set_line_mesh (
100+ in2out.first , other.line ( in2out.second ).mesh ().clone () );
101+ this ->line_mesh_builder ( in2out.first )->set_id ( in2out.first );
102+ }
103+ for ( const auto & in2out :
104+ mapping.at ( Surface3D::component_type_static () ).in2out_map () )
105+ {
106+ this ->unregister_mesh_component ( brep_.surface ( in2out.first ) );
107+ this ->set_surface_mesh (
108+ in2out.first , other.surface ( in2out.second ).mesh ().clone () );
109+ this ->surface_mesh_builder ( in2out.first )->set_id ( in2out.first );
110+ }
111+ for ( const auto & in2out :
112+ mapping.at ( Block3D::component_type_static () ).in2out_map () )
113+ {
114+ this ->unregister_mesh_component ( brep_.block ( in2out.first ) );
115+ this ->set_block_mesh (
116+ in2out.first , other.block ( in2out.second ).mesh ().clone () );
117+ this ->block_mesh_builder ( in2out.first )->set_id ( in2out.first );
118+ }
119+ this ->delete_isolated_vertices ();
120+ const auto first_new_unique_vertex_id =
121+ create_unique_vertices ( other.nb_unique_vertices () );
122+ detail::copy_vertex_identifier_components (
123+ other, *this , first_new_unique_vertex_id, mapping );
124+ }
125+
84126 ModelCopyMapping BRepBuilder::copy_components ( const BRep& brep )
85127 {
86128 ModelCopyMapping mappings;
0 commit comments