Skip to content

Commit 7dd859b

Browse files
authored
Stop guarding on KCL errors: let people point-and-click a fix (#8721)
1 parent 52dad55 commit 7dd859b

File tree

4 files changed

+40
-81
lines changed

4 files changed

+40
-81
lines changed

src/Toolbar.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ export function Toolbar({
170170
const isDisabled =
171171
disableAllButtons ||
172172
!isConfiguredAvailable ||
173-
maybeIconConfig.disabled?.(state) === true ||
174-
kclManager.hasErrors()
173+
maybeIconConfig.disabled?.(state) === true
175174

176175
// Calculate the isActive state for this specific item
177176
const itemIsActive = maybeIconConfig.isActive?.(state) || false
@@ -495,15 +494,6 @@ const ToolbarItemTooltip = memo(function ToolbarItemContents({
495494
contentClassName={contentClassName}
496495
>
497496
{children}
498-
{kclManager.hasErrors() && (
499-
<p className="text-xs p-1 text-chalkboard-70 dark:text-chalkboard-40">
500-
<CustomIcon
501-
name="exclamationMark"
502-
className="w-4 h-4 inline-block mr-1 text-destroy-80 bg-destroy-10"
503-
/>
504-
Fix KCL errors to enable tools
505-
</p>
506-
)}
507497
</Tooltip>
508498
)
509499
})

src/components/layout/areas/FeatureTreePane.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,10 +395,10 @@ const OperationItemWrapper = ({
395395
</code>
396396
)}
397397
</div>
398+
{errors && errors.length > 0 && (
399+
<em className="text-destroy-80 text-xs">has error</em>
400+
)}
398401
</button>
399-
{errors && errors.length > 0 && (
400-
<em className="text-destroy-80 text-xs">has error</em>
401-
)}
402402
{visibilityToggle && <VisibilityToggle {...visibilityToggle} />}
403403
{menuItems && (
404404
<ContextMenu menuTargetElement={menuRef} items={menuItems} />

src/lang/langHelpers.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ function handleExecuteError(e: any): ExecutionResult {
137137
isInterrupted = true
138138
}
139139
const execState = emptyExecState()
140+
// We're passing back those so the user can still fix issues in p&c
140141
execState.variables = e.variables
142+
execState.operations = e.operations
143+
execState.artifactGraph = e.artifactGraph
141144
return {
142145
errors: [e],
143146
logs: [],

src/machines/modelingMachine.ts

Lines changed: 33 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -409,14 +409,11 @@ export const modelingMachine = setup({
409409
},
410410
'Has exportable geometry': () => false,
411411
'has valid selection for deletion': () => false,
412+
// TODO: figure out if we really need this one, was separate from 'no kcl errors'
412413
'is-error-free': ({ context }): boolean => {
413414
const theKclManager = context.kclManager ? context.kclManager : kclManager
414415
return theKclManager.errors.length === 0 && !theKclManager.hasErrors()
415416
},
416-
'no kcl errors': ({ context }) => {
417-
const theKclManager = context.kclManager ? context.kclManager : kclManager
418-
return !theKclManager.hasErrors()
419-
},
420417
'is editing existing sketch': ({
421418
context: { sketchDetails, kclManager: providedKclManager },
422419
}) => {
@@ -4220,150 +4217,120 @@ export const modelingMachine = setup({
42204217
sceneInfra.animate()
42214218
},
42224219
],
4223-
guard: 'no kcl errors',
42244220
},
42254221
],
42264222

4223+
// Modeling codemods
4224+
42274225
Extrude: {
42284226
target: 'Applying extrude',
4229-
reenter: true,
4230-
guard: 'no kcl errors',
42314227
},
42324228

42334229
Sweep: {
42344230
target: 'Applying sweep',
4235-
reenter: true,
4236-
guard: 'no kcl errors',
42374231
},
42384232

42394233
Loft: {
42404234
target: 'Applying loft',
4241-
reenter: true,
4242-
guard: 'no kcl errors',
42434235
},
42444236

42454237
Revolve: {
42464238
target: 'Applying revolve',
4247-
reenter: true,
4248-
guard: 'no kcl errors',
42494239
},
42504240

42514241
'Offset plane': {
42524242
target: 'Applying offset plane',
4253-
reenter: true,
4254-
guard: 'no kcl errors',
42554243
},
42564244

42574245
Helix: {
42584246
target: 'Applying helix',
4259-
reenter: true,
4260-
guard: 'no kcl errors',
42614247
},
42624248

42634249
Shell: {
42644250
target: 'Applying shell',
4265-
reenter: true,
4266-
guard: 'no kcl errors',
42674251
},
42684252

42694253
Hole: {
42704254
target: 'Applying hole',
4271-
reenter: true,
4272-
guard: 'no kcl errors',
42734255
},
42744256

42754257
Fillet: {
42764258
target: 'Applying fillet',
4277-
reenter: true,
4278-
guard: 'no kcl errors',
42794259
},
42804260

42814261
Chamfer: {
42824262
target: 'Applying chamfer',
4283-
reenter: true,
4284-
guard: 'no kcl errors',
4285-
},
4286-
4287-
Export: {
4288-
target: 'Exporting',
4289-
guard: 'Has exportable geometry',
42904263
},
42914264

4292-
Make: {
4293-
target: 'Making',
4294-
guard: 'Has exportable geometry',
4295-
},
4296-
4297-
'Delete selection': {
4298-
target: 'Applying Delete selection',
4299-
guard: 'has valid selection for deletion',
4300-
reenter: true,
4301-
},
4302-
4303-
'Text-to-CAD': {
4304-
target: 'idle',
4305-
reenter: false,
4306-
actions: ['Submit to Text-to-CAD API'],
4307-
},
4308-
4309-
'Prompt-to-edit': 'Applying Prompt-to-edit',
4310-
43114265
Appearance: {
43124266
target: 'Applying appearance',
4313-
reenter: true,
4314-
guard: 'no kcl errors',
43154267
},
43164268

43174269
Translate: {
43184270
target: 'Applying translate',
4319-
reenter: true,
4320-
guard: 'no kcl errors',
43214271
},
43224272

43234273
Rotate: {
43244274
target: 'Applying rotate',
4325-
reenter: true,
4326-
guard: 'no kcl errors',
43274275
},
43284276

43294277
Scale: {
43304278
target: 'Applying scale',
4331-
reenter: true,
4332-
guard: 'no kcl errors',
43334279
},
43344280

43354281
Clone: {
43364282
target: 'Applying clone',
4337-
reenter: true,
4338-
guard: 'no kcl errors',
43394283
},
43404284

43414285
'GDT Flatness': {
43424286
target: 'Applying GDT Flatness',
4343-
reenter: true,
4344-
guard: 'no kcl errors',
43454287
},
43464288

43474289
'Boolean Subtract': {
43484290
target: 'Boolean subtracting',
4349-
guard: 'no kcl errors',
43504291
},
4292+
43514293
'Boolean Union': {
43524294
target: 'Boolean uniting',
4353-
guard: 'no kcl errors',
43544295
},
4296+
43554297
'Boolean Intersect': {
43564298
target: 'Boolean intersecting',
4357-
guard: 'no kcl errors',
43584299
},
4300+
43594301
'Pattern Circular 3D': {
43604302
target: 'Pattern Circular 3D',
4361-
guard: 'no kcl errors',
43624303
},
4304+
43634305
'Pattern Linear 3D': {
43644306
target: 'Pattern Linear 3D',
4365-
guard: 'no kcl errors',
43664307
},
4308+
4309+
// Modeling actions
4310+
4311+
Export: {
4312+
target: 'Exporting',
4313+
guard: 'Has exportable geometry',
4314+
},
4315+
4316+
Make: {
4317+
target: 'Making',
4318+
guard: 'Has exportable geometry',
4319+
},
4320+
4321+
'Delete selection': {
4322+
target: 'Applying Delete selection',
4323+
guard: 'has valid selection for deletion',
4324+
reenter: true,
4325+
},
4326+
4327+
'Text-to-CAD': {
4328+
target: 'idle',
4329+
reenter: false,
4330+
actions: ['Submit to Text-to-CAD API'],
4331+
},
4332+
4333+
'Prompt-to-edit': 'Applying Prompt-to-edit',
43674334
},
43684335

43694336
entry: 'reset client scene mouse handlers',
@@ -4373,7 +4340,6 @@ export const modelingMachine = setup({
43734340
on: {
43744341
'Artifact graph emptied': {
43754342
target: 'showPlanes',
4376-
guard: 'no kcl errors',
43774343
},
43784344
},
43794345

0 commit comments

Comments
 (0)