forked from 1b-agent/opencadstudio-upstream
SWEEP: reference messages, 3D polyline profiles and Scale Reference
- 3D polyline profiles are recorded as wire bodies, like 3D polyline paths. - Refused sweeps print the modeling error code and "Unable to sweep N selected objects."; a scaled sweep rejects closed and cornered spatial paths with the reference messages and asks for the path again. - Scale > Reference asks for start and end reference lengths (start / end). - Bank stays on for later sweeps until a twist angle is entered. - Refused twist/scale edits in Properties print the modeling error code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7a8ec02003
commit
1a18fdd0cf
6 files changed
+149
-57
No files matched your search
@@ -497,22 +497,34 @@ impl OpenCADStudio {
|
||||
let mut created_handles = Vec::new();
|
||||
let mut consumed = Vec::new();
|
||||
for (handle, profile) in profiles {
|
||||
let result = path.as_ref().zip(options).and_then(|(path, options)| {
|
||||
let mut record = sweep_model::sweep_record(&profile, path, options)?;
|
||||
// A refused sweep reports the modeler error code, as the
|
||||
// reference does.
|
||||
let result = (|| -> Result<_, Option<u32>> {
|
||||
let (path, options) = path.as_ref().zip(options).ok_or(None)?;
|
||||
let mut record = sweep_model::sweep_record(&profile, path, options).ok_or(None)?;
|
||||
record.flags_294_296[0] |= picked_base;
|
||||
let (_, _, closed) = kernel::acis::sweep_profile_geometry(
|
||||
record.sweep_entity.as_ref()?,
|
||||
record.sweep_entity.as_ref().ok_or(None)?,
|
||||
record.sweep_entity_transform,
|
||||
)
|
||||
.ok()?;
|
||||
.map_err(|_| None)?;
|
||||
let surface = mode == ExtrudeMode::Surface || !closed;
|
||||
let body =
|
||||
kernel::acis::rebuild_sweep_with_mode(&record, surface).ok()?;
|
||||
Some((body, record, surface))
|
||||
});
|
||||
let Some((body, record, surface)) = result else {
|
||||
failed += 1;
|
||||
continue;
|
||||
let body = kernel::acis::rebuild_sweep_with_mode(&record, surface).map_err(|error| match error {
|
||||
kernel::acis::HistoryRebuildError::Refused(why) => Some(sweep_model::sweep_refusal_code(why)),
|
||||
_ => None,
|
||||
})?;
|
||||
Ok((body, record, surface))
|
||||
})();
|
||||
let (body, record, surface) = match result {
|
||||
Ok(value) => value,
|
||||
Err(code) => {
|
||||
if let Some(code) = code {
|
||||
self.command_line.push_output(&format!("Modeling Operation Error:
|
||||
Error Code Number is {code}"));
|
||||
}
|
||||
failed += 1;
|
||||
continue;
|
||||
}
|
||||
};
|
||||
let deletes_path =
|
||||
crate::app::delobj_deletes_auxiliary(delete_objects, surface);
|
||||
@@ -550,14 +562,9 @@ impl OpenCADStudio {
|
||||
self.tabs[i].scene.select_entity(*handle, true);
|
||||
}
|
||||
self.tabs[i].dirty = true;
|
||||
self.command_line.push_output(crate::tf!(
|
||||
"SWEEP: created {created} object(s); {failed} source(s) could not be swept.",
|
||||
created = created_handles.len(), failed = failed
|
||||
).as_ref());
|
||||
} else {
|
||||
self.command_line.push_error(
|
||||
crate::t!("SWEEP: could not sweep the profile along the path.").as_ref(),
|
||||
);
|
||||
}
|
||||
if failed > 0 {
|
||||
self.command_line.push_output(&format!("Unable to sweep {failed} selected objects."));
|
||||
}
|
||||
if let Some(pending) = pending {
|
||||
self.commit_undo_delta(i, pending);
|
||||
|
||||
Reference in new issue
Block a user