2024-03-05 11:52:45 -08:00
|
|
|
//! Standard library fillets.
|
|
|
|
|
|
|
|
use anyhow::Result;
|
|
|
|
use derive_docs::stdlib;
|
|
|
|
use kittycad::types::ModelingCmd;
|
|
|
|
use schemars::JsonSchema;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use uuid::Uuid;
|
|
|
|
|
|
|
|
use crate::{
|
2024-07-28 00:30:04 -07:00
|
|
|
ast::types::TagDeclarator,
|
2024-03-05 11:52:45 -08:00
|
|
|
errors::{KclError, KclErrorDetails},
|
2024-08-12 17:56:45 -05:00
|
|
|
executor::{EdgeCut, ExtrudeGroup, ExtrudeSurface, FilletSurface, GeoMeta, KclValue, TagIdentifier, UserVal},
|
2024-03-05 11:52:45 -08:00
|
|
|
std::Args,
|
|
|
|
};
|
|
|
|
|
2024-03-26 19:07:16 -07:00
|
|
|
pub(crate) const DEFAULT_TOLERANCE: f64 = 0.0000001;
|
|
|
|
|
2024-03-05 11:52:45 -08:00
|
|
|
/// Data for fillets.
|
|
|
|
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
|
|
|
#[ts(export)]
|
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
pub struct FilletData {
|
|
|
|
/// The radius of the fillet.
|
|
|
|
pub radius: f64,
|
|
|
|
/// The tags of the paths you want to fillet.
|
2024-03-26 19:07:16 -07:00
|
|
|
pub tags: Vec<EdgeReference>,
|
2024-03-05 11:52:45 -08:00
|
|
|
}
|
|
|
|
|
2024-06-24 14:45:07 -07:00
|
|
|
/// A tag or a uuid of an edge.
|
|
|
|
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Eq, Ord, PartialOrd, Hash)]
|
2024-03-05 11:52:45 -08:00
|
|
|
#[ts(export)]
|
|
|
|
#[serde(untagged)]
|
2024-03-26 19:07:16 -07:00
|
|
|
pub enum EdgeReference {
|
|
|
|
/// A uuid of an edge.
|
|
|
|
Uuid(uuid::Uuid),
|
2024-06-24 14:45:07 -07:00
|
|
|
/// A tag of an edge.
|
2024-07-27 22:56:46 -07:00
|
|
|
Tag(Box<TagIdentifier>),
|
2024-03-05 11:52:45 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Create fillets on tagged paths.
|
2024-08-12 16:53:24 -05:00
|
|
|
pub async fn fillet(args: Args) -> Result<KclValue, KclError> {
|
2024-07-28 00:30:04 -07:00
|
|
|
let (data, extrude_group, tag): (FilletData, Box<ExtrudeGroup>, Option<TagDeclarator>) =
|
|
|
|
args.get_data_and_extrude_group_and_tag()?;
|
2024-03-05 11:52:45 -08:00
|
|
|
|
2024-07-28 00:30:04 -07:00
|
|
|
let extrude_group = inner_fillet(data, extrude_group, tag, args).await?;
|
2024-08-12 16:53:24 -05:00
|
|
|
Ok(KclValue::ExtrudeGroup(extrude_group))
|
2024-03-05 11:52:45 -08:00
|
|
|
}
|
|
|
|
|
2024-08-06 20:27:26 -04:00
|
|
|
/// Blend a transitional edge along a tagged path, smoothing the sharp edge.
|
|
|
|
///
|
|
|
|
/// Fillet is similar in function and use to a chamfer, except
|
|
|
|
/// a chamfer will cut a sharp transition along an edge while fillet
|
|
|
|
/// will smoothly blend the transition.
|
2024-03-13 12:56:46 -07:00
|
|
|
///
|
|
|
|
/// ```no_run
|
2024-05-14 17:10:47 -07:00
|
|
|
/// const width = 20
|
|
|
|
/// const length = 10
|
|
|
|
/// const thickness = 1
|
|
|
|
/// const filletRadius = 2
|
|
|
|
///
|
|
|
|
/// const mountingPlateSketch = startSketchOn("XY")
|
|
|
|
/// |> startProfileAt([-width/2, -length/2], %)
|
2024-07-27 17:59:41 -07:00
|
|
|
/// |> lineTo([width/2, -length/2], %, $edge1)
|
|
|
|
/// |> lineTo([width/2, length/2], %, $edge2)
|
|
|
|
/// |> lineTo([-width/2, length/2], %, $edge3)
|
|
|
|
/// |> close(%, $edge4)
|
2024-05-14 17:10:47 -07:00
|
|
|
///
|
|
|
|
/// const mountingPlate = extrude(thickness, mountingPlateSketch)
|
|
|
|
/// |> fillet({
|
|
|
|
/// radius: filletRadius,
|
|
|
|
/// tags: [
|
2024-07-27 22:56:46 -07:00
|
|
|
/// getNextAdjacentEdge(edge1),
|
|
|
|
/// getNextAdjacentEdge(edge2),
|
|
|
|
/// getNextAdjacentEdge(edge3),
|
|
|
|
/// getNextAdjacentEdge(edge4)
|
2024-05-14 17:10:47 -07:00
|
|
|
/// ],
|
|
|
|
/// }, %)
|
2024-03-13 12:56:46 -07:00
|
|
|
/// ```
|
2024-03-05 11:52:45 -08:00
|
|
|
#[stdlib {
|
|
|
|
name = "fillet",
|
|
|
|
}]
|
|
|
|
async fn inner_fillet(
|
|
|
|
data: FilletData,
|
|
|
|
extrude_group: Box<ExtrudeGroup>,
|
2024-07-28 00:30:04 -07:00
|
|
|
tag: Option<TagDeclarator>,
|
2024-03-05 11:52:45 -08:00
|
|
|
args: Args,
|
|
|
|
) -> Result<Box<ExtrudeGroup>, KclError> {
|
|
|
|
// Check if tags contains any duplicate values.
|
|
|
|
let mut tags = data.tags.clone();
|
|
|
|
tags.sort();
|
|
|
|
tags.dedup();
|
|
|
|
if tags.len() != data.tags.len() {
|
|
|
|
return Err(KclError::Type(KclErrorDetails {
|
|
|
|
message: "Duplicate tags are not allowed.".to_string(),
|
|
|
|
source_ranges: vec![args.source_range],
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
2024-07-28 00:30:04 -07:00
|
|
|
let mut extrude_group = extrude_group.clone();
|
2024-08-12 17:56:45 -05:00
|
|
|
let mut edge_cuts = Vec::new();
|
2024-07-28 00:30:04 -07:00
|
|
|
for edge_tag in data.tags {
|
|
|
|
let edge_id = match edge_tag {
|
2024-03-26 19:07:16 -07:00
|
|
|
EdgeReference::Uuid(uuid) => uuid,
|
2024-07-27 22:56:46 -07:00
|
|
|
EdgeReference::Tag(edge_tag) => args.get_tag_engine_info(&edge_tag)?.id,
|
2024-03-05 11:52:45 -08:00
|
|
|
};
|
|
|
|
|
2024-06-23 19:19:24 -07:00
|
|
|
let id = uuid::Uuid::new_v4();
|
2024-06-22 14:31:37 -07:00
|
|
|
args.batch_end_cmd(
|
2024-06-23 19:19:24 -07:00
|
|
|
id,
|
2024-03-05 11:52:45 -08:00
|
|
|
ModelingCmd::Solid3DFilletEdge {
|
|
|
|
edge_id,
|
|
|
|
object_id: extrude_group.id,
|
|
|
|
radius: data.radius,
|
2024-03-26 19:07:16 -07:00
|
|
|
tolerance: DEFAULT_TOLERANCE, // We can let the user set this in the future.
|
2024-06-17 14:01:45 -04:00
|
|
|
cut_type: Some(kittycad::types::CutType::Fillet),
|
2024-03-05 11:52:45 -08:00
|
|
|
},
|
|
|
|
)
|
|
|
|
.await?;
|
2024-06-23 19:19:24 -07:00
|
|
|
|
2024-08-12 17:56:45 -05:00
|
|
|
edge_cuts.push(EdgeCut::Fillet {
|
2024-06-23 19:19:24 -07:00
|
|
|
id,
|
|
|
|
edge_id,
|
|
|
|
radius: data.radius,
|
2024-07-28 00:30:04 -07:00
|
|
|
tag: Box::new(tag.clone()),
|
2024-06-23 19:19:24 -07:00
|
|
|
});
|
2024-07-28 00:30:04 -07:00
|
|
|
|
|
|
|
if let Some(ref tag) = tag {
|
|
|
|
extrude_group.value.push(ExtrudeSurface::Fillet(FilletSurface {
|
|
|
|
face_id: edge_id,
|
|
|
|
tag: Some(tag.clone()),
|
|
|
|
geo_meta: GeoMeta {
|
|
|
|
id,
|
|
|
|
metadata: args.source_range.into(),
|
|
|
|
},
|
|
|
|
}));
|
|
|
|
}
|
2024-03-05 11:52:45 -08:00
|
|
|
}
|
|
|
|
|
2024-08-12 17:56:45 -05:00
|
|
|
extrude_group.edge_cuts = edge_cuts;
|
2024-06-23 19:19:24 -07:00
|
|
|
|
2024-03-05 11:52:45 -08:00
|
|
|
Ok(extrude_group)
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Get the opposite edge to the edge given.
|
2024-08-12 16:53:24 -05:00
|
|
|
pub async fn get_opposite_edge(args: Args) -> Result<KclValue, KclError> {
|
2024-07-27 22:56:46 -07:00
|
|
|
let tag: TagIdentifier = args.get_data()?;
|
2024-03-05 11:52:45 -08:00
|
|
|
|
2024-07-27 22:56:46 -07:00
|
|
|
let edge = inner_get_opposite_edge(tag, args.clone()).await?;
|
2024-08-12 16:53:24 -05:00
|
|
|
Ok(KclValue::UserVal(UserVal {
|
2024-03-05 11:52:45 -08:00
|
|
|
value: serde_json::to_value(edge).map_err(|e| {
|
|
|
|
KclError::Type(KclErrorDetails {
|
|
|
|
message: format!("Failed to convert Uuid to json: {}", e),
|
|
|
|
source_ranges: vec![args.source_range],
|
|
|
|
})
|
|
|
|
})?,
|
|
|
|
meta: vec![args.source_range.into()],
|
|
|
|
}))
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Get the opposite edge to the edge given.
|
2024-03-13 12:56:46 -07:00
|
|
|
///
|
|
|
|
/// ```no_run
|
2024-05-14 17:10:47 -07:00
|
|
|
/// const exampleSketch = startSketchOn('XZ')
|
|
|
|
/// |> startProfileAt([0, 0], %)
|
|
|
|
/// |> line([10, 0], %)
|
|
|
|
/// |> angledLine({
|
|
|
|
/// angle: 60,
|
|
|
|
/// length: 10,
|
|
|
|
/// }, %)
|
|
|
|
/// |> angledLine({
|
|
|
|
/// angle: 120,
|
|
|
|
/// length: 10,
|
|
|
|
/// }, %)
|
|
|
|
/// |> line([-10, 0], %)
|
|
|
|
/// |> angledLine({
|
|
|
|
/// angle: 240,
|
|
|
|
/// length: 10,
|
2024-07-27 17:59:41 -07:00
|
|
|
/// }, %, $referenceEdge)
|
2024-05-14 17:10:47 -07:00
|
|
|
/// |> close(%)
|
|
|
|
///
|
|
|
|
/// const example = extrude(5, exampleSketch)
|
|
|
|
/// |> fillet({
|
|
|
|
/// radius: 3,
|
2024-07-27 22:56:46 -07:00
|
|
|
/// tags: [getOppositeEdge(referenceEdge)],
|
2024-05-14 17:10:47 -07:00
|
|
|
/// }, %)
|
2024-03-13 12:56:46 -07:00
|
|
|
/// ```
|
2024-03-05 11:52:45 -08:00
|
|
|
#[stdlib {
|
|
|
|
name = "getOppositeEdge",
|
|
|
|
}]
|
2024-07-27 22:56:46 -07:00
|
|
|
async fn inner_get_opposite_edge(tag: TagIdentifier, args: Args) -> Result<Uuid, KclError> {
|
2024-05-15 18:38:30 +10:00
|
|
|
if args.ctx.is_mock {
|
|
|
|
return Ok(Uuid::new_v4());
|
|
|
|
}
|
2024-07-27 22:56:46 -07:00
|
|
|
let tagged_path = args.get_tag_engine_info(&tag)?;
|
2024-03-05 11:52:45 -08:00
|
|
|
|
2024-07-27 22:56:46 -07:00
|
|
|
let face_id = args.get_adjacent_face_to_tag(&tag, false).await?;
|
2024-03-05 11:52:45 -08:00
|
|
|
|
|
|
|
let resp = args
|
|
|
|
.send_modeling_cmd(
|
|
|
|
uuid::Uuid::new_v4(),
|
|
|
|
ModelingCmd::Solid3DGetOppositeEdge {
|
2024-07-27 22:56:46 -07:00
|
|
|
edge_id: tagged_path.id,
|
|
|
|
object_id: tagged_path.sketch_group,
|
2024-03-05 11:52:45 -08:00
|
|
|
face_id,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
.await?;
|
|
|
|
let kittycad::types::OkWebSocketResponseData::Modeling {
|
|
|
|
modeling_response: kittycad::types::OkModelingCmdResponse::Solid3DGetOppositeEdge { data: opposite_edge },
|
|
|
|
} = &resp
|
|
|
|
else {
|
|
|
|
return Err(KclError::Engine(KclErrorDetails {
|
|
|
|
message: format!("Solid3DGetOppositeEdge response was not as expected: {:?}", resp),
|
|
|
|
source_ranges: vec![args.source_range],
|
|
|
|
}));
|
|
|
|
};
|
|
|
|
|
|
|
|
Ok(opposite_edge.edge)
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Get the next adjacent edge to the edge given.
|
2024-08-12 16:53:24 -05:00
|
|
|
pub async fn get_next_adjacent_edge(args: Args) -> Result<KclValue, KclError> {
|
2024-07-27 22:56:46 -07:00
|
|
|
let tag: TagIdentifier = args.get_data()?;
|
2024-03-05 11:52:45 -08:00
|
|
|
|
2024-07-27 22:56:46 -07:00
|
|
|
let edge = inner_get_next_adjacent_edge(tag, args.clone()).await?;
|
2024-08-12 16:53:24 -05:00
|
|
|
Ok(KclValue::UserVal(UserVal {
|
2024-03-05 11:52:45 -08:00
|
|
|
value: serde_json::to_value(edge).map_err(|e| {
|
|
|
|
KclError::Type(KclErrorDetails {
|
|
|
|
message: format!("Failed to convert Uuid to json: {}", e),
|
|
|
|
source_ranges: vec![args.source_range],
|
|
|
|
})
|
|
|
|
})?,
|
|
|
|
meta: vec![args.source_range.into()],
|
|
|
|
}))
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Get the next adjacent edge to the edge given.
|
2024-03-13 12:56:46 -07:00
|
|
|
///
|
|
|
|
/// ```no_run
|
2024-05-14 17:10:47 -07:00
|
|
|
/// const exampleSketch = startSketchOn('XZ')
|
|
|
|
/// |> startProfileAt([0, 0], %)
|
|
|
|
/// |> line([10, 0], %)
|
|
|
|
/// |> angledLine({
|
|
|
|
/// angle: 60,
|
|
|
|
/// length: 10,
|
|
|
|
/// }, %)
|
|
|
|
/// |> angledLine({
|
|
|
|
/// angle: 120,
|
|
|
|
/// length: 10,
|
|
|
|
/// }, %)
|
|
|
|
/// |> line([-10, 0], %)
|
|
|
|
/// |> angledLine({
|
|
|
|
/// angle: 240,
|
|
|
|
/// length: 10,
|
2024-07-27 17:59:41 -07:00
|
|
|
/// }, %, $referenceEdge)
|
2024-05-14 17:10:47 -07:00
|
|
|
/// |> close(%)
|
|
|
|
///
|
|
|
|
/// const example = extrude(5, exampleSketch)
|
|
|
|
/// |> fillet({
|
|
|
|
/// radius: 3,
|
2024-07-27 22:56:46 -07:00
|
|
|
/// tags: [getNextAdjacentEdge(referenceEdge)],
|
2024-05-14 17:10:47 -07:00
|
|
|
/// }, %)
|
2024-03-13 12:56:46 -07:00
|
|
|
/// ```
|
2024-03-05 11:52:45 -08:00
|
|
|
#[stdlib {
|
|
|
|
name = "getNextAdjacentEdge",
|
|
|
|
}]
|
2024-07-27 22:56:46 -07:00
|
|
|
async fn inner_get_next_adjacent_edge(tag: TagIdentifier, args: Args) -> Result<Uuid, KclError> {
|
2024-05-15 18:38:30 +10:00
|
|
|
if args.ctx.is_mock {
|
|
|
|
return Ok(Uuid::new_v4());
|
|
|
|
}
|
2024-07-27 22:56:46 -07:00
|
|
|
let tagged_path = args.get_tag_engine_info(&tag)?;
|
2024-03-05 11:52:45 -08:00
|
|
|
|
2024-07-27 22:56:46 -07:00
|
|
|
let face_id = args.get_adjacent_face_to_tag(&tag, false).await?;
|
2024-03-05 11:52:45 -08:00
|
|
|
|
|
|
|
let resp = args
|
|
|
|
.send_modeling_cmd(
|
|
|
|
uuid::Uuid::new_v4(),
|
2024-03-27 11:26:06 -07:00
|
|
|
ModelingCmd::Solid3DGetPrevAdjacentEdge {
|
2024-07-27 22:56:46 -07:00
|
|
|
edge_id: tagged_path.id,
|
|
|
|
object_id: tagged_path.sketch_group,
|
2024-03-05 11:52:45 -08:00
|
|
|
face_id,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
.await?;
|
|
|
|
let kittycad::types::OkWebSocketResponseData::Modeling {
|
2024-03-27 11:26:06 -07:00
|
|
|
modeling_response: kittycad::types::OkModelingCmdResponse::Solid3DGetPrevAdjacentEdge { data: ajacent_edge },
|
2024-03-05 11:52:45 -08:00
|
|
|
} = &resp
|
|
|
|
else {
|
|
|
|
return Err(KclError::Engine(KclErrorDetails {
|
|
|
|
message: format!("Solid3DGetNextAdjacentEdge response was not as expected: {:?}", resp),
|
|
|
|
source_ranges: vec![args.source_range],
|
|
|
|
}));
|
|
|
|
};
|
|
|
|
|
|
|
|
ajacent_edge.edge.ok_or_else(|| {
|
|
|
|
KclError::Type(KclErrorDetails {
|
2024-06-24 14:45:07 -07:00
|
|
|
message: format!("No edge found next adjacent to tag: `{}`", tag.value),
|
2024-03-05 11:52:45 -08:00
|
|
|
source_ranges: vec![args.source_range],
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Get the previous adjacent edge to the edge given.
|
2024-08-12 16:53:24 -05:00
|
|
|
pub async fn get_previous_adjacent_edge(args: Args) -> Result<KclValue, KclError> {
|
2024-07-27 22:56:46 -07:00
|
|
|
let tag: TagIdentifier = args.get_data()?;
|
2024-03-05 11:52:45 -08:00
|
|
|
|
2024-07-27 22:56:46 -07:00
|
|
|
let edge = inner_get_previous_adjacent_edge(tag, args.clone()).await?;
|
2024-08-12 16:53:24 -05:00
|
|
|
Ok(KclValue::UserVal(UserVal {
|
2024-03-05 11:52:45 -08:00
|
|
|
value: serde_json::to_value(edge).map_err(|e| {
|
|
|
|
KclError::Type(KclErrorDetails {
|
|
|
|
message: format!("Failed to convert Uuid to json: {}", e),
|
|
|
|
source_ranges: vec![args.source_range],
|
|
|
|
})
|
|
|
|
})?,
|
|
|
|
meta: vec![args.source_range.into()],
|
|
|
|
}))
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Get the previous adjacent edge to the edge given.
|
2024-03-13 12:56:46 -07:00
|
|
|
///
|
|
|
|
/// ```no_run
|
2024-05-14 17:10:47 -07:00
|
|
|
/// const exampleSketch = startSketchOn('XZ')
|
|
|
|
/// |> startProfileAt([0, 0], %)
|
|
|
|
/// |> line([10, 0], %)
|
|
|
|
/// |> angledLine({
|
|
|
|
/// angle: 60,
|
|
|
|
/// length: 10,
|
|
|
|
/// }, %)
|
|
|
|
/// |> angledLine({
|
|
|
|
/// angle: 120,
|
|
|
|
/// length: 10,
|
|
|
|
/// }, %)
|
|
|
|
/// |> line([-10, 0], %)
|
|
|
|
/// |> angledLine({
|
|
|
|
/// angle: 240,
|
|
|
|
/// length: 10,
|
2024-07-27 17:59:41 -07:00
|
|
|
/// }, %, $referenceEdge)
|
2024-05-14 17:10:47 -07:00
|
|
|
/// |> close(%)
|
|
|
|
///
|
|
|
|
/// const example = extrude(5, exampleSketch)
|
|
|
|
/// |> fillet({
|
|
|
|
/// radius: 3,
|
2024-07-27 22:56:46 -07:00
|
|
|
/// tags: [getPreviousAdjacentEdge(referenceEdge)],
|
2024-05-14 17:10:47 -07:00
|
|
|
/// }, %)
|
2024-03-13 12:56:46 -07:00
|
|
|
/// ```
|
2024-03-05 11:52:45 -08:00
|
|
|
#[stdlib {
|
|
|
|
name = "getPreviousAdjacentEdge",
|
|
|
|
}]
|
2024-07-27 22:56:46 -07:00
|
|
|
async fn inner_get_previous_adjacent_edge(tag: TagIdentifier, args: Args) -> Result<Uuid, KclError> {
|
2024-05-15 18:38:30 +10:00
|
|
|
if args.ctx.is_mock {
|
|
|
|
return Ok(Uuid::new_v4());
|
|
|
|
}
|
2024-07-27 22:56:46 -07:00
|
|
|
let tagged_path = args.get_tag_engine_info(&tag)?;
|
2024-03-05 11:52:45 -08:00
|
|
|
|
2024-07-27 22:56:46 -07:00
|
|
|
let face_id = args.get_adjacent_face_to_tag(&tag, false).await?;
|
2024-03-05 11:52:45 -08:00
|
|
|
|
|
|
|
let resp = args
|
|
|
|
.send_modeling_cmd(
|
|
|
|
uuid::Uuid::new_v4(),
|
2024-03-27 11:26:06 -07:00
|
|
|
ModelingCmd::Solid3DGetNextAdjacentEdge {
|
2024-07-27 22:56:46 -07:00
|
|
|
edge_id: tagged_path.id,
|
|
|
|
object_id: tagged_path.sketch_group,
|
2024-03-05 11:52:45 -08:00
|
|
|
face_id,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
.await?;
|
|
|
|
let kittycad::types::OkWebSocketResponseData::Modeling {
|
2024-03-27 11:26:06 -07:00
|
|
|
modeling_response: kittycad::types::OkModelingCmdResponse::Solid3DGetNextAdjacentEdge { data: ajacent_edge },
|
2024-03-05 11:52:45 -08:00
|
|
|
} = &resp
|
|
|
|
else {
|
|
|
|
return Err(KclError::Engine(KclErrorDetails {
|
|
|
|
message: format!("Solid3DGetPrevAdjacentEdge response was not as expected: {:?}", resp),
|
|
|
|
source_ranges: vec![args.source_range],
|
|
|
|
}));
|
|
|
|
};
|
|
|
|
|
|
|
|
ajacent_edge.edge.ok_or_else(|| {
|
|
|
|
KclError::Type(KclErrorDetails {
|
2024-06-24 14:45:07 -07:00
|
|
|
message: format!("No edge found previous adjacent to tag: `{}`", tag.value),
|
2024-03-05 11:52:45 -08:00
|
|
|
source_ranges: vec![args.source_range],
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|