forked from 1b-agent/opencadstudio-upstream
PDF follow-ups: import layers, arcs and joins, names, background, page placement, snaps
- Unlayered raster images go with the PDF layer drawn last before them. - Circular Bezier arcs import as arcs: bulged polyline segments with Join, ARC entities without it; straight chains still join. - Imported PNGs go to "PDF Images" next to the PDF; import blocks are numbered imp31, imp32, ... - Background darkness is its HSL lightness below one half. - All chosen pages attach at the same insertion point. - PDF geometry snaps as separate pieces: centre from the rim, intersections and perpendiculars. - Automation: snap query with an optional base point. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
857f2f2e58
commit
edbbc9d135
10 files changed
+347
-63
No files matched your search
@@ -459,6 +459,7 @@ impl OpenCADStudio {
|
||||
| "commands"
|
||||
| "properties"
|
||||
| "measure"
|
||||
| "snap"
|
||||
| "query"
|
||||
| "records"
|
||||
| "record_schema"
|
||||
@@ -705,6 +706,28 @@ impl OpenCADStudio {
|
||||
let response = match op {
|
||||
"properties" => self.control_properties(),
|
||||
"measure" => self.control_measure(&req),
|
||||
// The object snap a cursor over `point` (world) would get;
|
||||
// `from` is the base for perpendicular and tangent.
|
||||
"snap" => {
|
||||
let p = &req["point"];
|
||||
let world = glam::DVec3::new(
|
||||
p[0].as_f64().unwrap_or(0.0),
|
||||
p[1].as_f64().unwrap_or(0.0),
|
||||
p[2].as_f64().unwrap_or(0.0),
|
||||
);
|
||||
let from = req["from"].as_array().map(|f| {
|
||||
glam::DVec3::new(
|
||||
f.first().and_then(|v| v.as_f64()).unwrap_or(0.0),
|
||||
f.get(1).and_then(|v| v.as_f64()).unwrap_or(0.0),
|
||||
f.get(2).and_then(|v| v.as_f64()).unwrap_or(0.0),
|
||||
)
|
||||
});
|
||||
let i = self.active_tab;
|
||||
match self.snap_query(i, world, from) {
|
||||
Some(hit) => json!({"ok":true,"snap":format!("{:?}", hit.snap_type),"world":[hit.world.x,hit.world.y,hit.world.z]}),
|
||||
None => json!({"ok":true,"snap":null}),
|
||||
}
|
||||
}
|
||||
"xdata_get" => self.xdata_read(&req),
|
||||
"get_selection" => self.control_get_selection(),
|
||||
"history" => {
|
||||
|
||||
Reference in new issue
Block a user