pub struct FrontendState { /* private fields */ }Implementations§
Source§impl FrontendState
impl FrontendState
pub fn new() -> Self
Sourcepub fn scene_graph(&self) -> &SceneGraph
pub fn scene_graph(&self) -> &SceneGraph
Get a reference to the scene graph
pub fn default_length_unit(&self) -> UnitLength
pub async fn create_sketch_checkpoint( &mut self, exec_outcome: ExecOutcome, ) -> Result<SketchCheckpointId>
Sourcepub async fn edit_segments_with_options(
&mut self,
ctx: &ExecutorContext,
version: Version,
sketch: ObjectId,
segments: Vec<ExistingSegmentCtor>,
options: EditSegmentsOptions,
) -> ExecResult<(SourceDelta, SceneGraphDelta)>
pub async fn edit_segments_with_options( &mut self, ctx: &ExecutorContext, version: Version, sketch: ObjectId, segments: Vec<ExistingSegmentCtor>, options: EditSegmentsOptions, ) -> ExecResult<(SourceDelta, SceneGraphDelta)>
Edit sketch segments with optional drag-solve overrides.
Drag anchors add hidden fixed cursor points and constrain the referenced segment bodies to pass through them, which lets body drags use the same anchor model without pinning all child points. Preview callers disable solver writeback so solved geometry can be returned without feeding every solver value back into KCL.
Sourcepub async fn edit_distance_constraint_label_position_with_options(
&mut self,
ctx: &ExecutorContext,
version: Version,
sketch: ObjectId,
constraint_id: ObjectId,
label_position: Point2d<Number>,
options: EditDistanceConstraintLabelPositionOptions,
) -> ExecResult<(SourceDelta, SceneGraphDelta)>
pub async fn edit_distance_constraint_label_position_with_options( &mut self, ctx: &ExecutorContext, version: Version, sketch: ObjectId, constraint_id: ObjectId, label_position: Point2d<Number>, options: EditDistanceConstraintLabelPositionOptions, ) -> ExecResult<(SourceDelta, SceneGraphDelta)>
Edit a distance-constraint label position with optional solver writeback.
Drag previews set commit_solved_initial_guesses to false so label
placement can be previewed against solved geometry without advancing
persistent KCL state until drag completion.
pub async fn restore_sketch_checkpoint( &mut self, checkpoint_id: SketchCheckpointId, ) -> Result<RestoreSketchCheckpointOutcome>
pub fn clear_sketch_checkpoints(&mut self)
Source§impl FrontendState
impl FrontendState
pub async fn hack_set_program( &mut self, ctx: &ExecutorContext, program: Program, ) -> ExecResult<SetProgramOutcome>
Sourcepub async fn engine_execute(
&mut self,
ctx: &ExecutorContext,
program: Program,
) -> Result<SceneGraphDelta, KclErrorWithOutputs>
pub async fn engine_execute( &mut self, ctx: &ExecutorContext, program: Program, ) -> Result<SceneGraphDelta, KclErrorWithOutputs>
Decorate engine execution such that our state is updated and the scene graph is added to the return.
Trait Implementations§
Source§impl Clone for FrontendState
impl Clone for FrontendState
Source§fn clone(&self) -> FrontendState
fn clone(&self) -> FrontendState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FrontendState
impl Debug for FrontendState
Source§impl Default for FrontendState
impl Default for FrontendState
Source§impl SketchApi for FrontendState
impl SketchApi for FrontendState
Source§async fn batch_split_segment_operations(
&mut self,
ctx: &ExecutorContext,
_version: Version,
sketch: ObjectId,
edit_segments: Vec<ExistingSegmentCtor>,
add_constraints: Vec<Constraint>,
delete_constraint_ids: Vec<ObjectId>,
_new_segment_info: NewSegmentInfo,
) -> ExecResult<(SourceDelta, SceneGraphDelta)>
async fn batch_split_segment_operations( &mut self, ctx: &ExecutorContext, _version: Version, sketch: ObjectId, edit_segments: Vec<ExistingSegmentCtor>, add_constraints: Vec<Constraint>, delete_constraint_ids: Vec<ObjectId>, _new_segment_info: NewSegmentInfo, ) -> ExecResult<(SourceDelta, SceneGraphDelta)>
Splitting a segment means creating a new segment, editing the old one, and then migrating a bunch of the constraints from the original segment to the new one (i.e. deleting them and re-adding them on the other segment).
To keep this efficient we require as few executions as possible: we create the new segment first (to get its id), then do all edits and new constraints, and do all deletes at the end (since deletes invalidate ids).
Source§async fn execute_mock(
&mut self,
ctx: &ExecutorContext,
_version: Version,
sketch: ObjectId,
) -> ExecResult<(SourceDelta, SceneGraphDelta)>
async fn execute_mock( &mut self, ctx: &ExecutorContext, _version: Version, sketch: ObjectId, ) -> ExecResult<(SourceDelta, SceneGraphDelta)>
async fn new_sketch( &mut self, ctx: &ExecutorContext, _project: ProjectId, _file: FileId, _version: Version, args: SketchCtor, ) -> ExecResult<(SourceDelta, SceneGraphDelta, ObjectId)>
async fn edit_sketch( &mut self, ctx: &ExecutorContext, _project: ProjectId, _file: FileId, _version: Version, sketch: ObjectId, ) -> ExecResult<SceneGraphDelta>
async fn exit_sketch( &mut self, ctx: &ExecutorContext, _version: Version, sketch: ObjectId, ) -> ExecResult<SceneGraph>
async fn delete_sketch( &mut self, ctx: &ExecutorContext, _version: Version, sketch: ObjectId, ) -> ExecResult<(SourceDelta, SceneGraphDelta)>
async fn add_segment( &mut self, ctx: &ExecutorContext, _version: Version, sketch: ObjectId, segment: SegmentCtor, _label: Option<String>, ) -> ExecResult<(SourceDelta, SceneGraphDelta)>
async fn edit_segments( &mut self, ctx: &ExecutorContext, _version: Version, sketch: ObjectId, segments: Vec<ExistingSegmentCtor>, ) -> ExecResult<(SourceDelta, SceneGraphDelta)>
async fn delete_objects( &mut self, ctx: &ExecutorContext, _version: Version, sketch: ObjectId, constraint_ids: Vec<ObjectId>, segment_ids: Vec<ObjectId>, ) -> ExecResult<(SourceDelta, SceneGraphDelta)>
async fn add_constraint( &mut self, ctx: &ExecutorContext, _version: Version, sketch: ObjectId, constraint: Constraint, ) -> ExecResult<(SourceDelta, SceneGraphDelta)>
async fn chain_segment( &mut self, ctx: &ExecutorContext, version: Version, sketch: ObjectId, previous_segment_end_point_id: ObjectId, segment: SegmentCtor, _label: Option<String>, ) -> ExecResult<(SourceDelta, SceneGraphDelta)>
async fn edit_constraint( &mut self, ctx: &ExecutorContext, _version: Version, sketch: ObjectId, constraint_id: ObjectId, value_expression: String, ) -> ExecResult<(SourceDelta, SceneGraphDelta)>
async fn edit_distance_constraint_label_position( &mut self, ctx: &ExecutorContext, _version: Version, sketch: ObjectId, constraint_id: ObjectId, label_position: Point2d<Number>, anchor_segment_ids: Vec<ObjectId>, ) -> ExecResult<(SourceDelta, SceneGraphDelta)>
Source§async fn batch_tail_cut_operations(
&mut self,
ctx: &ExecutorContext,
_version: Version,
sketch: ObjectId,
edit_segments: Vec<ExistingSegmentCtor>,
add_constraints: Vec<Constraint>,
delete_constraint_ids: Vec<ObjectId>,
additional_edited_segment_ids: Vec<ObjectId>,
) -> ExecResult<(SourceDelta, SceneGraphDelta)>
async fn batch_tail_cut_operations( &mut self, ctx: &ExecutorContext, _version: Version, sketch: ObjectId, edit_segments: Vec<ExistingSegmentCtor>, add_constraints: Vec<Constraint>, delete_constraint_ids: Vec<ObjectId>, additional_edited_segment_ids: Vec<ObjectId>, ) -> ExecResult<(SourceDelta, SceneGraphDelta)>
Auto Trait Implementations§
impl Freeze for FrontendState
impl !RefUnwindSafe for FrontendState
impl Send for FrontendState
impl Sync for FrontendState
impl Unpin for FrontendState
impl UnsafeUnpin for FrontendState
impl !UnwindSafe for FrontendState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.