forked from 1b-agent/opencadstudio-upstream
chore: bump codec d28fd71, kernel a03e4f0, graph 79bdc4b
Codec: PRs #71-#74 merged (MPOLYGON layout, multiline ATTDEF/ATTRIB DXF, DXF MATERIAL/ACSH matrix, restorable SAT/SAB + history roots) and issues #55 #64-#69 fixed. EntityType now boxes Surface, Extended, Table, MultiLeader and Helix (2344 B -> 848 B per entity): construction sites wrap in Box, the entity traits forward through Box, and the python plugin generator converts with into(). Kernel: PR #70 (cuboid ring winding). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8c1471078d
commit
443b935a3f
31 files changed
+147
-84
No files matched your search
@@ -965,16 +965,16 @@ mod thicken_tests {
|
||||
)
|
||||
.unwrap();
|
||||
let source = app.add_surface_model(
|
||||
codec::EntityType::Surface(Surface::new(SurfaceKind::Plane)),
|
||||
codec::EntityType::Surface(Box::new(Surface::new(SurfaceKind::Plane))),
|
||||
body,
|
||||
);
|
||||
assert!(!source.is_null());
|
||||
let i = app.active_tab;
|
||||
let invalid = app.tabs[i]
|
||||
.scene
|
||||
.add_entity(codec::EntityType::Surface(Surface::new(
|
||||
.add_entity(codec::EntityType::Surface(Box::new(Surface::new(
|
||||
SurfaceKind::Generic,
|
||||
)));
|
||||
))));
|
||||
let original =
|
||||
serde_json::to_value(app.tabs[i].scene.document.get_entity(source).unwrap()).unwrap();
|
||||
let before = app.tabs[i].history.undo_stack.len();
|
||||
@@ -1060,7 +1060,7 @@ mod thicken_tests {
|
||||
kernel::brep::extrude_surface(Plane::XY, &[Curve::Nurbs(profile)], [0.0, 0.0, 2.0])
|
||||
.unwrap();
|
||||
let source = app.add_surface_model(
|
||||
codec::EntityType::Surface(Surface::new(SurfaceKind::Generic)),
|
||||
codec::EntityType::Surface(Box::new(Surface::new(SurfaceKind::Generic))),
|
||||
body,
|
||||
);
|
||||
let i = app.active_tab;
|
||||
|
||||
@@ -322,7 +322,7 @@ impl OpenCADStudio {
|
||||
"_PCCROPCIRC" => "C",
|
||||
_ => "",
|
||||
};
|
||||
let command = crate::modules::insert::pc_crop::PointCloudCropCommand::for_cloud(handle, cloud, option);
|
||||
let command = crate::modules::insert::pc_crop::PointCloudCropCommand::for_cloud(handle, *cloud, option);
|
||||
self.command_line.push_info(&command.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(command));
|
||||
}
|
||||
|
||||
@@ -163,10 +163,10 @@ impl OpenCADStudio {
|
||||
elevation_as_gradient: false,
|
||||
croppings: Vec::new(),
|
||||
};
|
||||
let entity = codec::EntityType::Extended(codec::entities::ExtendedEntity {
|
||||
let entity = codec::EntityType::Extended(Box::new(codec::entities::ExtendedEntity {
|
||||
common: codec::entities::EntityCommon::new(),
|
||||
data: codec::entities::ExtendedEntityData::PointCloudEx(data),
|
||||
});
|
||||
}));
|
||||
if let Some(cloud) = self.commit_entity_handle(entity) {
|
||||
// The reactor, owned by the cloud, tells the definition who uses it.
|
||||
let document = &mut self.tabs[i].scene.document;
|
||||
|
||||
+9
-9
@@ -685,15 +685,15 @@ impl OpenCADStudio {
|
||||
/// Add is delta-safe when its layer and XData application IDs already exist
|
||||
/// and it creates no block records.
|
||||
pub(super) fn delta_add_safe(&self, i: usize, entity: &EntityType) -> bool {
|
||||
if matches!(
|
||||
entity,
|
||||
EntityType::Block(_)
|
||||
| EntityType::BlockEnd(_)
|
||||
| EntityType::Extended(codec::entities::ExtendedEntity {
|
||||
data: codec::entities::ExtendedEntityData::SectionObject(_),
|
||||
..
|
||||
})
|
||||
) {
|
||||
if matches!(entity, EntityType::Block(_) | EntityType::BlockEnd(_))
|
||||
|| matches!(
|
||||
entity,
|
||||
EntityType::Extended(extended) if matches!(
|
||||
extended.data,
|
||||
codec::entities::ExtendedEntityData::SectionObject(_)
|
||||
)
|
||||
)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
let layer = entity.common().layer.clone();
|
||||
|
||||
@@ -1354,7 +1354,7 @@ impl super::OpenCADStudio {
|
||||
let mut entity = Surface::new(SurfaceKind::Generic);
|
||||
entity.common = group.common;
|
||||
self.add_surface_model_preserving_style(
|
||||
EntityType::Surface(entity),
|
||||
EntityType::Surface(Box::new(entity)),
|
||||
group.body,
|
||||
)
|
||||
}
|
||||
@@ -2316,7 +2316,7 @@ impl super::OpenCADStudio {
|
||||
}
|
||||
let n = surfaces.len();
|
||||
for surf in surfaces {
|
||||
self.tabs[i].scene.add_entity(EntityType::Surface(surf));
|
||||
self.tabs[i].scene.add_entity(EntityType::Surface(Box::new(surf)));
|
||||
}
|
||||
self.tabs[i].dirty = true;
|
||||
self.refresh_properties();
|
||||
|
||||
@@ -198,14 +198,14 @@ impl<'a> HostSession<'a> {
|
||||
}
|
||||
if let EntityType::Helix(new) = entity {
|
||||
let old = match old {
|
||||
Some(EntityType::Helix(old)) => Some(old),
|
||||
Some(EntityType::Helix(old)) => Some(&**old),
|
||||
_ => None,
|
||||
};
|
||||
crate::entities::helix::normalize_scripted_helix(old, new)?;
|
||||
}
|
||||
if let EntityType::Table(new) = entity {
|
||||
let old = match old {
|
||||
Some(EntityType::Table(old)) => Some(old),
|
||||
Some(EntityType::Table(old)) => Some(&**old),
|
||||
_ => None,
|
||||
};
|
||||
crate::entities::table::normalize_scripted_table(old, new);
|
||||
@@ -758,7 +758,7 @@ impl<'a> HostSession<'a> {
|
||||
surface.wires = model::edge_wires(&body);
|
||||
surface.acis_data = codec::entities::AcisData::from_sat(&sat.to_sat_string());
|
||||
surface.common.layer = layer;
|
||||
self.commit_profile_result(EntityType::Surface(surface), source, delete_source, "Create surface")
|
||||
self.commit_profile_result(EntityType::Surface(Box::new(surface)), source, delete_source, "Create surface")
|
||||
}
|
||||
SolidOperation::Extrude { source, direction, layer, delete_source } => {
|
||||
if direction.iter().any(|v| !v.is_finite()) {
|
||||
@@ -788,7 +788,7 @@ impl<'a> HostSession<'a> {
|
||||
surface.wires = model::edge_wires(&body);
|
||||
surface.acis_data = codec::entities::AcisData::from_sat(&sat.to_sat_string());
|
||||
surface.common.layer = layer;
|
||||
EntityType::Surface(surface)
|
||||
EntityType::Surface(Box::new(surface))
|
||||
};
|
||||
self.commit_profile_result(result, source, delete_source, "Extrude profile")
|
||||
}
|
||||
@@ -7201,7 +7201,7 @@ mod tests {
|
||||
let unliftable = host.add_entity(EntityType::Solid3D(codec::entities::Solid3D::new()));
|
||||
let mut plane = codec::entities::Surface::new(codec::entities::SurfaceKind::Plane);
|
||||
plane.acis_data = codec::entities::AcisData::new();
|
||||
let surface = host.add_entity(EntityType::Surface(plane));
|
||||
let surface = host.add_entity(EntityType::Surface(Box::new(plane)));
|
||||
let far = { dispatch(&mut host, "PY_EVAL ocs.active_document.solids.box(center=(500, 500, 500), size=(1, 1, 1)).handle");
|
||||
*solids_in(host.document()).last().unwrap() };
|
||||
let counts = (host.document().entities().count(), host.app.tabs[0].history.undo_stack.len());
|
||||
|
||||
@@ -140,7 +140,7 @@ impl super::OpenCADStudio {
|
||||
surface.surface_data = solid_history::extrusion_surface_data(record)
|
||||
.ok_or("PRESSPULL: the surface parameters could not be retained.")?;
|
||||
}
|
||||
EntityType::Surface(surface)
|
||||
EntityType::Surface(Box::new(surface))
|
||||
};
|
||||
(body, history, entity)
|
||||
}
|
||||
|
||||
@@ -10922,7 +10922,7 @@ mod free_text_entry_tests {
|
||||
let handle = app.tabs[0]
|
||||
.scene
|
||||
.document
|
||||
.add_entity(EntityType::Table(table.clone()))
|
||||
.add_entity(EntityType::Table(Box::new(table.clone())))
|
||||
.unwrap();
|
||||
app.set_active_command(0, Box::new(TableCellEditCommand::new(handle, &table, 0, 0)));
|
||||
(app, handle)
|
||||
|
||||
Reference in new issue
Block a user