-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Dimitris Zervas <[email protected]>
- Loading branch information
Showing
5 changed files
with
586 additions
and
530 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,119 +1,234 @@ | ||
import { Direction, IDType, MessageResult, Mode, Plane, PlaneDescription } from "cadmium"; | ||
import { sendWasmMessage } from "./projectUtils"; | ||
import {Direction, IDType, MessageResult, Mode, Plane, PlaneDescription} from "cadmium" | ||
import {sendWasmMessage} from "./projectUtils" | ||
|
||
interface ProjectRename { new_name: string }; | ||
interface ProjectRename { | ||
new_name: string | ||
} | ||
export function projectRename(new_name: string): MessageResult { | ||
const message: Message = { ProjectRename: { new_name } } | ||
return sendWasmMessage(message) | ||
const message: Message = {ProjectRename: {new_name}} | ||
return sendWasmMessage(message) | ||
} | ||
interface WorkbenchRename { | ||
workbench_id: IDType | ||
new_name: string | ||
} | ||
interface WorkbenchRename { workbench_id: IDType, new_name: string }; | ||
export function workbenchRename(workbench_id: IDType, new_name: string): MessageResult { | ||
const message: Message = { WorkbenchRename: { workbench_id, new_name } } | ||
return sendWasmMessage(message) | ||
const message: Message = {WorkbenchRename: {workbench_id, new_name}} | ||
return sendWasmMessage(message) | ||
} | ||
interface WorkbenchPointAdd { | ||
workbench_id: IDType | ||
x: number | ||
y: number | ||
z: number | ||
} | ||
interface WorkbenchPointAdd { workbench_id: IDType, x: number, y: number, z: number }; | ||
export function workbenchPointAdd(workbench_id: IDType, x: number, y: number, z: number): MessageResult { | ||
const message: Message = { WorkbenchPointAdd: { workbench_id, x, y, z } } | ||
return sendWasmMessage(message) | ||
const message: Message = {WorkbenchPointAdd: {workbench_id, x, y, z}} | ||
return sendWasmMessage(message) | ||
} | ||
interface WorkbenchPlaneAdd { | ||
workbench_id: IDType | ||
plane: Plane | ||
width: number | ||
height: number | ||
} | ||
interface WorkbenchPlaneAdd { workbench_id: IDType, plane: Plane, width: number, height: number }; | ||
export function workbenchPlaneAdd(workbench_id: IDType, plane: Plane, width: number, height: number): MessageResult { | ||
const message: Message = { WorkbenchPlaneAdd: { workbench_id, plane, width, height } } | ||
return sendWasmMessage(message) | ||
const message: Message = {WorkbenchPlaneAdd: {workbench_id, plane, width, height}} | ||
return sendWasmMessage(message) | ||
} | ||
interface WorkbenchSketchAdd { | ||
workbench_id: IDType | ||
plane_description: PlaneDescription | ||
} | ||
interface WorkbenchSketchAdd { workbench_id: IDType, plane_description: PlaneDescription }; | ||
export function workbenchSketchAdd(workbench_id: IDType, plane_description: PlaneDescription): MessageResult { | ||
const message: Message = { WorkbenchSketchAdd: { workbench_id, plane_description } } | ||
return sendWasmMessage(message) | ||
const message: Message = {WorkbenchSketchAdd: {workbench_id, plane_description}} | ||
return sendWasmMessage(message) | ||
} | ||
interface WorkbenchSketchSetPlane { | ||
workbench_id: IDType | ||
sketch_id: IDType | ||
plane_description: PlaneDescription | ||
} | ||
interface WorkbenchSketchSetPlane { workbench_id: IDType, sketch_id: IDType, plane_description: PlaneDescription }; | ||
export function WorkbenchSketchSetPlane(workbench_id: IDType, sketch_id: IDType, plane_description: PlaneDescription): MessageResult { | ||
const message: Message = { WorkbenchSketchSetPlane: { workbench_id, sketch_id, plane_description } } | ||
return sendWasmMessage(message) | ||
const message: Message = {WorkbenchSketchSetPlane: {workbench_id, sketch_id, plane_description}} | ||
return sendWasmMessage(message) | ||
} | ||
interface WorkbenchPointUpdate { | ||
workbench_id: IDType | ||
point_id: IDType | ||
x: number | ||
y: number | ||
z: number | ||
} | ||
interface WorkbenchPointUpdate { workbench_id: IDType, point_id: IDType, x: number, y: number, z: number }; | ||
export function workbenchPointUpdate(workbench_id: IDType, point_id: IDType, x: number, y: number, z: number): MessageResult { | ||
const message: Message = { WorkbenchPointUpdate: { workbench_id, point_id, x, y, z } } | ||
return sendWasmMessage(message) | ||
const message: Message = {WorkbenchPointUpdate: {workbench_id, point_id, x, y, z}} | ||
return sendWasmMessage(message) | ||
} | ||
interface SketchAddPoint { workbench_id: IDType, sketch_id: IDType, x: number, y: number, z: number }; | ||
export function sketchAddPoint(workbench_id: IDType, sketch_id: IDType, x: number, y: number, z: number): MessageResult { | ||
const message: Message = { SketchAddPoint: { workbench_id, sketch_id, x, y, z } } | ||
return sendWasmMessage(message) | ||
interface SketchAddPoint { | ||
workbench_id: IDType | ||
sketch_id: IDType | ||
x: number | ||
y: number | ||
z: number | ||
} | ||
interface SketchAddArc { workbench_id: IDType, sketch_id: IDType, center: IDType, radius: number, clockwise: boolean, start_angle: number, end_angle: number }; | ||
export function sketchAddArc(workbench_id: IDType, sketch_id: IDType, center: IDType, radius: number, clockwise: boolean, start_angle: number, end_angle: number): MessageResult { | ||
const message: Message = { SketchAddArc: { workbench_id, sketch_id, center, radius, clockwise, start_angle, end_angle } } | ||
return sendWasmMessage(message) | ||
export function sketchAddPoint(workbench_id: IDType, sketch_id: IDType, x: number, y: number, z: number): MessageResult { | ||
const message: Message = {SketchAddPoint: {workbench_id, sketch_id, x, y, z}} | ||
return sendWasmMessage(message) | ||
} | ||
interface SketchAddArc { | ||
workbench_id: IDType | ||
sketch_id: IDType | ||
center: IDType | ||
radius: number | ||
clockwise: boolean | ||
start_angle: number | ||
end_angle: number | ||
} | ||
export function sketchAddArc( | ||
workbench_id: IDType, | ||
sketch_id: IDType, | ||
center: IDType, | ||
radius: number, | ||
clockwise: boolean, | ||
start_angle: number, | ||
end_angle: number, | ||
): MessageResult { | ||
const message: Message = {SketchAddArc: {workbench_id, sketch_id, center, radius, clockwise, start_angle, end_angle}} | ||
return sendWasmMessage(message) | ||
} | ||
interface SketchAddCircle { | ||
workbench_id: IDType | ||
sketch_id: IDType | ||
center: IDType | ||
radius: number | ||
} | ||
interface SketchAddCircle { workbench_id: IDType, sketch_id: IDType, center: IDType, radius: number }; | ||
export function sketchAddCircle(workbench_id: IDType, sketch_id: IDType, center: IDType, radius: number): MessageResult { | ||
const message: Message = { SketchAddCircle: { workbench_id, sketch_id, center, radius } } | ||
return sendWasmMessage(message) | ||
const message: Message = {SketchAddCircle: {workbench_id, sketch_id, center, radius}} | ||
return sendWasmMessage(message) | ||
} | ||
interface SketchAddLine { | ||
workbench_id: IDType | ||
sketch_id: IDType | ||
start: IDType | ||
end: IDType | ||
} | ||
interface SketchAddLine { workbench_id: IDType, sketch_id: IDType, start: IDType, end: IDType }; | ||
export function sketchAddLine(workbench_id: IDType, sketch_id: IDType, start: IDType, end: IDType): MessageResult { | ||
const message: Message = { SketchAddLine: { workbench_id, sketch_id, start, end } } | ||
return sendWasmMessage(message) | ||
const message: Message = {SketchAddLine: {workbench_id, sketch_id, start, end}} | ||
return sendWasmMessage(message) | ||
} | ||
interface SketchAddRectangle { | ||
workbench_id: IDType | ||
sketch_id: IDType | ||
start: IDType | ||
end: IDType | ||
} | ||
export function sketchAddRectangle(workbench_id: IDType, sketch_id: IDType, start: IDType, end: IDType): MessageResult { | ||
const message: Message = {SketchAddRectangle: {workbench_id, sketch_id, start, end}} | ||
return sendWasmMessage(message) | ||
} | ||
interface SketchAddRectangle { workbench_id: IDType, sketch_id: IDType, start: IDType, end: IDType }; | ||
export function sketchAddRectangle( workbench_id: IDType, sketch_id: IDType, start: IDType, end: IDType ): MessageResult { | ||
const message: Message = { SketchAddRectangle: { workbench_id, sketch_id, start, end } } | ||
return sendWasmMessage(message) | ||
interface SketchDeleteCompound { | ||
workbench_id: IDType | ||
sketch_id: IDType | ||
compound_id: IDType | ||
} | ||
interface SketchDeleteCompound { workbench_id: IDType, sketch_id: IDType, compound_id: IDType }; | ||
export function sketchDeleteCompound(workbench_id: IDType, sketch_id: IDType, compound_id: IDType): MessageResult { | ||
const message: Message = { SketchDeleteCompound: { workbench_id, sketch_id, compound_id } } | ||
return sendWasmMessage(message) | ||
const message: Message = {SketchDeleteCompound: {workbench_id, sketch_id, compound_id}} | ||
return sendWasmMessage(message) | ||
} | ||
interface SketchDeletePrimitive { workbench_id: IDType, sketch_id: IDType, primitive_id: IDType }; | ||
export function sketchDeletePrimitive(workbench_id: IDType, sketch_id: IDType, primitive_id: IDType): MessageResult { | ||
const message: Message = { SketchDeletePrimitive: { workbench_id, sketch_id, primitive_id } } | ||
return sendWasmMessage(message) | ||
interface SketchDeletePrimitive { | ||
workbench_id: IDType | ||
sketch_id: IDType | ||
primitive_id: IDType | ||
} | ||
interface FeatureExtrusionAdd { workbench_id: IDType, sketch_id: IDType, faces: IDType[], length: number, offset: number, direction: Direction, mode: Mode }; | ||
export function featureExtrusionAdd(workbench_id: IDType, sketch_id: IDType, faces: IDType[], length: number, offset: number, direction: Direction, mode: Mode): MessageResult { | ||
const message: Message = { FeatureExtrusionAdd: { workbench_id, sketch_id, faces, length, offset, direction, mode } } | ||
return sendWasmMessage(message) | ||
export function sketchDeletePrimitive(workbench_id: IDType, sketch_id: IDType, primitive_id: IDType): MessageResult { | ||
const message: Message = {SketchDeletePrimitive: {workbench_id, sketch_id, primitive_id}} | ||
return sendWasmMessage(message) | ||
} | ||
interface FeatureExtrusionAdd { | ||
workbench_id: IDType | ||
sketch_id: IDType | ||
faces: IDType[] | ||
length: number | ||
offset: number | ||
direction: Direction | ||
mode: Mode | ||
} | ||
export function featureExtrusionAdd( | ||
workbench_id: IDType, | ||
sketch_id: IDType, | ||
faces: IDType[], | ||
length: number, | ||
offset: number, | ||
direction: Direction, | ||
mode: Mode, | ||
): MessageResult { | ||
const message: Message = {FeatureExtrusionAdd: {workbench_id, sketch_id, faces, length, offset, direction, mode}} | ||
return sendWasmMessage(message) | ||
} | ||
interface FeatureExtrusionUpdateFaces { | ||
workbench_id: IDType | ||
extrusion_id: IDType | ||
sketch_id: IDType | ||
faces: IDType[] | ||
} | ||
interface FeatureExtrusionUpdateFaces { workbench_id: IDType, extrusion_id: IDType, sketch_id: IDType, faces: IDType[] }; | ||
export function featureExtrusionUpdateFaces(workbench_id: IDType, extrusion_id: IDType, sketch_id: IDType, faces: IDType[]): MessageResult { | ||
const message: Message = { FeatureExtrusionUpdateFaces: { workbench_id, extrusion_id, sketch_id, faces } } | ||
return sendWasmMessage(message) | ||
const message: Message = {FeatureExtrusionUpdateFaces: {workbench_id, extrusion_id, sketch_id, faces}} | ||
return sendWasmMessage(message) | ||
} | ||
interface FeatureExtrusionUpdateForm { | ||
workbench_id: IDType | ||
extrusion_id: IDType | ||
length: number | ||
offset: number | ||
direction: Direction | ||
mode: Mode | ||
} | ||
export function featureExtrusionUpdateForm( | ||
workbench_id: IDType, | ||
extrusion_id: IDType, | ||
length: number, | ||
offset: number, | ||
direction: Direction, | ||
mode: Mode, | ||
): MessageResult { | ||
const message: Message = {FeatureExtrusionUpdateForm: {workbench_id, extrusion_id, length, offset, direction, mode}} | ||
return sendWasmMessage(message) | ||
} | ||
interface StepRename { | ||
workbench_id: IDType | ||
step_id: IDType | ||
new_name: string | ||
} | ||
interface FeatureExtrusionUpdateForm { workbench_id: IDType, extrusion_id: IDType, length: number, offset: number, direction: Direction, mode: Mode}; | ||
export function featureExtrusionUpdateForm(workbench_id: IDType, extrusion_id: IDType, length: number, offset: number, direction: Direction, mode: Mode): MessageResult { | ||
const message: Message = { FeatureExtrusionUpdateForm: { workbench_id, extrusion_id, length, offset, direction, mode } } | ||
return sendWasmMessage(message) | ||
} | ||
interface StepRename { workbench_id: IDType, step_id: IDType, new_name: string }; | ||
export function stepRename(workbench_id: IDType, step_id: IDType, new_name: string): MessageResult { | ||
const message: Message = { StepRename: { workbench_id, step_id, new_name } } | ||
return sendWasmMessage(message) | ||
const message: Message = {StepRename: {workbench_id, step_id, new_name}} | ||
return sendWasmMessage(message) | ||
} | ||
interface StepDelete { | ||
workbench_id: IDType | ||
step_id: IDType | ||
} | ||
interface StepDelete { workbench_id: IDType, step_id: IDType }; | ||
export function stepDelete(workbench_id: IDType, step_id: IDType): MessageResult { | ||
const message: Message = { StepDelete: { workbench_id, step_id } } | ||
return sendWasmMessage(message) | ||
const message: Message = {StepDelete: {workbench_id, step_id}} | ||
return sendWasmMessage(message) | ||
} | ||
|
||
export type Message = | ||
{ ProjectRename: ProjectRename } | | ||
{ WorkbenchRename: WorkbenchRename } | | ||
{ WorkbenchPointAdd: WorkbenchPointAdd } | | ||
{ WorkbenchPlaneAdd: WorkbenchPlaneAdd } | | ||
{ WorkbenchSketchAdd: WorkbenchSketchAdd } | | ||
{ WorkbenchSketchSetPlane: WorkbenchSketchSetPlane } | | ||
{ WorkbenchPointUpdate: WorkbenchPointUpdate } | | ||
{ SketchAddPoint: SketchAddPoint } | | ||
{ SketchAddArc: SketchAddArc } | | ||
{ SketchAddCircle: SketchAddCircle } | | ||
{ SketchAddLine: SketchAddLine } | | ||
{ SketchAddRectangle: SketchAddRectangle } | | ||
{ SketchDeleteCompound: SketchDeleteCompound } | | ||
{ SketchDeletePrimitive: SketchDeletePrimitive } | | ||
{ FeatureExtrusionAdd: FeatureExtrusionAdd } | | ||
{ FeatureExtrusionUpdateFaces: FeatureExtrusionUpdateFaces } | | ||
{ FeatureExtrusionUpdateForm: FeatureExtrusionUpdateForm } | | ||
{ StepRename: StepRename } | | ||
{ StepDelete: StepDelete } | ||
| {ProjectRename: ProjectRename} | ||
| {WorkbenchRename: WorkbenchRename} | ||
| {WorkbenchPointAdd: WorkbenchPointAdd} | ||
| {WorkbenchPlaneAdd: WorkbenchPlaneAdd} | ||
| {WorkbenchSketchAdd: WorkbenchSketchAdd} | ||
| {WorkbenchSketchSetPlane: WorkbenchSketchSetPlane} | ||
| {WorkbenchPointUpdate: WorkbenchPointUpdate} | ||
| {SketchAddPoint: SketchAddPoint} | ||
| {SketchAddArc: SketchAddArc} | ||
| {SketchAddCircle: SketchAddCircle} | ||
| {SketchAddLine: SketchAddLine} | ||
| {SketchAddRectangle: SketchAddRectangle} | ||
| {SketchDeleteCompound: SketchDeleteCompound} | ||
| {SketchDeletePrimitive: SketchDeletePrimitive} | ||
| {FeatureExtrusionAdd: FeatureExtrusionAdd} | ||
| {FeatureExtrusionUpdateFaces: FeatureExtrusionUpdateFaces} | ||
| {FeatureExtrusionUpdateForm: FeatureExtrusionUpdateForm} | ||
| {StepRename: StepRename} | ||
| {StepDelete: StepDelete} |
Oops, something went wrong.