saltiresoftware commited on
Commit
0fdc2f0
·
verified ·
1 Parent(s): 13457e8

Upload 8 files

Browse files
Files changed (3) hide show
  1. app.js +4 -1
  2. index.html +3 -3
  3. system_prompt.txt +7 -5
app.js CHANGED
@@ -1,5 +1,6 @@
1
  const LOCAL_MODE = window.CAM_STUDIO_LOCAL === true;
2
  const COREGX_PROXY_URL = String(window.CAM_STUDIO_CONFIG?.coregxProxyUrl || "").trim();
 
3
 
4
  const TEMPLATES = {
5
  recip_flat: {
@@ -104,7 +105,9 @@ function inferTemplate(description) {
104
  }
105
 
106
  async function textFile(path) {
107
- const response = await fetch(path, { cache: "no-cache" });
 
 
108
  if (!response.ok) throw new Error(`Could not load ${path}.`);
109
  return (await response.text()).trim();
110
  }
 
1
  const LOCAL_MODE = window.CAM_STUDIO_LOCAL === true;
2
  const COREGX_PROXY_URL = String(window.CAM_STUDIO_CONFIG?.coregxProxyUrl || "").trim();
3
+ const BUILD_ID = "20260918-3";
4
 
5
  const TEMPLATES = {
6
  recip_flat: {
 
105
  }
106
 
107
  async function textFile(path) {
108
+ const url = new URL(path, window.location.href);
109
+ url.searchParams.set("v", BUILD_ID);
110
+ const response = await fetch(url, { cache: "reload" });
111
  if (!response.ok) throw new Error(`Could not load ${path}.`);
112
  return (await response.text()).trim();
113
  }
index.html CHANGED
@@ -5,7 +5,7 @@
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
  <meta name="description" content="Generate animated CoreGX cam mechanisms in your browser.">
7
  <title>CoreGX Cam Studio</title>
8
- <link rel="stylesheet" href="styles.css">
9
  </head>
10
  <body>
11
  <main class="page">
@@ -46,7 +46,7 @@
46
  </details>
47
  </main>
48
 
49
- <script src="config.js"></script>
50
- <script type="module" src="app.js"></script>
51
  </body>
52
  </html>
 
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
  <meta name="description" content="Generate animated CoreGX cam mechanisms in your browser.">
7
  <title>CoreGX Cam Studio</title>
8
+ <link rel="stylesheet" href="styles.css?v=20260918-3">
9
  </head>
10
  <body>
11
  <main class="page">
 
46
  </details>
47
  </main>
48
 
49
+ <script src="config.js?v=20260918-3"></script>
50
+ <script type="module" src="app.js?v=20260918-3"></script>
51
  </body>
52
  </html>
system_prompt.txt CHANGED
@@ -37,6 +37,8 @@ The displacement expression is one quoted string containing piecewise(...), opti
37
 
38
  For a moving segment, the local time is phase(...)-<segment_start_angle>. For a dwell, use a constant. The final segment must be { <final_height>, otherwise }. Fill any unmentioned remainder of the 360-degree cycle with that final dwell. Use explicit numeric constants rather than invented variables.
39
 
 
 
40
  ALLOWED MOTION-LAW MACROS
41
  Use only these separately supplied macros. Do not expand them into raw trigonometric or polynomial expressions.
42
  - harmonic(h0,h1,D,t)
@@ -44,7 +46,7 @@ Use only these separately supplied macros. Do not expand them into raw trigonome
44
  - poly345(h0,h1,D,t)
45
  - poly4567(h0,h1,D,t)
46
 
47
- For a rise, use the starting and ending heights in that order. For a fall, reverse them. For a dwell, use the current constant height. If the motion law is unspecified, use harmonic. Do not use cv() or ca().
48
 
49
  ANIMATE LINE
50
  Always finish with:
@@ -55,12 +57,12 @@ CANONICAL EXAMPLES
55
 
56
  Reciprocating roller:
57
  @ReciprocatingRoller(O,A,B,theta,20,3,2,outside)
58
- distance A B "20+3+piecewise({ cycloid(0,5,(20*pi/180),phase(theta+phi)-0), phase(theta+phi)<=20*pi/180 },{ 5, phase(theta+phi)<=60*pi/180 },{ poly345(5,12,(30*pi/180),phase(theta+phi)-60*pi/180), phase(theta+phi)<=90*pi/180 },{ 12, phase(theta+phi)<=120*pi/180 },{ poly4567(12,0,(40*pi/180),phase(theta+phi)-120*pi/180), phase(theta+phi)<=160*pi/180 },{ 0, otherwise })"
59
  animate phi 0 6.283 duration=2
60
 
61
  Reciprocating flat:
62
  @RFF(O,A,E,F,theta,40,9)
63
- distance A EF "40 + piecewise({ cycloid(0,6,(60*pi/180),phase(theta+phi)-0), phase(theta+phi)<=60*pi/180 },{ cycloid(6,0,(60*pi/180),phase(theta+phi)-60*pi/180), phase(theta+phi)<=120*pi/180 },{ 0, otherwise })"
64
  animate phi 0 6.283 duration=2
65
 
66
  Oscillating flat:
@@ -69,8 +71,8 @@ angle A B C "35*pi/180 + piecewise({ cycloid(0,0.15,(90*pi/180),phase(theta+phi)
69
  animate phi 0 6.283 duration=2
70
 
71
  Oscillating roller, counterclockwise:
72
- @OscillatingRoller(A,B,C,theta,0.7,5,69,75,below,outside)
73
- angle A B C "0.7 + piecewise({ harmonic(0,0.2,(60*pi/180),phase(theta-phi)-0), phase(theta-phi)<=60*pi/180 },{ harmonic(0.2,0,(60*pi/180),phase(theta-phi)-60*pi/180), phase(theta-phi)<=120*pi/180 },{ 0, otherwise })"
74
  animate phi 0 6.283 duration=2
75
 
76
  Your response must always be exactly one follower macro call, one displacement line, and one animate line. Output no Markdown, prose, comments, variable declarations, or macro definitions.
 
37
 
38
  For a moving segment, the local time is phase(...)-<segment_start_angle>. For a dwell, use a constant. The final segment must be { <final_height>, otherwise }. Fill any unmentioned remainder of the 360-degree cycle with that final dwell. Use explicit numeric constants rather than invented variables.
39
 
40
+ Build the schedule cumulatively from the user's requested intervals. For every moving segment, its motion-law duration D must equal that segment's end angle minus its start angle. Do not add extra rises, falls, or dwells that the user did not request. A return must end at the starting displacement before the final dwell.
41
+
42
  ALLOWED MOTION-LAW MACROS
43
  Use only these separately supplied macros. Do not expand them into raw trigonometric or polynomial expressions.
44
  - harmonic(h0,h1,D,t)
 
46
  - poly345(h0,h1,D,t)
47
  - poly4567(h0,h1,D,t)
48
 
49
+ For a rise, use the starting and ending heights in that order. For a fall, reverse them. For a dwell, use the current constant height. After a rise from 0 to H, the following dwell must be H, never 0. The fall must then start from the same H. If the motion law is unspecified, use harmonic. Do not use cv() or ca().
50
 
51
  ANIMATE LINE
52
  Always finish with:
 
57
 
58
  Reciprocating roller:
59
  @ReciprocatingRoller(O,A,B,theta,20,3,2,outside)
60
+ distance A B "20+3+piecewise({ cycloid(0,8,(70*pi/180),phase(theta+phi)-0), phase(theta+phi)<=70*pi/180 },{ 8, phase(theta+phi)<=150*pi/180 },{ cycloid(8,0,(90*pi/180),phase(theta+phi)-150*pi/180), phase(theta+phi)<=240*pi/180 },{ 0, otherwise })"
61
  animate phi 0 6.283 duration=2
62
 
63
  Reciprocating flat:
64
  @RFF(O,A,E,F,theta,40,9)
65
+ distance A EF "40 + piecewise({ harmonic(0,6,(60*pi/180),phase(theta+phi)-0), phase(theta+phi)<=60*pi/180 },{ 6, phase(theta+phi)<=120*pi/180 },{ harmonic(6,0,(60*pi/180),phase(theta+phi)-120*pi/180), phase(theta+phi)<=180*pi/180 },{ 0, otherwise })"
66
  animate phi 0 6.283 duration=2
67
 
68
  Oscillating flat:
 
71
  animate phi 0 6.283 duration=2
72
 
73
  Oscillating roller, counterclockwise:
74
+ @OscillatingRoller(A,B,C,theta,50*pi/180,5,69,75,below,outside)
75
+ angle A B C "50*pi/180 + piecewise({ harmonic(0,0.2,(60*pi/180),phase(theta-phi)-0), phase(theta-phi)<=60*pi/180 },{ 0.2, phase(theta-phi)<=120*pi/180 },{ harmonic(0.2,0,(60*pi/180),phase(theta-phi)-120*pi/180), phase(theta-phi)<=180*pi/180 },{ 0, otherwise })"
76
  animate phi 0 6.283 duration=2
77
 
78
  Your response must always be exactly one follower macro call, one displacement line, and one animate line. Output no Markdown, prose, comments, variable declarations, or macro definitions.