Complete polygon mesh editing workflow

This commit is contained in:
ramox81 committed 2026-08-31 10:13:27 +03:00
1 parent def14b3195
commit 470e22c80f
3 files changed
+211 -66

No files matched your search

+11 -1
View File
@@ -253,6 +253,7 @@ impl OpenCADStudio {
is_poly: true,
convertible: false,
mesh_size: None,
mesh_closed: None,
},
)),
acadrust::EntityType::Line(_) | acadrust::EntityType::Arc(_) => {
@@ -262,6 +263,7 @@ impl OpenCADStudio {
is_poly: false,
convertible: true,
mesh_size: None,
mesh_closed: None,
},
))
}
@@ -274,6 +276,7 @@ impl OpenCADStudio {
mesh.m_vertex_count.max(0) as usize,
mesh.n_vertex_count.max(0) as usize,
)),
mesh_closed: Some((mesh.is_closed_m(), mesh.is_closed_n())),
},
)),
_ => None,
@@ -284,7 +287,14 @@ impl OpenCADStudio {
// the convert prompt) skips the select step.
let preselected: Vec<acadrust::Handle> =
self.tabs[i].scene.selected.iter().copied().collect();
let cmd_obj = PeditCommand::new(info).with_preselection(&preselected);
let header = &self.tabs[i].scene.document.header;
let cmd_obj = PeditCommand::new(
info,
header.surface_type,
header.surface_u_density,
header.surface_v_density,
)
.with_preselection(&preselected);
self.command_line.push_info(&cmd_obj.prompt());
self.tabs[i].active_cmd = Some(Box::new(cmd_obj));
}
+21 -18
View File
@@ -1667,33 +1667,36 @@ impl OpenCADStudio {
None => Ok((format!("SPLINESEGS = {}", h.spline_segments), false)),
},
"SURFU" => match &value {
Some(v) => v
.parse::<i16>()
.map(|x| {
Some(v) => match v.parse::<i16>() {
Ok(x @ 0..=200) => {
h.surface_u_density = x;
(format!("SURFU = {x}"), true)
})
.map_err(|_| "SETVAR: integer value required.".into()),
Ok((format!("SURFU = {x}"), true))
}
Ok(_) => Err("SETVAR: value must be between 0 and 200.".into()),
Err(_) => Err("SETVAR: integer value required.".into()),
},
None => Ok((format!("SURFU = {}", h.surface_u_density), false)),
},
"SURFV" => match &value {
Some(v) => v
.parse::<i16>()
.map(|x| {
Some(v) => match v.parse::<i16>() {
Ok(x @ 0..=200) => {
h.surface_v_density = x;
(format!("SURFV = {x}"), true)
})
.map_err(|_| "SETVAR: integer value required.".into()),
Ok((format!("SURFV = {x}"), true))
}
Ok(_) => Err("SETVAR: value must be between 0 and 200.".into()),
Err(_) => Err("SETVAR: integer value required.".into()),
},
None => Ok((format!("SURFV = {}", h.surface_v_density), false)),
},
"SURFTYPE" => match &value {
Some(v) => v
.parse::<i16>()
.map(|x| {
Some(v) => match v.parse::<i16>() {
Ok(x @ (5 | 6 | 8)) => {
h.surface_type = x;
(format!("SURFTYPE = {x}"), true)
})
.map_err(|_| "SETVAR: integer value required.".into()),
Ok((format!("SURFTYPE = {x}"), true))
}
Ok(_) => Err("SETVAR: value must be 5, 6, or 8.".into()),
Err(_) => Err("SETVAR: integer value required.".into()),
},
None => Ok((format!("SURFTYPE = {}", h.surface_type), false)),
},
"SHADEDGE" => match &value {