Files
modeling-app/public/kcl-samples/walkie-talkie/main.kcl
Paul Tagliamonte d047587bc1 Avoid using full revolve for now (#6912)
Avoid using revolve for now

When we moved to concurrent execution of KCL modules, we begun to see an
error we never fully understood, and because it was pretty hard to
trigger, we wound up never being able to fix it. Today we were able to
track it down to the `revolve` call here.

Specifically, the problem is triggered when we're doing a "Full Revolve"
(e.g., `angle = 359.999999` passes, but *not* `angle = 360` or the
default, as it is in `main`), and concurrently executing modules will
see something weird happen with `getNextAdjacentEdge`.

From all the smoke I believe this happens only when we are doing a *full
revolve*, *AND* we're executing other modules which are calling
`getNextAdjacentEdge`.

When the `revolve` is present, we can lose the race in *either*
`talk-button.kcl` OR `case.kcl`.

If I move back to single-threaded execution OR I add imports to sequence
things carefully, I can get the tests to pass. If the revolve is an
`extrude` or not a full revolve, it works fine.

My best guess is that it seems like the world got flipped upside down or
something, such that "next edge" has a different orentation for two
calls. My even further guess is that inside `revolve` we mutate
something connection-global such that it alters the intepretation of
calls made during the revolve implementation's "critical section".
2025-05-13 20:20:48 +00:00

68 lines
1.7 KiB
Plaintext

// Walkie Talkie
// A portable, handheld two-way radio device that allows users to communicate wirelessly over short to medium distances. It operates on specific radio frequencies and features a push-to-talk button for transmitting messages, making it ideal for quick and reliable communication in outdoor, work, or emergency settings.
// set units
@settings(defaultLengthUnit = in, kclVersion = 1.0)
// import constants
import * from "parameters.kcl"
// import parts and parameters
import "body.kcl" as body
import "case.kcl" as case
import "antenna.kcl" as antenna
import "talk-button.kcl" as talkButton
import "knob.kcl" as knob
import button from "button.kcl"
// Import the body
body
// Import the antenna
antenna
|> translate(x = -width / 2 + .60, y = -0.20, z = height / 2)
// Import the case
case
|> translate(x = 0, y = -1, z = 0)
// Import the talk button
talkButton
|> translate(x = width / 2, y = -thickness / 2, z = .5)
// Import the frequency knob
knob
|> translate(x = width / 2 - 0.70, y = -thickness / 2, z = height / 2)
// Import the buttons
button()
|> translate(x = -(screenWidth / 2 + tolerance), y = -1, z = screenYPosition)
button()
|> translate(x = -(screenWidth / 2 + tolerance), y = -1, z = screenYPosition - buttonHeight - (tolerance * 2))
button()
|> rotate(
%,
roll = 0,
pitch = 180,
yaw = 0,
)
|> translate(
x = screenWidth / 2 + tolerance,
y = -1,
z = screenYPosition - buttonHeight,
global = true,
)
button()
|> rotate(
%,
roll = 0,
pitch = 180,
yaw = 0,
)
|> translate(
x = screenWidth / 2 + tolerance,
y = -1,
z = screenYPosition - (buttonHeight * 2) - (tolerance * 2),
global = true,
)