* Revert "Revert multi-profile (#4812)"
This reverts commit efe8089b08
.
* fix poor 1000ms wait UX
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores)
* trigger CI
* Add Rust side artifacts for startSketchOn face or plane (#4834)
* Add Rust side artifacts for startSketchOn face or plane
* move ast digging
---------
Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch>
* lint
* lint
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-macos-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-16-cores)
* trigger CI
* chore: disabled file watcher which prevents faster file write (#4835)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* partial fixes
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Trigger CI
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Trigger CI
* Fix up all the tests
* Fix partial execution
* wip
* WIP
* wip
* rust changes to make three point confrom to same as others since we're not ready with name params yet
* most of the fix for 3 point circle
* get overlays working for circle three point
* fmt
* fix types
* cargo fmt
* add face codef ref for walls and caps
* fix sketch on face after updates to rust side artifact graph
* some things needed for multi-profile tests
* bad attempts at fixing rust
* more
* more
* fix rust
* more rust fixes
* overlay fix
* remove duplicate test
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* lint and typing
* maybe fix a unit test
* small thing
* fix circ dep
* fix unit test
* fix some tests
* fix sweep point-and-click test
* fix more tests and add a fix me
* fix more tests
* fix electron specific test
* tsc
* more test tweaks
* update docs
* commint snaps?
* is clippy happy now?
* clippy again
* test works now without me changing anything big-fixed-itself
* small bug
* make three point have cross hair to make it consistent with othe rtools
* fix up state diagram
* fmt
* add draft point for first click of three point circ
* 1 test for three point circle
* 2 test for three point circle
* clean up
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* remove bad doc comment
* remove test skip
* remove onboarding test changes
* Update src/lang/modifyAst.ts
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
* Update output from simulation tests
* Fix to use correct source ranges
This also reduces cloning.
* Change back to skipping face cap none and both
* Update output after changing back to skipping none and both
* Fix clippy warning
* fix profile start snap bug
* add path ids to cap
* fix going into edit sketch
* make other startSketchOn's work
* fix snapshot test
* explain function name
* Update src/lib/rectangleTool.ts
Co-authored-by: Frank Noirot <frank@zoo.dev>
* rename error
* remove file tree from diff
* Update src/clientSideScene/segments.ts
Co-authored-by: Frank Noirot <frank@zoo.dev>
* nit
* Prevent double write to KCL code on revolve
* Update output after adding cap-to-path graph edge
* Fix edit/select sketch-on-cap via feature tree
* clean up for face codeRef
* fix changing tools part way through circle/rect tools
* fix delete of circle profile
* fix close profiles
* fix closing profile bug (tangentArcTo being ignored)
* remove stale comment
* Delete paths associated with sketch when the sketch plane is deleted
* Add support for deleting sketches on caps (not walls)
* get delet working for walls
* make delet of extrusions work for multi profile
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Delete the sketch statement too on the cap and wall cases
* Don't write to file in `split-sketch-pipe-if-needed` unless necessary
* Don't wait for file write to complete within `updateEditorWithAstAndWriteToFile`
It is already debounced internally. If we await it, we will have to wait for a debounced timeout
* docs
* fix circ dep
* tsc
* fix selection enter sketch weirdness
* test fixes
* comment out and fixme for delete related tests
* add skip wins
* try and get last test to pass
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
Co-authored-by: Kevin Nadro <nadr0@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
Co-authored-by: 49lf <ircsurfer33@gmail.com>
Co-authored-by: Frank Noirot <frank@zoo.dev>
Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>
828 lines
26 KiB
TypeScript
828 lines
26 KiB
TypeScript
import { CustomIconName } from 'components/CustomIcon'
|
|
import { DEV } from 'env'
|
|
import { commandBarActor } from 'machines/commandBarMachine'
|
|
import {
|
|
isEditingExistingSketch,
|
|
modelingMachine,
|
|
pipeHasCircle,
|
|
} from 'machines/modelingMachine'
|
|
import { IS_NIGHTLY_OR_DEBUG } from 'routes/Settings'
|
|
import { EventFrom, StateFrom } from 'xstate'
|
|
|
|
export type ToolbarModeName = 'modeling' | 'sketching'
|
|
|
|
type ToolbarMode = {
|
|
check: (state: StateFrom<typeof modelingMachine>) => boolean
|
|
items: (ToolbarItem | ToolbarItem[] | 'break')[]
|
|
}
|
|
|
|
export interface ToolbarItemCallbackProps {
|
|
modelingState: StateFrom<typeof modelingMachine>
|
|
modelingSend: (event: EventFrom<typeof modelingMachine>) => void
|
|
sketchPathId: string | false
|
|
}
|
|
|
|
export type ToolbarItem = {
|
|
id: string
|
|
onClick: (props: ToolbarItemCallbackProps) => void
|
|
icon?: CustomIconName
|
|
status: 'available' | 'unavailable' | 'kcl-only'
|
|
disabled?: (state: StateFrom<typeof modelingMachine>) => boolean
|
|
disableHotkey?: (state: StateFrom<typeof modelingMachine>) => boolean
|
|
title: string | ((props: ToolbarItemCallbackProps) => string)
|
|
showTitle?: boolean
|
|
hotkey?:
|
|
| string
|
|
| ((state: StateFrom<typeof modelingMachine>) => string | string[])
|
|
description: string
|
|
links: { label: string; url: string }[]
|
|
isActive?: (state: StateFrom<typeof modelingMachine>) => boolean
|
|
disabledReason?:
|
|
| string
|
|
| ((state: StateFrom<typeof modelingMachine>) => string | undefined)
|
|
}
|
|
|
|
export type ToolbarItemResolved = Omit<
|
|
ToolbarItem,
|
|
'disabled' | 'disableHotkey' | 'hotkey' | 'isActive' | 'title'
|
|
> & {
|
|
title: string
|
|
disabled?: boolean
|
|
disableHotkey?: boolean
|
|
hotkey?: string | string[]
|
|
isActive?: boolean
|
|
}
|
|
|
|
export const toolbarConfig: Record<ToolbarModeName, ToolbarMode> = {
|
|
modeling: {
|
|
check: (state) =>
|
|
!(state.matches('Sketch') || state.matches('Sketch no face')),
|
|
items: [
|
|
{
|
|
id: 'sketch',
|
|
onClick: ({ modelingSend, sketchPathId }) =>
|
|
!sketchPathId
|
|
? modelingSend({
|
|
type: 'Enter sketch',
|
|
data: { forceNewSketch: true },
|
|
})
|
|
: modelingSend({ type: 'Enter sketch' }),
|
|
icon: 'sketch',
|
|
status: 'available',
|
|
title: ({ sketchPathId }) =>
|
|
sketchPathId ? 'Edit Sketch' : 'Start Sketch',
|
|
showTitle: true,
|
|
hotkey: 'S',
|
|
description: 'Start drawing a 2D sketch',
|
|
links: [
|
|
{ label: 'KCL docs', url: 'https://zoo.dev/docs/kcl/startSketchOn' },
|
|
],
|
|
},
|
|
'break',
|
|
{
|
|
id: 'extrude',
|
|
onClick: () =>
|
|
commandBarActor.send({
|
|
type: 'Find and select command',
|
|
data: { name: 'Extrude', groupId: 'modeling' },
|
|
}),
|
|
icon: 'extrude',
|
|
status: 'available',
|
|
title: 'Extrude',
|
|
hotkey: 'E',
|
|
description: 'Pull a sketch into 3D along its normal or perpendicular.',
|
|
links: [{ label: 'KCL docs', url: 'https://zoo.dev/docs/kcl/extrude' }],
|
|
},
|
|
{
|
|
id: 'revolve',
|
|
onClick: () =>
|
|
commandBarActor.send({
|
|
type: 'Find and select command',
|
|
data: { name: 'Revolve', groupId: 'modeling' },
|
|
}),
|
|
icon: 'revolve',
|
|
status: 'available',
|
|
title: 'Revolve',
|
|
hotkey: 'R',
|
|
description:
|
|
'Create a 3D body by rotating a sketch region about an axis.',
|
|
links: [
|
|
{ label: 'KCL docs', url: 'https://zoo.dev/docs/kcl/revolve' },
|
|
{
|
|
label: 'KCL example',
|
|
url: 'https://zoo.dev/docs/kcl-samples/ball-bearing',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: 'sweep',
|
|
onClick: () =>
|
|
commandBarActor.send({
|
|
type: 'Find and select command',
|
|
data: { name: 'Sweep', groupId: 'modeling' },
|
|
}),
|
|
icon: 'sweep',
|
|
status: 'available',
|
|
title: 'Sweep',
|
|
hotkey: 'W',
|
|
description:
|
|
'Create a 3D body by moving a sketch region along an arbitrary path.',
|
|
links: [
|
|
{
|
|
label: 'KCL docs',
|
|
url: 'https://zoo.dev/docs/kcl/sweep',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: 'loft',
|
|
onClick: () =>
|
|
commandBarActor.send({
|
|
type: 'Find and select command',
|
|
data: { name: 'Loft', groupId: 'modeling' },
|
|
}),
|
|
icon: 'loft',
|
|
status: 'available',
|
|
title: 'Loft',
|
|
hotkey: 'L',
|
|
description:
|
|
'Create a 3D body by blending between two or more sketches.',
|
|
links: [
|
|
{
|
|
label: 'KCL docs',
|
|
url: 'https://zoo.dev/docs/kcl/loft',
|
|
},
|
|
],
|
|
},
|
|
'break',
|
|
{
|
|
id: 'fillet3d',
|
|
onClick: () =>
|
|
commandBarActor.send({
|
|
type: 'Find and select command',
|
|
data: { name: 'Fillet', groupId: 'modeling' },
|
|
}),
|
|
icon: 'fillet3d',
|
|
status: DEV || IS_NIGHTLY_OR_DEBUG ? 'available' : 'kcl-only',
|
|
title: 'Fillet',
|
|
hotkey: 'F',
|
|
description: 'Round the edges of a 3D solid.',
|
|
links: [{ label: 'KCL docs', url: 'https://zoo.dev/docs/kcl/fillet' }],
|
|
},
|
|
{
|
|
id: 'chamfer3d',
|
|
onClick: () =>
|
|
commandBarActor.send({
|
|
type: 'Find and select command',
|
|
data: { name: 'Chamfer', groupId: 'modeling' },
|
|
}),
|
|
icon: 'chamfer3d',
|
|
status: DEV || IS_NIGHTLY_OR_DEBUG ? 'available' : 'kcl-only',
|
|
title: 'Chamfer',
|
|
hotkey: 'C',
|
|
description: 'Bevel the edges of a 3D solid.',
|
|
links: [{ label: 'KCL docs', url: 'https://zoo.dev/docs/kcl/chamfer' }],
|
|
},
|
|
{
|
|
id: 'shell',
|
|
onClick: () => {
|
|
commandBarActor.send({
|
|
type: 'Find and select command',
|
|
data: { name: 'Shell', groupId: 'modeling' },
|
|
})
|
|
},
|
|
icon: 'shell',
|
|
status: 'available',
|
|
title: 'Shell',
|
|
description: 'Hollow out a 3D solid.',
|
|
links: [{ label: 'KCL docs', url: 'https://zoo.dev/docs/kcl/shell' }],
|
|
},
|
|
{
|
|
id: 'hole',
|
|
onClick: () => console.error('Hole not yet implemented'),
|
|
icon: 'hole',
|
|
status: 'unavailable',
|
|
title: 'Hole',
|
|
description: 'Create a hole in a 3D solid.',
|
|
links: [],
|
|
},
|
|
'break',
|
|
[
|
|
{
|
|
id: 'boolean-union',
|
|
onClick: () => console.error('Boolean union not yet implemented'),
|
|
icon: 'booleanUnion',
|
|
status: 'unavailable',
|
|
title: 'Union',
|
|
hotkey: 'Shift + B U',
|
|
description: 'Combine two or more solids into a single solid.',
|
|
links: [
|
|
{
|
|
label: 'GitHub discussion',
|
|
url: 'https://github.com/KittyCAD/modeling-app/discussions/509',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: 'boolean-subtract',
|
|
onClick: () => console.error('Boolean subtract not yet implemented'),
|
|
icon: 'booleanSubtract',
|
|
status: 'unavailable',
|
|
title: 'Subtract',
|
|
hotkey: 'Shift + B S',
|
|
description: 'Subtract one solid from another.',
|
|
links: [
|
|
{
|
|
label: 'GitHub discussion',
|
|
url: 'https://github.com/KittyCAD/modeling-app/discussions/510',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: 'boolean-intersect',
|
|
onClick: () => console.error('Boolean intersect not yet implemented'),
|
|
icon: 'booleanIntersect',
|
|
status: 'unavailable',
|
|
title: 'Intersect',
|
|
hotkey: 'Shift + B I',
|
|
description: 'Create a solid from the intersection of two solids.',
|
|
links: [
|
|
{
|
|
label: 'GitHub discussion',
|
|
url: 'https://github.com/KittyCAD/modeling-app/discussions/511',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
'break',
|
|
[
|
|
{
|
|
id: 'plane-offset',
|
|
onClick: () => {
|
|
commandBarActor.send({
|
|
type: 'Find and select command',
|
|
data: { name: 'Offset plane', groupId: 'modeling' },
|
|
})
|
|
},
|
|
hotkey: 'O',
|
|
icon: 'plane',
|
|
status: 'available',
|
|
title: 'Offset plane',
|
|
description: 'Create a plane parallel to an existing plane.',
|
|
links: [
|
|
{
|
|
label: 'KCL docs',
|
|
url: 'https://zoo.dev/docs/kcl/offsetPlane',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: 'plane-points',
|
|
onClick: () =>
|
|
console.error('Plane through points not yet implemented'),
|
|
status: 'unavailable',
|
|
title: '3-point plane',
|
|
description: 'Create a plane from three points.',
|
|
links: [],
|
|
},
|
|
],
|
|
{
|
|
id: 'helix',
|
|
onClick: () => {
|
|
commandBarActor.send({
|
|
type: 'Find and select command',
|
|
data: { name: 'Helix', groupId: 'modeling' },
|
|
})
|
|
},
|
|
hotkey: 'H',
|
|
icon: 'helix',
|
|
status: DEV || IS_NIGHTLY_OR_DEBUG ? 'available' : 'kcl-only',
|
|
title: 'Helix',
|
|
description: 'Create a helix or spiral in 3D about an axis.',
|
|
links: [{ label: 'KCL docs', url: 'https://zoo.dev/docs/kcl/helix' }],
|
|
},
|
|
'break',
|
|
[
|
|
{
|
|
id: 'text-to-cad',
|
|
onClick: () =>
|
|
commandBarActor.send({
|
|
type: 'Find and select command',
|
|
data: { name: 'Text-to-CAD', groupId: 'modeling' },
|
|
}),
|
|
icon: 'sparkles',
|
|
status: 'available',
|
|
title: 'Text-to-CAD',
|
|
description: 'Generate geometry from a text prompt.',
|
|
links: [
|
|
{
|
|
label: 'API docs',
|
|
url: 'https://zoo.dev/docs/api/ml/generate-a-cad-model-from-text',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: 'prompt-to-edit',
|
|
onClick: () =>
|
|
commandBarActor.send({
|
|
type: 'Find and select command',
|
|
data: { name: 'Prompt-to-edit', groupId: 'modeling' },
|
|
}),
|
|
icon: 'sparkles',
|
|
status: 'available',
|
|
title: 'Prompt-to-Edit',
|
|
description: 'Edit geometry based on a text prompt.',
|
|
links: [],
|
|
},
|
|
],
|
|
],
|
|
},
|
|
sketching: {
|
|
check: (state) =>
|
|
state.matches('Sketch') || state.matches('Sketch no face'),
|
|
items: [
|
|
{
|
|
id: 'sketch-exit',
|
|
onClick: ({ modelingSend }) =>
|
|
modelingSend({
|
|
type: 'Cancel',
|
|
}),
|
|
disableHotkey: (state) =>
|
|
!(
|
|
state.matches({ Sketch: 'SketchIdle' }) ||
|
|
state.matches('Sketch no face')
|
|
),
|
|
icon: 'arrowLeft',
|
|
status: 'available',
|
|
title: 'Exit sketch',
|
|
showTitle: true,
|
|
hotkey: 'Esc',
|
|
description: 'Exit the current sketch',
|
|
links: [],
|
|
},
|
|
'break',
|
|
{
|
|
id: 'line',
|
|
onClick: ({ modelingState, modelingSend }) => {
|
|
modelingSend({
|
|
type: 'change tool',
|
|
data: {
|
|
tool: !modelingState.matches({ Sketch: 'Line tool' })
|
|
? 'line'
|
|
: 'none',
|
|
},
|
|
})
|
|
},
|
|
icon: 'line',
|
|
status: 'available',
|
|
disabled: (state) =>
|
|
state.matches('Sketch no face') ||
|
|
state.matches({
|
|
Sketch: { 'Rectangle tool': 'Awaiting second corner' },
|
|
}) ||
|
|
state.matches({
|
|
Sketch: { 'Circle tool': 'Awaiting Radius' },
|
|
}),
|
|
title: 'Line',
|
|
hotkey: (state) =>
|
|
state.matches({ Sketch: 'Line tool' }) ? ['Esc', 'L'] : 'L',
|
|
description: 'Start drawing straight lines',
|
|
links: [],
|
|
isActive: (state) => state.matches({ Sketch: 'Line tool' }),
|
|
},
|
|
[
|
|
{
|
|
id: 'tangential-arc',
|
|
onClick: ({ modelingState, modelingSend }) =>
|
|
modelingSend({
|
|
type: 'change tool',
|
|
data: {
|
|
tool: !modelingState.matches({ Sketch: 'Tangential arc to' })
|
|
? 'tangentialArc'
|
|
: 'none',
|
|
},
|
|
}),
|
|
icon: 'arc',
|
|
status: 'available',
|
|
disabled: (state) =>
|
|
(!isEditingExistingSketch(state.context) &&
|
|
!state.matches({ Sketch: 'Tangential arc to' })) ||
|
|
pipeHasCircle(state.context),
|
|
disabledReason: (state) =>
|
|
!isEditingExistingSketch(state.context) &&
|
|
!state.matches({ Sketch: 'Tangential arc to' })
|
|
? "Cannot start a tangential arc because there's no previous line to be tangential to. Try drawing a line first or selecting an existing sketch to edit."
|
|
: undefined,
|
|
title: 'Tangential Arc',
|
|
hotkey: (state) =>
|
|
state.matches({ Sketch: 'Tangential arc to' }) ? ['Esc', 'A'] : 'A',
|
|
description: 'Start drawing an arc tangent to the current segment',
|
|
links: [],
|
|
isActive: (state) => state.matches({ Sketch: 'Tangential arc to' }),
|
|
},
|
|
{
|
|
id: 'three-point-arc',
|
|
onClick: () => console.error('Three-point arc not yet implemented'),
|
|
icon: 'arc',
|
|
status: 'unavailable',
|
|
title: 'Three-point Arc',
|
|
showTitle: false,
|
|
description: 'Draw a circular arc defined by three points',
|
|
links: [
|
|
{
|
|
label: 'GitHub issue',
|
|
url: 'https://github.com/KittyCAD/modeling-app/issues/1659',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
{
|
|
id: 'spline',
|
|
onClick: () => console.error('Spline not yet implemented'),
|
|
icon: 'spline',
|
|
status: 'unavailable',
|
|
title: 'Spline',
|
|
showTitle: false,
|
|
description: 'Draw a spline curve through a series of points',
|
|
links: [],
|
|
},
|
|
'break',
|
|
[
|
|
{
|
|
id: 'circle-center',
|
|
onClick: ({ modelingState, modelingSend }) =>
|
|
modelingSend({
|
|
type: 'change tool',
|
|
data: {
|
|
tool: !modelingState.matches({ Sketch: 'Circle tool' })
|
|
? 'circle'
|
|
: 'none',
|
|
},
|
|
}),
|
|
icon: 'circle',
|
|
status: 'available',
|
|
title: 'Center circle',
|
|
disabled: (state) => state.matches('Sketch no face'),
|
|
isActive: (state) =>
|
|
state.matches({ Sketch: 'Circle tool' }) ||
|
|
state.matches({ Sketch: 'Circle three point tool' }),
|
|
hotkey: (state) =>
|
|
state.matches({ Sketch: 'Circle tool' }) ? ['Esc', 'C'] : 'C',
|
|
showTitle: false,
|
|
description: 'Start drawing a circle from its center',
|
|
links: [],
|
|
},
|
|
{
|
|
id: 'circle-three-points',
|
|
onClick: ({ modelingState, modelingSend }) =>
|
|
modelingSend({
|
|
type: 'change tool',
|
|
data: {
|
|
tool: !modelingState.matches({
|
|
Sketch: 'Circle three point tool',
|
|
})
|
|
? 'circleThreePointNeo'
|
|
: 'none',
|
|
},
|
|
}),
|
|
icon: 'circle',
|
|
status: 'available',
|
|
title: '3-point circle',
|
|
showTitle: false,
|
|
description: 'Draw a circle defined by three points',
|
|
links: [],
|
|
},
|
|
],
|
|
[
|
|
{
|
|
id: 'corner-rectangle',
|
|
onClick: ({ modelingState, modelingSend }) =>
|
|
modelingSend({
|
|
type: 'change tool',
|
|
data: {
|
|
tool: !modelingState.matches({ Sketch: 'Rectangle tool' })
|
|
? 'rectangle'
|
|
: 'none',
|
|
},
|
|
}),
|
|
icon: 'rectangle',
|
|
status: 'available',
|
|
disabled: (state) => state.matches('Sketch no face'),
|
|
title: 'Corner rectangle',
|
|
hotkey: (state) =>
|
|
state.matches({ Sketch: 'Rectangle tool' }) ? ['Esc', 'R'] : 'R',
|
|
description: 'Start drawing a rectangle',
|
|
links: [],
|
|
isActive: (state) => state.matches({ Sketch: 'Rectangle tool' }),
|
|
},
|
|
{
|
|
id: 'center-rectangle',
|
|
onClick: ({ modelingState, modelingSend }) =>
|
|
modelingSend({
|
|
type: 'change tool',
|
|
data: {
|
|
tool: !modelingState.matches({
|
|
Sketch: 'Center Rectangle tool',
|
|
})
|
|
? 'center rectangle'
|
|
: 'none',
|
|
},
|
|
}),
|
|
icon: 'arc',
|
|
status: 'available',
|
|
disabled: (state) => state.matches('Sketch no face'),
|
|
title: 'Center rectangle',
|
|
hotkey: (state) =>
|
|
state.matches({ Sketch: 'Center Rectangle tool' })
|
|
? ['Esc', 'C']
|
|
: 'C',
|
|
description: 'Start drawing a rectangle from its center',
|
|
links: [],
|
|
isActive: (state) => {
|
|
return state.matches({ Sketch: 'Center Rectangle tool' })
|
|
},
|
|
},
|
|
],
|
|
{
|
|
id: 'polygon',
|
|
onClick: () => console.error('Polygon not yet implemented'),
|
|
icon: 'polygon',
|
|
status: 'unavailable',
|
|
title: 'Polygon',
|
|
showTitle: false,
|
|
description: 'Draw a polygon with a specified number of sides',
|
|
links: [],
|
|
},
|
|
{
|
|
id: 'text',
|
|
onClick: () => console.error('Text not yet implemented'),
|
|
icon: 'text',
|
|
status: 'unavailable',
|
|
title: 'Text',
|
|
showTitle: false,
|
|
description: 'Add text to your sketch as geometry.',
|
|
links: [],
|
|
},
|
|
'break',
|
|
{
|
|
id: 'mirror',
|
|
onClick: () => console.error('Mirror not yet implemented'),
|
|
icon: 'mirror',
|
|
status: 'unavailable',
|
|
title: 'Mirror',
|
|
showTitle: false,
|
|
description: 'Mirror sketch entities about a line or axis',
|
|
links: [],
|
|
},
|
|
[
|
|
{
|
|
id: 'constraint-length',
|
|
disabled: (state) => !state.matches({ Sketch: 'SketchIdle' }),
|
|
onClick: () =>
|
|
commandBarActor.send({
|
|
type: 'Find and select command',
|
|
data: {
|
|
name: 'Constrain length',
|
|
groupId: 'modeling',
|
|
},
|
|
}),
|
|
icon: 'dimension',
|
|
status: 'available',
|
|
title: 'Length',
|
|
showTitle: false,
|
|
description: 'Constrain the length of a straight segment',
|
|
links: [],
|
|
},
|
|
{
|
|
id: 'constraint-angle',
|
|
disabled: (state) =>
|
|
!(
|
|
state.matches({ Sketch: 'SketchIdle' }) &&
|
|
state.can({ type: 'Constrain angle' })
|
|
),
|
|
onClick: ({ modelingSend }) =>
|
|
modelingSend({ type: 'Constrain angle' }),
|
|
status: 'available',
|
|
title: 'Angle',
|
|
showTitle: false,
|
|
description: 'Constrain the angle between two segments',
|
|
links: [],
|
|
},
|
|
{
|
|
id: 'constraint-vertical',
|
|
disabled: (state) =>
|
|
!(
|
|
state.matches({ Sketch: 'SketchIdle' }) &&
|
|
state.can({ type: 'Make segment vertical' })
|
|
),
|
|
onClick: ({ modelingSend }) =>
|
|
modelingSend({ type: 'Make segment vertical' }),
|
|
status: 'available',
|
|
title: 'Vertical',
|
|
showTitle: false,
|
|
description:
|
|
'Constrain a straight segment to be vertical relative to the sketch',
|
|
links: [],
|
|
},
|
|
{
|
|
id: 'constraint-horizontal',
|
|
disabled: (state) =>
|
|
!(
|
|
state.matches({ Sketch: 'SketchIdle' }) &&
|
|
state.can({ type: 'Make segment horizontal' })
|
|
),
|
|
onClick: ({ modelingSend }) =>
|
|
modelingSend({ type: 'Make segment horizontal' }),
|
|
status: 'available',
|
|
title: 'Horizontal',
|
|
showTitle: false,
|
|
description:
|
|
'Constrain a straight segment to be horizontal relative to the sketch',
|
|
links: [],
|
|
},
|
|
{
|
|
id: 'constraint-parallel',
|
|
disabled: (state) =>
|
|
!(
|
|
state.matches({ Sketch: 'SketchIdle' }) &&
|
|
state.can({ type: 'Constrain parallel' })
|
|
),
|
|
onClick: ({ modelingSend }) =>
|
|
modelingSend({ type: 'Constrain parallel' }),
|
|
status: 'available',
|
|
title: 'Parallel',
|
|
showTitle: false,
|
|
description: 'Constrain two segments to be parallel',
|
|
links: [],
|
|
},
|
|
{
|
|
id: 'constraint-equal-length',
|
|
disabled: (state) =>
|
|
!(
|
|
state.matches({ Sketch: 'SketchIdle' }) &&
|
|
state.can({ type: 'Constrain equal length' })
|
|
),
|
|
onClick: ({ modelingSend }) =>
|
|
modelingSend({ type: 'Constrain equal length' }),
|
|
status: 'available',
|
|
title: 'Equal length',
|
|
showTitle: false,
|
|
description: 'Constrain two segments to be equal length',
|
|
links: [],
|
|
},
|
|
{
|
|
id: 'constraint-horizontal-distance',
|
|
disabled: (state) =>
|
|
!(
|
|
state.matches({ Sketch: 'SketchIdle' }) &&
|
|
state.can({ type: 'Constrain horizontal distance' })
|
|
),
|
|
onClick: ({ modelingSend }) =>
|
|
modelingSend({ type: 'Constrain horizontal distance' }),
|
|
status: 'available',
|
|
title: 'Horizontal distance',
|
|
showTitle: false,
|
|
description: 'Constrain the horizontal distance between two points',
|
|
links: [],
|
|
},
|
|
{
|
|
id: 'constraint-vertical-distance',
|
|
disabled: (state) =>
|
|
!(
|
|
state.matches({ Sketch: 'SketchIdle' }) &&
|
|
state.can({ type: 'Constrain vertical distance' })
|
|
),
|
|
onClick: ({ modelingSend }) =>
|
|
modelingSend({ type: 'Constrain vertical distance' }),
|
|
status: 'available',
|
|
title: 'Vertical distance',
|
|
showTitle: false,
|
|
description: 'Constrain the vertical distance between two points',
|
|
links: [],
|
|
},
|
|
{
|
|
id: 'constraint-absolute-x',
|
|
disabled: (state) =>
|
|
!(
|
|
state.matches({ Sketch: 'SketchIdle' }) &&
|
|
state.can({ type: 'Constrain ABS X' })
|
|
),
|
|
onClick: ({ modelingSend }) =>
|
|
modelingSend({ type: 'Constrain ABS X' }),
|
|
status: 'available',
|
|
title: 'Absolute X',
|
|
showTitle: false,
|
|
description: 'Constrain the x-coordinate of a point',
|
|
links: [],
|
|
},
|
|
{
|
|
id: 'constraint-absolute-y',
|
|
disabled: (state) =>
|
|
!(
|
|
state.matches({ Sketch: 'SketchIdle' }) &&
|
|
state.can({ type: 'Constrain ABS Y' })
|
|
),
|
|
onClick: ({ modelingSend }) =>
|
|
modelingSend({ type: 'Constrain ABS Y' }),
|
|
status: 'available',
|
|
title: 'Absolute Y',
|
|
showTitle: false,
|
|
description: 'Constrain the y-coordinate of a point',
|
|
links: [],
|
|
},
|
|
{
|
|
id: 'constraint-perpendicular-distance',
|
|
disabled: (state) =>
|
|
!(
|
|
state.matches({ Sketch: 'SketchIdle' }) &&
|
|
state.can({ type: 'Constrain perpendicular distance' })
|
|
),
|
|
onClick: ({ modelingSend }) =>
|
|
modelingSend({ type: 'Constrain perpendicular distance' }),
|
|
status: 'available',
|
|
title: 'Perpendicular distance',
|
|
showTitle: false,
|
|
description:
|
|
'Constrain the perpendicular distance between two segments',
|
|
links: [],
|
|
},
|
|
{
|
|
id: 'constraint-align-horizontal',
|
|
disabled: (state) =>
|
|
!(
|
|
state.matches({ Sketch: 'SketchIdle' }) &&
|
|
state.can({ type: 'Constrain horizontally align' })
|
|
),
|
|
onClick: ({ modelingSend }) =>
|
|
modelingSend({ type: 'Constrain horizontally align' }),
|
|
status: 'available',
|
|
title: 'Horizontally align',
|
|
showTitle: false,
|
|
description: 'Align the ends of two or more segments horizontally',
|
|
links: [],
|
|
},
|
|
{
|
|
id: 'constraint-align-vertical',
|
|
disabled: (state) =>
|
|
!(
|
|
state.matches({ Sketch: 'SketchIdle' }) &&
|
|
state.can({ type: 'Constrain vertically align' })
|
|
),
|
|
onClick: ({ modelingSend }) =>
|
|
modelingSend({ type: 'Constrain vertically align' }),
|
|
status: 'available',
|
|
title: 'Vertically align',
|
|
showTitle: false,
|
|
description: 'Align the ends of two or more segments vertically',
|
|
links: [],
|
|
},
|
|
{
|
|
id: 'snap-to-x',
|
|
disabled: (state) =>
|
|
!(
|
|
state.matches({ Sketch: 'SketchIdle' }) &&
|
|
state.can({ type: 'Constrain snap to X' })
|
|
),
|
|
onClick: ({ modelingSend }) =>
|
|
modelingSend({ type: 'Constrain snap to X' }),
|
|
status: 'available',
|
|
title: 'Snap to X',
|
|
showTitle: false,
|
|
description: 'Snap a point to an x-coordinate',
|
|
links: [],
|
|
},
|
|
{
|
|
id: 'snap-to-y',
|
|
disabled: (state) =>
|
|
!(
|
|
state.matches({ Sketch: 'SketchIdle' }) &&
|
|
state.can({ type: 'Constrain snap to Y' })
|
|
),
|
|
onClick: ({ modelingSend }) =>
|
|
modelingSend({ type: 'Constrain snap to Y' }),
|
|
status: 'available',
|
|
title: 'Snap to Y',
|
|
showTitle: false,
|
|
description: 'Snap a point to a y-coordinate',
|
|
links: [],
|
|
},
|
|
{
|
|
id: 'constraint-remove',
|
|
disabled: (state) =>
|
|
!(
|
|
state.matches({ Sketch: 'SketchIdle' }) &&
|
|
state.can({ type: 'Constrain remove constraints' })
|
|
),
|
|
onClick: ({ modelingSend }) =>
|
|
modelingSend({ type: 'Constrain remove constraints' }),
|
|
status: 'available',
|
|
title: 'Remove constraints',
|
|
showTitle: false,
|
|
description: 'Remove all constraints from the segment',
|
|
links: [],
|
|
},
|
|
],
|
|
],
|
|
},
|
|
}
|