Skip to content

pierremtb/issue7626-initial-hole-cmd-config #7637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/components/ModelingMachineProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,7 @@ export const ModelingMachineProvider = ({
commandName: 'Shell',
groupId: 'modeling',
},
// TODO: add hole here
{
menuLabel: 'Design.Modify with Zoo Text-To-CAD',
commandName: 'Prompt-to-edit',
Expand Down
72 changes: 72 additions & 0 deletions src/lib/commandBarConfigs/modelingCommandConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,21 @@ export type ModelingCommandSchema = {
selection: Selections
thickness: KclCommandValue
}
Hole: {
// Enables editing workflow
nodeToEdit?: PathToNode
// KCL stdlib arguments
face: Selections
pointX: KclCommandValue
pointY: KclCommandValue
length: KclCommandValue
diameter: KclCommandValue
countersinkDiameter?: KclCommandValue
countersinkAngle?: KclCommandValue
counterboreDiameter?: KclCommandValue
counterboreDepth?: KclCommandValue
bottomDrillAngle?: KclCommandValue
}
Fillet: {
// Enables editing workflow
nodeToEdit?: PathToNode
Expand Down Expand Up @@ -590,6 +605,63 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
},
},
},
Hole: {
description: 'Create standard holes in a solid through a wizard.',
icon: 'hole',
needsReview: true,
args: {
nodeToEdit: {
...nodeToEditProps,
},
face: {
inputType: 'selection',
selectionTypes: ['cap', 'wall'],
multiple: true,
required: true,
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
},
pointX: {
inputType: 'kcl',
defaultValue: KCL_DEFAULT_LENGTH,
required: true,
},
pointY: {
inputType: 'kcl',
defaultValue: KCL_DEFAULT_LENGTH,
required: true,
},
length: {
inputType: 'kcl',
defaultValue: KCL_DEFAULT_LENGTH,
required: true,
},
diameter: {
inputType: 'kcl',
defaultValue: KCL_DEFAULT_LENGTH,
required: true,
},
countersinkDiameter: {
inputType: 'kcl',
required: false,
},
countersinkAngle: {
inputType: 'kcl',
required: false,
},
counterboreDiameter: {
inputType: 'kcl',
required: false,
},
counterboreDepth: {
inputType: 'kcl',
required: false,
},
bottomDrillAngle: {
inputType: 'kcl',
required: false,
},
},
},
'Boolean Subtract': {
description: 'Subtract one solid from another.',
icon: 'booleanSubtract',
Expand Down
20 changes: 20 additions & 0 deletions src/lib/toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,26 @@ export const toolbarConfig: Record<ToolbarModeName, ToolbarMode> = {
},
],
},
{
id: 'hole',
onClick: () => {
commandBarActor.send({
type: 'Find and select command',
data: { name: 'Hole', groupId: 'modeling' },
})
},
icon: 'hole',
status: 'available',
title: 'Hole',
description: 'Create standard holes in a solid through a wizard.',
links: [
{
label: 'KCL docs',
// TODO: update this link to the new KCL docs
url: 'https://zoo.dev/docs/kcl-std/functions/std-solid-hole',
},
],
},
'break',
{
id: 'booleans',
Expand Down
36 changes: 36 additions & 0 deletions src/machines/modelingMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ export type ModelingMachineEvent =
| { type: 'Sweep'; data?: ModelingCommandSchema['Sweep'] }
| { type: 'Loft'; data?: ModelingCommandSchema['Loft'] }
| { type: 'Shell'; data?: ModelingCommandSchema['Shell'] }
| { type: 'Hole'; data?: ModelingCommandSchema['Hole'] }
| { type: 'Revolve'; data?: ModelingCommandSchema['Revolve'] }
| { type: 'Fillet'; data?: ModelingCommandSchema['Fillet'] }
| { type: 'Chamfer'; data?: ModelingCommandSchema['Chamfer'] }
Expand Down Expand Up @@ -2991,6 +2992,19 @@ export const modelingMachine = setup({
)
}
),
holeAstMod: fromPromise(
async ({
input,
}: {
input: ModelingCommandSchema['Shell'] | undefined
}) => {
if (!input) {
return Promise.reject(new Error(NO_INPUT_PROVIDED_MESSAGE))
}

return Promise.reject(new Error(`Hole isn't implemented yet`))
}
),
filletAstMod: fromPromise(
async ({
input,
Expand Down Expand Up @@ -3799,6 +3813,12 @@ export const modelingMachine = setup({
guard: 'no kcl errors',
},

Hole: {
target: 'Applying hole',
reenter: true,
guard: 'no kcl errors',
},

Fillet: {
target: 'Applying fillet',
reenter: true,
Expand Down Expand Up @@ -5192,6 +5212,22 @@ export const modelingMachine = setup({
},
},

'Applying hole': {
invoke: {
src: 'holeAstMod',
id: 'holeAstMod',
input: ({ event }) => {
if (event.type !== 'Hole') return undefined
return event.data
},
onDone: ['idle'],
onError: {
target: 'idle',
actions: 'toastError',
},
},
},

'Applying fillet': {
invoke: {
src: 'filletAstMod',
Expand Down
Loading