Zum Inhalt springen
CADCAMFUN
Doku

Dokumentation

Werkzeugwege

Gespeicherte Bearbeitungsprogramme, Zeichnungszuordnungen und validierte tragbare Fertigungsdokumente.

Automatisch aus dem Englischen übersetzt. Englisches Original ansehen

Playground

Senden Sie diese Anfragen an Ihren eigenen laufenden Sidecar. Werte bleiben in diesem Browser.

Nicht verbunden
Wie das funktioniert

Der Sidecar lauscht an einem beim Start ausgewählten Loopback-Port und gibt ihn dort aus ready linie; Verwenden Sie diese URL und die CADCAMFUN_TOKEN es wurde damit begonnen. Anfragen gehen direkt von dieser Seite an diese Adresse.

Der Sidecar sendet CORS-Header nur an die Tauri-Ursprünge und an http://localhost oder http://127.0.0.1 auf jedem Port. Von den gehosteten Dokumenten aus blockiert der Browser die Antwort, also führen Sie die Dokumente lokal aus (bun run dev in packages/web), um den Spielplatz zu nutzen, oder kopieren Sie die Anfrage als Curl. Um zu experimentieren, ohne echte Daten zu berühren, starten Sie den Sidecar mit CADCAMFUN_DATA_DIR zeigte auf ein Wegwerfverzeichnis – siehe die API-Komplettlösung.

Operationen

9 Endpunkte in der toolpaths gruppe, generiert aus der eigenen Gruppe des Sidecars OpenAPI-Dokument. Geschützte Operationen dauern Authorization: Bearer $CADCAMFUN_TOKEN; sehen authentifizierung. Verhalten und Grenzen sind in das Subsystemhandbuch.

erhalten /api/toolpaths toolpaths.list
post /api/toolpaths toolpaths.create
erhalten /api/toolpaths/{id} toolpaths.get
setzen /api/toolpaths/{id} toolpaths.update
löschen /api/toolpaths/{id} toolpaths.remove
erhalten /api/toolpaths/{id}/setup-sheet toolpaths.setupSheet
post /api/toolpaths/post-check toolpaths.postCheck
erhalten /api/drawings/{id}/toolpaths toolpaths.listForDrawing
post /api/drawings/{id}/toolpaths toolpaths.createForDrawing
Werkzeugwegoperationen in 3D Zum Orbit ziehen · zum Zoomen scrollen · zum Schwenken mit der rechten Maustaste ziehen
Ein Block pro Vorgang (9), gestapelt pro Ressourcenabschnitt dieser Seite und nach Methode gefärbt: grün GET, orange POST, blau PUT, violett PATCH, rot DELETE. Wird zur Erstellungszeit aus dem OpenAPI-Dokument generiert.

/api/toolpaths

erhalten /api/toolpaths # toolpaths.list

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
projectId abfrage zeichenfolge | null optional
typ abfrage zeichenfolge | null optional
operationType abfrage zeichenfolge | null optional
suchen abfrage zeichenfolge | null optional
öffentlich abfrage zeichenfolge | null optional
Antworten
200 Array<Objekt> application/json
Array<{
  id: string
  name: string
  description: string | null
  data: unknown
  type: string | null
  operationType: string | null
  gcode: string | null
  thumbnail: string | null
  isPublic: boolean
  projectId: string
  createdAt: string
  updatedAt: string
  createdBy: string
  drawingId: string | null
  materialId: string | null
  toolId: string | null
  machineConfigId: string | null
}>
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
Beispielantwort erfasst · 200
GET /api/toolpaths
[]
SDK-Beispiel
toolpaths.list
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// ToolpathsListInput
const result = await client.toolpaths.list({})
curl
GET /api/toolpaths
curl --request GET "${CADCAMFUN_URL}/api/toolpaths" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus
post /api/toolpaths # toolpaths.create

Erfordert Authorization: Bearer <token>.

Anforderungstext · erforderlich · application/json
{
  name?: string | null
  description?: string | null
  data?: unknown | null
  gcode?: string | null
  projectId?: string | null
  type?: string | null
  operationType?: string | null
  isPublic?: boolean | null
  thumbnail?: string | null
  materialId?: string | null
  machineConfigId?: string | null
  toolId?: string | null
  simulation?: unknown | null
  baseUpdatedAt?: string | null
}
Antworten
201 objekt application/json
{
  id: string
  name: string
  description: string | null
  data: unknown
  type: string | null
  operationType: string | null
  gcode: string | null
  thumbnail: string | null
  isPublic: boolean
  projectId: string
  createdAt: string
  updatedAt: string
  createdBy: string
  drawingId: string | null
  materialId: string | null
  toolId: string | null
  machineConfigId: string | null
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
toolpaths.create
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// ToolpathsCreateInput
const result = await client.toolpaths.create({
  name: "",
  description: "",
  data: null,
  gcode: "",
  projectId: "",
  type: "",
  operationType: "",
  isPublic: false,
  thumbnail: "",
  materialId: "",
  machineConfigId: "",
  toolId: "",
  simulation: null,
  baseUpdatedAt: ""
})
curl
POST /api/toolpaths
curl --request POST "${CADCAMFUN_URL}/api/toolpaths" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Probieren Sie es aus
erhalten /api/toolpaths/{id} # toolpaths.get

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
Antworten
200 objekt application/json
{
  id: string
  name: string
  description: string | null
  data: unknown
  type: string | null
  operationType: string | null
  gcode: string | null
  thumbnail: string | null
  isPublic: boolean
  projectId: string
  createdAt: string
  updatedAt: string
  createdBy: string
  drawingId: string | null
  materialId: string | null
  toolId: string | null
  machineConfigId: string | null
  project: {
    id: string
    name: string
    ownerId: string
  }
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
toolpaths.get
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// ToolpathsGetInput
const result = await client.toolpaths.get({
  id: "<id>"
})
curl
GET /api/toolpaths/{id}
curl --request GET "${CADCAMFUN_URL}/api/toolpaths/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus
setzen /api/toolpaths/{id} # toolpaths.update

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
Anforderungstext · erforderlich · application/json
{
  name?: string | null
  description?: string | null
  data?: unknown | null
  gcode?: string | null
  projectId?: string | null
  type?: string | null
  operationType?: string | null
  isPublic?: boolean | null
  thumbnail?: string | null
  materialId?: string | null
  machineConfigId?: string | null
  toolId?: string | null
  simulation?: unknown | null
  baseUpdatedAt?: string | null
}
Antworten
200 objekt application/json
{
  id: string
  name: string
  description: string | null
  data: unknown
  type: string | null
  operationType: string | null
  gcode: string | null
  thumbnail: string | null
  isPublic: boolean
  projectId: string
  createdAt: string
  updatedAt: string
  createdBy: string
  drawingId: string | null
  materialId: string | null
  toolId: string | null
  machineConfigId: string | null
  message: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
toolpaths.update
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// ToolpathsUpdateInput
const result = await client.toolpaths.update({
  id: "<id>",
  name: "",
  description: "",
  data: null,
  gcode: "",
  projectId: "",
  type: "",
  operationType: "",
  isPublic: false,
  thumbnail: "",
  materialId: "",
  machineConfigId: "",
  toolId: "",
  simulation: null,
  baseUpdatedAt: ""
})
curl
PUT /api/toolpaths/{id}
curl --request PUT "${CADCAMFUN_URL}/api/toolpaths/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Probieren Sie es aus
löschen /api/toolpaths/{id} # toolpaths.remove

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
Antworten
200 objekt application/json
{
  message: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
toolpaths.remove
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// ToolpathsRemoveInput
const result = await client.toolpaths.remove({
  id: "<id>"
})
curl
LÖSCHEN /api/toolpaths/{id}
curl --request DELETE "${CADCAMFUN_URL}/api/toolpaths/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus
erhalten /api/toolpaths/{id}/setup-sheet # toolpaths.setupSheet

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
Antworten
200 objekt application/json
{
  data: {
    title: string
    jobId: string
    release: "blocked" | "preview" | "verified-program"
    material: {
      name: string
      iso: string
    }
    machine: {
      name: string
      post: string
    }
    setup: {
      orientation: string
      workOffset: string
      origin: {
        x: number
        y: number
        z: number
      }
      stock: {
        x: number
        y: number
        z: number
      }
    }
    tools: Array<{
      number: number
      id: string
      name: string
      kind: string
      diameter: number
      flutes: number
      fluteLength: number
      shankDiameter: number
      stickout: number
      holder?: string
      operations: string[]
      seconds: number
    }>
    operations: Array<{
      index: number
      id: string
      name: string
      strategy: string
      status: "ok" | "failed"
      tool?: number
      seconds: number
      cutLength: number
      removedVolume: number
      rpm?: number
      feed?: number
      ap?: number
      ae?: number
      warnings: string[]
    }>
    totals: {
      tools: number
      operations: number
      cycleSeconds: number
      cuttingSeconds: number
      removedVolume: number
    }
    claims: Array<{
      id: string
      status: string
      detail: string
    }>
    notes: string[]
    issues: Array<{
      severity: string
      message: string
    }>
    identity: {
      job: string
      part: string
      nc: string
      algorithm: string
    }
    titleBlock?: {
      [key: string]: string | number
    }
  }
  html: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
beispiel abrufen
toolpaths.setupSheet
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/toolpaths/${id}/setup-sheet`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
GET /api/toolpaths/{id}/setup-sheet
curl --request GET "${CADCAMFUN_URL}/api/toolpaths/<id>/setup-sheet" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus

/api/toolpaths/post-check

post /api/toolpaths/post-check # toolpaths.postCheck

Erfordert Authorization: Bearer <token>.

Anforderungstext · erforderlich · application/json
{
  definition: unknown
  sample?: boolean
}
Antworten
200 objekt application/json
{
  valid: boolean
  issues: Array<{
    path: string
    message: string
  }>
  sample?: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
beispiel abrufen
toolpaths.postCheck
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/toolpaths/post-check`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
POST /api/toolpaths/post-check
curl --request POST "${CADCAMFUN_URL}/api/toolpaths/post-check" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Probieren Sie es aus

/api/drawings

erhalten /api/drawings/{id}/toolpaths # toolpaths.listForDrawing

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
Antworten
200 Array<Objekt> application/json
Array<{
  id: string
  name: string
  description: string | null
  data: unknown
  type: string | null
  operationType: string | null
  gcode: string | null
  thumbnail: string | null
  isPublic: boolean
  projectId: string
  createdAt: string
  updatedAt: string
  createdBy: string
  drawingId: string | null
  materialId: string | null
  toolId: string | null
  machineConfigId: string | null
  Material: {
    id: string
    name: string
  } | null
  MachineConfig: {
    id: string
    name: string
    type: string
  } | null
  Tool: {
    id: string
    name: string
    type: string
    diameter: number | "Infinity" | "-Infinity" | "NaN"
  } | null
}>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
toolpaths.listForDrawing
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// ToolpathsListForDrawingInput
const result = await client.toolpaths.listForDrawing({
  id: "<id>"
})
curl
GET /api/drawings/{id}/toolpaths
curl --request GET "${CADCAMFUN_URL}/api/drawings/<id>/toolpaths" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus
post /api/drawings/{id}/toolpaths # toolpaths.createForDrawing

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
Anforderungstext · erforderlich · application/json
{
  name?: string | null
  description?: string | null
  data?: unknown | null
  gcode?: string | null
  projectId?: string | null
  type?: string | null
  operationType?: string | null
  isPublic?: boolean | null
  thumbnail?: string | null
  materialId?: string | null
  machineConfigId?: string | null
  toolId?: string | null
  simulation?: unknown | null
  baseUpdatedAt?: string | null
}
Antworten
201 objekt application/json
{
  id: string
  name: string
  description: string | null
  data: unknown
  type: string | null
  operationType: string | null
  gcode: string | null
  thumbnail: string | null
  isPublic: boolean
  projectId: string
  createdAt: string
  updatedAt: string
  createdBy: string
  drawingId: string | null
  materialId: string | null
  toolId: string | null
  machineConfigId: string | null
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
toolpaths.createForDrawing
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// ToolpathsCreateForDrawingInput
const result = await client.toolpaths.createForDrawing({
  id: "<id>",
  name: "",
  description: "",
  data: null,
  gcode: "",
  projectId: "",
  type: "",
  operationType: "",
  isPublic: false,
  thumbnail: "",
  materialId: "",
  machineConfigId: "",
  toolId: "",
  simulation: null,
  baseUpdatedAt: ""
})
curl
POST /api/drawings/{id}/toolpaths
curl --request POST "${CADCAMFUN_URL}/api/drawings/<id>/toolpaths" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Probieren Sie es aus

Schemata

Benannte Schemata, die über die Parameter, Körper und Antworten dieser Gruppe erreichbar sind. A ? markiert ein optionales Feld; | null markiert ein Feld, das möglicherweise mit einem Nullwert vorhanden ist.

BadRequestEncoded
{
  _tag: "BadRequest"
  message: string
}
ConflictEncoded
{
  _tag: "Conflict"
  message: string
}
ForbiddenEncoded
{
  _tag: "Forbidden"
  message: string
}
InternalErrorEncoded
{
  _tag: "InternalError"
  message: string
}
NotFoundEncoded
{
  _tag: "NotFound"
  message: string
}
UnauthorizedEncoded
{
  _tag: "Unauthorized"
  message: string
}

Ich rufe diese Gruppe an

Vorgangs-IDs haben die Form toolpaths.<name>. Das generierte Promise SDK (@cadcamfun/api/sdk) entlarvt die meisten von ihnen als client.<namespace>.<method>(input), wo input ist ein flaches Objekt aus Pfadparametern und Körperfeldern; Das SDK-Beispiel jeder Karte zeigt den genauen Zugriffs- und Eingabetyp. Mehrteilige Uploads, Binär- oder JavaScript-Antworten und unformatierte Webhooks werden nicht generiert; Diese Karten zeigen fetch stattdessen.

Fehler vom Promise SDK
import { CadCam, ClientError } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

try {
  await client.projects.list()
} catch (error) {
  if (error instanceof ClientError) {
    // Transport | UnexpectedStatus | UnsupportedContentType | MalformedResponse | SseEventTooLarge
  } else {
    // a declared error body: switch on error._tag
  }
}

Fehlerbehebung

SymptomWahrscheinliche UrsacheFix
401 bei jedem AufrufToken von einem früheren Start oder fehlt Bearer präfixSchicken Authorization: Bearer <token> mit dem Token wurde der Sidecar gestartet.
400 bevor etwas passiertText oder Parameter stimmen nicht mit dem Schema übereinVergleichen Sie die Nutzlast mit dem Anforderungsschema auf der Karte.
403 oder 404 bei einem Datensatz, den du woanders siehstDas amtierende Konto ist unterschiedlichSchicken Sie das Richtige x-session-token, oder verwenden Sie das lokale Profil, das Eigentümer des Datensatzes ist.
409Widersprüchlicher Status, z. B. ein doppelter Name oder ein veralteter ZweigkopfLesen Sie die Ressource erneut und versuchen Sie es erneut mit den aktuellen Daten.
Versuchen Sie es mit der Meldung „Von CORS blockiert“.Die Dokumente werden von einem Nicht-Loopback-Ursprung bereitgestelltFühren Sie die Dokumente lokal aus oder kopieren Sie die Anfrage als Curl.
Verbindung abgelehntDer Sidecar wurde an einem neuen Port neu gestartetLesen Sie den Port neu ready Zeile.