Skip to content

Commit

Permalink
Merge branch 'main' into kurt-selections-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Irev-Dev authored Mar 12, 2024
2 parents 8af2359 + 8b2bf00 commit f05a121
Show file tree
Hide file tree
Showing 40 changed files with 7,310 additions and 6,507 deletions.
12,451 changes: 6,233 additions & 6,218 deletions docs/kcl/std.json

Large diffs are not rendered by default.

130 changes: 90 additions & 40 deletions docs/kcl/std.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
* [`log2`](#log2)
* [`max`](#max)
* [`min`](#min)
* [`patternCircular`](#patternCircular)
* [`patternLinear`](#patternLinear)
* [`patternCircular2d`](#patternCircular2d)
* [`patternCircular3d`](#patternCircular3d)
* [`patternLinear2d`](#patternLinear2d)
* [`patternLinear3d`](#patternLinear3d)
* [`pi`](#pi)
* [`pow`](#pow)
* [`segAng`](#segAng)
Expand Down Expand Up @@ -7170,34 +7172,32 @@ min(args: [number]) -> number



### patternCircular
### patternCircular2d

A Circular pattern.
A circular pattern on a 2D sketch.



```
patternCircular(data: CircularPatternData, geometry: Geometry) -> Geometries
patternCircular2d(data: CircularPattern2dData, sketch_group: SketchGroup) -> [SketchGroup]
```

#### Arguments

* `data`: `CircularPatternData` - Data for a circular pattern. (REQUIRED)
* `data`: `CircularPattern2dData` - Data for a circular pattern on a 2D sketch. (REQUIRED)
```
{
// The arc angle (in degrees) to place the repetitions. Must be greater than 0.
arcDegrees: number,
// The axis around which to make the pattern. This is a 2D vector.
axis: [number, number],
// The center about which to make th pattern. This is a 3D vector.
center: [number, number, number],
// The center about which to make th pattern. This is a 2D vector.
center: [number, number],
// The number of repetitions. Must be greater than 0. This excludes the original entity. For example, if `repetitions` is 1, the original entity will be copied once.
repetitions: number,
// Whether or not to rotate the duplicates as they are copied.
rotateDuplicates: string,
}
```
* `geometry`: `Geometry` - A geometry. (REQUIRED)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```
{
// The plane id or face id of the sketch group.
Expand Down Expand Up @@ -7276,7 +7276,6 @@ patternCircular(data: CircularPatternData, geometry: Geometry) -> Geometries
// The to point.
to: [number, number],
},
type: "SketchGroup",
// The paths in the sketch group.
value: [{
// The from point.
Expand Down Expand Up @@ -7360,7 +7359,44 @@ patternCircular(data: CircularPatternData, geometry: Geometry) -> Geometries
y: number,
z: number,
},
} |
}
```

#### Returns

* `[SketchGroup]`



### patternCircular3d

A circular pattern on a 3D model.



```
patternCircular3d(data: CircularPattern3dData, extrude_group: ExtrudeGroup) -> [ExtrudeGroup]
```

#### Arguments

* `data`: `CircularPattern3dData` - Data for a circular pattern on a 3D model. (REQUIRED)
```
{
// The arc angle (in degrees) to place the repetitions. Must be greater than 0.
arcDegrees: number,
// The axis around which to make the pattern. This is a 3D vector.
axis: [number, number, number],
// The center about which to make th pattern. This is a 3D vector.
center: [number, number, number],
// The number of repetitions. Must be greater than 0. This excludes the original entity. For example, if `repetitions` is 1, the original entity will be copied once.
repetitions: number,
// Whether or not to rotate the duplicates as they are copied.
rotateDuplicates: string,
}
```
* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED)
```
{
// The id of the extrusion end cap
endCapId: uuid,
Expand Down Expand Up @@ -7439,7 +7475,6 @@ patternCircular(data: CircularPatternData, geometry: Geometry) -> Geometries
}],
// The id of the extrusion start cap
startCapId: uuid,
type: "ExtrudeGroup",
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
Expand Down Expand Up @@ -7494,31 +7529,23 @@ patternCircular(data: CircularPatternData, geometry: Geometry) -> Geometries

#### Returns

* `Geometries` - A set of geometry.
```
{
type: "SketchGroups",
} |
{
type: "ExtrudeGroups",
}
```
* `[ExtrudeGroup]`



### patternLinear
### patternLinear2d

A linear pattern.
A linear pattern on a 2D sketch.



```
patternLinear(data: LinearPatternData, geometry: Geometry) -> Geometries
patternLinear2d(data: LinearPattern2dData, sketch_group: SketchGroup) -> [SketchGroup]
```

#### Arguments

* `data`: `LinearPatternData` - Data for a linear pattern. (REQUIRED)
* `data`: `LinearPattern2dData` - Data for a linear pattern on a 2D sketch. (REQUIRED)
```
{
// The axis of the pattern. This is a 2D vector.
Expand All @@ -7529,7 +7556,7 @@ patternLinear(data: LinearPatternData, geometry: Geometry) -> Geometries
repetitions: number,
}
```
* `geometry`: `Geometry` - A geometry. (REQUIRED)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```
{
// The plane id or face id of the sketch group.
Expand Down Expand Up @@ -7608,7 +7635,6 @@ patternLinear(data: LinearPatternData, geometry: Geometry) -> Geometries
// The to point.
to: [number, number],
},
type: "SketchGroup",
// The paths in the sketch group.
value: [{
// The from point.
Expand Down Expand Up @@ -7692,7 +7718,40 @@ patternLinear(data: LinearPatternData, geometry: Geometry) -> Geometries
y: number,
z: number,
},
} |
}
```

#### Returns

* `[SketchGroup]`



### patternLinear3d

A linear pattern on a 3D model.



```
patternLinear3d(data: LinearPattern3dData, extrude_group: ExtrudeGroup) -> [ExtrudeGroup]
```

#### Arguments

* `data`: `LinearPattern3dData` - Data for a linear pattern on a 3D model. (REQUIRED)
```
{
// The axis of the pattern.
axis: [number, number, number],
// The distance between each repetition. This can also be referred to as spacing.
distance: number,
// The number of repetitions. Must be greater than 0. This excludes the original entity. For example, if `repetitions` is 1, the original entity will be copied once.
repetitions: number,
}
```
* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED)
```
{
// The id of the extrusion end cap
endCapId: uuid,
Expand Down Expand Up @@ -7771,7 +7830,6 @@ patternLinear(data: LinearPatternData, geometry: Geometry) -> Geometries
}],
// The id of the extrusion start cap
startCapId: uuid,
type: "ExtrudeGroup",
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
Expand Down Expand Up @@ -7826,15 +7884,7 @@ patternLinear(data: LinearPatternData, geometry: Geometry) -> Geometries

#### Returns

* `Geometries` - A set of geometry.
```
{
type: "SketchGroups",
} |
{
type: "ExtrudeGroups",
}
```
* `[ExtrudeGroup]`



Expand Down
32 changes: 3 additions & 29 deletions src/components/FileTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ function getIndentationCSS(level: number) {
return `calc(1rem * ${level + 1})`
}

// an OS-agnostic way to get the basename of the path.
export function basename(path: string): string {
// Regular expression to match the last portion of the path, taking into account both POSIX and Windows delimiters
const re = /[^\\/]+$/
const match = path.match(re)
return match ? match[0] : ''
}

function RenameForm({
fileOrDir,
setIsRenaming,
Expand Down Expand Up @@ -156,7 +148,7 @@ const FileTreeItem = ({
level?: number
}) => {
const { send, context } = useFileContext()
const { lspClients } = useLspContext()
const { onFileOpen, onFileClose } = useLspContext()
const navigate = useNavigate()
const [isRenaming, setIsRenaming] = useState(false)
const [isConfirmingDelete, setIsConfirmingDelete] = useState(false)
Expand Down Expand Up @@ -185,26 +177,8 @@ const FileTreeItem = ({
)
} else {
// Let the lsp servers know we closed a file.
const currentFilePath = basename(currentFile?.path || 'main.kcl')
lspClients.forEach((lspClient) => {
lspClient.textDocumentDidClose({
textDocument: {
uri: `file:///${currentFilePath}`,
},
})
})
const newFilePath = basename(fileOrDir.path)
// Then let the clients know we opened a file.
lspClients.forEach((lspClient) => {
lspClient.textDocumentDidOpen({
textDocument: {
uri: `file:///${newFilePath}`,
languageId: 'kcl',
version: 1,
text: '',
},
})
})
onFileClose(currentFile?.path || null, project?.path || null)
onFileOpen(fileOrDir.path, project?.path || null)

// Open kcl files
navigate(`${paths.FILE}/${encodeURIComponent(fileOrDir.path)}`)
Expand Down
Loading

0 comments on commit f05a121

Please sign in to comment.