Skip to content

Commit ab5d8db

Browse files
committed
Update for 1.8.8 release
1 parent ea04ab4 commit ab5d8db

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+9080
-9
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Change Log
22

3+
## [1.8.8](https://github.com/nicklockwood/ShapeScript/releases/tag/1.8.8) (2025-04-15)
4+
5+
- Added support for partial ranges like `values[from 5]`
6+
- Fixed some bugs with negative or reversed ranges
7+
- Added mesh volume to object info panel
8+
- Added `mesh.volume` member
9+
- Improved log truncation logic
10+
- Bumped Euclid to version 0.7.10
11+
- Bumped SVGPath to version 1.1.6
12+
313
## [1.8.7](https://github.com/nicklockwood/ShapeScript/releases/tag/1.8.7) (2025-03-29)
414

515
- Fixed bug with returning subscripted values

ShapeScript.podspec.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ShapeScript",
3-
"version": "1.8.7",
3+
"version": "1.8.8",
44
"license": {
55
"type": "MIT",
66
"file": "LICENSE.md"
@@ -10,7 +10,7 @@
1010
"authors": "Nick Lockwood",
1111
"source": {
1212
"git": "https://github.com/nicklockwood/ShapeScript.git",
13-
"tag": "1.8.7"
13+
"tag": "1.8.8"
1414
},
1515
"source_files": ["ShapeScript", "LRUCache/Sources", "SVGPath/Sources"],
1616
"requires_arc": true,

ShapeScript.xcodeproj/project.pbxproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@
13601360
"$(inherited)",
13611361
"@executable_path/../Frameworks",
13621362
);
1363-
MARKETING_VERSION = 1.8.7;
1363+
MARKETING_VERSION = 1.8.8;
13641364
PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.ShapeScriptViewer;
13651365
PRODUCT_MODULE_NAME = Viewer;
13661366
PRODUCT_NAME = "ShapeScript Viewer";
@@ -1389,7 +1389,7 @@
13891389
"$(inherited)",
13901390
"@executable_path/../Frameworks",
13911391
);
1392-
MARKETING_VERSION = 1.8.7;
1392+
MARKETING_VERSION = 1.8.8;
13931393
PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.ShapeScriptViewer;
13941394
PRODUCT_MODULE_NAME = Viewer;
13951395
PRODUCT_NAME = "ShapeScript Viewer";
@@ -1421,7 +1421,7 @@
14211421
"$(inherited)",
14221422
"@executable_path/Frameworks",
14231423
);
1424-
MARKETING_VERSION = 1.8.7;
1424+
MARKETING_VERSION = 1.8.8;
14251425
PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.ShapeScriptViewer;
14261426
PRODUCT_MODULE_NAME = Viewer;
14271427
PRODUCT_NAME = ShapeScript;
@@ -1456,7 +1456,7 @@
14561456
"$(inherited)",
14571457
"@executable_path/Frameworks",
14581458
);
1459-
MARKETING_VERSION = 1.8.7;
1459+
MARKETING_VERSION = 1.8.8;
14601460
PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.ShapeScriptViewer;
14611461
PRODUCT_MODULE_NAME = Viewer;
14621462
PRODUCT_NAME = ShapeScript;
@@ -1627,7 +1627,7 @@
16271627
"@executable_path/../Frameworks",
16281628
"@loader_path/Frameworks",
16291629
);
1630-
MARKETING_VERSION = 1.8.7;
1630+
MARKETING_VERSION = 1.8.8;
16311631
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
16321632
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14";
16331633
PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.ShapeScriptLib;
@@ -1664,7 +1664,7 @@
16641664
"@executable_path/../Frameworks",
16651665
"@loader_path/Frameworks",
16661666
);
1667-
MARKETING_VERSION = 1.8.7;
1667+
MARKETING_VERSION = 1.8.8;
16681668
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
16691669
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14";
16701670
PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.ShapeScriptLib;

ShapeScript/Interpreter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Foundation
1111

1212
// MARK: Public interface
1313

14-
public let version = "1.8.7"
14+
public let version = "1.8.8"
1515

1616
public func evaluate(
1717
_ program: Program,

Viewer/Mac/WhatsNew.rtf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,31 @@ What's New in ShapeScript?\
1111
\
1212
\pard\tx220\tx720\pardeftab720\li720\fi-720\partightenfactor0
1313

14+
\f1\b\fs28 \cf2 ShapeScript 1.8.8 \'97 2025-04-15\
15+
\
16+
\pard\tx220\tx720\pardeftab720\li720\fi-720\partightenfactor0
17+
\cf2 \kerning1\expnd0\expndtw0 \'95
18+
\f0\b0 \expnd0\expndtw0\kerning0
19+
Added support for partial ranges like `values[from 5]`.\
20+
\ \'95
21+
\f0\b0 \expnd0\expndtw0\kerning0
22+
Fixed some bugs with negative or reversed ranges.\
23+
\ \'95
24+
\f0\b0 \expnd0\expndtw0\kerning0
25+
Added mesh volume to object info panel.\
26+
\ \'95
27+
\f0\b0 \expnd0\expndtw0\kerning0
28+
Added `mesh.volume` member.\
29+
\ \'95
30+
\f0\b0 \expnd0\expndtw0\kerning0
31+
Improved log truncation logic.\
32+
\ \'95
33+
\f0\b0 \expnd0\expndtw0\kerning0
34+
Bumped Euclid to version 0.7.10.\
35+
\ \'95
36+
\f0\b0 \expnd0\expndtw0\kerning0
37+
Bumped SVGPath to version 1.1.6.\
38+
\
1439
\f1\b\fs28 \cf2 ShapeScript 1.8.7 \'97 2025-03-29\
1540
\
1641
\pard\tx220\tx720\pardeftab720\li720\fi-720\partightenfactor0

Viewer/iOS/WhatsNew.rtf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,32 @@
55
\paperw11900\paperh16840\margl1440\margr1440\vieww24140\viewh18420\viewkind0
66
\deftab720
77

8+
\f0\b \cf2 ShapeScript 1.8.8 \'97 2025-04-15\
9+
\
10+
\pard\tx220\tx720\pardeftab720\li720\fi-720\partightenfactor0
11+
\cf2 \kerning1\expnd0\expndtw0
12+
\f1\b0 \expnd0\expndtw0\kerning0 \'95
13+
\f1\b0 \expnd0\expndtw0\kerning0
14+
Added support for partial ranges like `values[from 5]`.\
15+
\ \'95
16+
\f1\b0 \expnd0\expndtw0\kerning0
17+
Fixed some bugs with negative or reversed ranges.\
18+
\ \'95
19+
\f1\b0 \expnd0\expndtw0\kerning0
20+
Added mesh volume to object info panel.\
21+
\ \'95
22+
\f1\b0 \expnd0\expndtw0\kerning0
23+
Added `mesh.volume` member.\
24+
\ \'95
25+
\f1\b0 \expnd0\expndtw0\kerning0
26+
Improved log truncation logic.\
27+
\ \'95
28+
\f1\b0 \expnd0\expndtw0\kerning0
29+
Bumped Euclid to version 0.7.10.\
30+
\ \'95
31+
\f1\b0 \expnd0\expndtw0\kerning0
32+
Bumped SVGPath to version 1.1.6.\
33+
\
834
\f0\b \cf2 ShapeScript 1.8.7 \'97 2025-03-29\
935
\
1036
\pard\tx220\tx720\pardeftab720\li720\fi-720\partightenfactor0

docs/1.8.8/ios/blocks.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
Blocks
2+
---
3+
4+
A block is a nested list of instructions, contained inside `{ ... }` braces. Some commands, such as [builders](builders.md) or [CSG operations](csg.md), accept a block parameter instead of a simple value like a number or [vector](literals.md#vectors-and-tuples).
5+
6+
Instructions inside a block are executed within the [scope](scope.md) of the command that invoked them. Typically that means that any transforms or material changes made inside the block will only apply to geometry created inside the same block. This also applies to any symbols that you define inside the block.
7+
8+
You can define your own blocks using the `define` command. Here is a block that creates a five-pointed star:
9+
10+
```swift
11+
define star {
12+
path {
13+
for 1 to 5 {
14+
point 0 -0.5
15+
rotate 1 / 5
16+
point 0 -1
17+
rotate 1 / 5
18+
}
19+
point 0 -0.5
20+
}
21+
}
22+
```
23+
24+
You can call it by simply referencing its name, like this:
25+
26+
```swift
27+
star
28+
```
29+
30+
![Star](../../images/star.png)
31+
32+
**Note:** there is a subtle distinction between the code above and the code below:
33+
34+
```swift
35+
define star path {
36+
for 1 to 5 {
37+
point 0 -0.5
38+
rotate 1 / 5
39+
point 0 -1
40+
rotate 1 / 5
41+
}
42+
point 0 -0.5
43+
}
44+
```
45+
46+
In the original code, we defined a new block symbol that creates a star-shaped path. In the code above we've defined a symbol whose value is a star-shaped path. The former code is evaluated at the point when it is *called*, whereas the latter code is evaluated at the point when it is *defined*.
47+
48+
The end-result is the same in this case, so it may seem like the distinction doesn't matter, but the advantage of the former approach is that we can add *options* to vary the behavior of the code when it is called.
49+
50+
## Options
51+
52+
To add an option to a block, you use the `option` command. This works in a similar way to the [define](symbols.md) command, but it allows the specified value to be overridden by the caller.
53+
54+
The code below extends the `star` definition with options for the radius and number of points:
55+
56+
```swift
57+
define star {
58+
option radius 1
59+
option points 5
60+
path {
61+
for 1 to points {
62+
point 0 -0.5
63+
rotate 1 / points
64+
point 0 -radius
65+
rotate 1 / points
66+
}
67+
point 0 -0.5
68+
}
69+
}
70+
```
71+
72+
Now we can use those options to create a star with 6 points if we choose:
73+
74+
```swift
75+
star {
76+
points 6
77+
radius 2
78+
}
79+
```
80+
81+
![Star](../../images/six-pointed-star.png)
82+
83+
---
84+
[Index](index.md) | Next: [Scope](scope.md)

docs/1.8.8/ios/bounds.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
Bounds
2+
---
3+
4+
ShapeScript's [size](transforms.md#size) ands [scale](transforms.md#relative-transforms) commands let you control the relative size of a shape, but sometimes it's useful to know the exact dimensions.
5+
6+
A cube of size 1 has an easily-predicted size of one world unit square, but what about a more complex shape, such as a 5-pointed star (see the [procedural paths](paths.md#procedural-paths) and [blocks](blocks.md) sections for details):
7+
8+
```swift
9+
define star path {
10+
for 1 to 5 {
11+
point 0 -0.5
12+
rotate 1 / 5
13+
point 0 -1
14+
rotate 1 / 5
15+
}
16+
point 0 -0.5
17+
}
18+
19+
// draw star
20+
extrude {
21+
color red
22+
star
23+
}
24+
25+
// draw cube
26+
cube {
27+
color green 0.5
28+
}
29+
```
30+
31+
![Star with unit cube](../../images/star-with-unit-cube.png)
32+
33+
We can see that the star is larger than the unit cube, but other than trial-and-error or complex math, how can we get the exact size? This is where the `bounds` [member property](expressions.md#members) comes in.
34+
35+
## Mesh Bounds
36+
37+
Paths and meshes both expose a `bounds` property that represents a bounding box around the shape. From this you can get the exact size and position needed to place a box around the star:
38+
39+
```swift
40+
define star {
41+
...
42+
}
43+
44+
// define star shape
45+
define shape extrude {
46+
color red
47+
star
48+
}
49+
50+
// draw star
51+
shape
52+
53+
// draw box around star
54+
cube {
55+
color green 0.5
56+
position shape.bounds.center
57+
size shape.bounds.size
58+
}
59+
```
60+
61+
![Star with fitted cube](../../images/star-with-fitted-cube.png)
62+
63+
## Path Bounds
64+
65+
In the example above we computed the bounds of a solid `mesh` (an extruded star-shaped `path`) but you can also get the bounds of a `path` directly. The following code draws the star path inside its bounding rectangle:
66+
67+
```swift
68+
define star {
69+
...
70+
}
71+
72+
// draw star
73+
star
74+
75+
// draw rectangle around star
76+
square {
77+
position shape.bounds.center
78+
size shape.bounds.size
79+
}
80+
```
81+
82+
![Star with fitted rectangle](../../images/star-with-fitted-rect.png)
83+
84+
## Bounds Members
85+
86+
The `bounds` member property has the following sub-properties that you can use:
87+
88+
* `min` - The position of the corner of the box with the smallest X, Y and Z values relative to the origin.
89+
* `max` - The position of the corner of the box with the largest X, Y and Z values relative to the origin.
90+
* `center` - The position of the center of the box relative to the origin.
91+
* `size` - The size (width, height and depth) of the box in world units.
92+
* `width` - The width of the box along the X axis (equivalent to `size.width`)
93+
* `height` - The height of the box along the Y axis (equivalent to `size.height`)
94+
* `depth` - The depth of the box along the Z axis (equivalent to `size.depth`)
95+
96+
So, for example, to get the height of a shape, you could use:
97+
98+
```swift
99+
print someShape.bounds.size.height
100+
```
101+
102+
or just:
103+
104+
```swift
105+
print someShape.bounds.height
106+
```
107+
108+
And to get the X coordinate of its rightmost edge you could use:
109+
110+
```swift
111+
print someShape.bounds.max.x
112+
```
113+
114+
---
115+
[Index](index.md) | Next: [Meshes](meshes.md)

0 commit comments

Comments
 (0)