Zum Inhalt springen
CADCAMFUN
Doku

Dokumentation

Arbeitsplatz

Schreibgeschützte Projektzeichnungen, Komponenten, Werkzeugwege, Bibliotheksressourcen und begrenzte Vorschauen für Begleitkunden.

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

8 Endpunkte in der workspace 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/projects/{id}/workspace/drawings workspace.drawings
erhalten /api/projects/{id}/workspace/drawings/{drawingId}/preview workspace.drawingPreview
erhalten /api/projects/{id}/workspace/components workspace.components
erhalten /api/projects/{id}/workspace/components/{componentId}/preview workspace.componentPreview
erhalten /api/projects/{id}/workspace/toolpaths workspace.toolpaths
erhalten /api/projects/{id}/workspace/toolpaths/{toolpathId} workspace.toolpath
erhalten /api/projects/{id}/workspace/toolpaths/{toolpathId}/preview workspace.toolpathPreview
erhalten /api/projects/{id}/workspace/library workspace.library
Arbeitsbereichsvorgänge in 3D Zum Orbit ziehen · zum Zoomen scrollen · zum Schwenken mit der rechten Maustaste ziehen
Ein Block pro Vorgang (8), 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/projects

erhalten /api/projects/{id}/workspace/drawings # workspace.drawings

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
Antworten
200 Array<Objekt> application/json
Array<{
  id: string
  name: string
  subtitle: string | null
  updatedAt: string
}>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
beispiel abrufen
workspace.drawings
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/drawings`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
GET /api/projects/{id}/workspace/drawings
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/drawings" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus
erhalten /api/projects/{id}/workspace/drawings/{drawingId}/preview # workspace.drawingPreview

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
drawingId weg zeichenfolge erforderlich
Antworten
200 objekt application/json
{
  positions: Array<number | "Infinity" | "-Infinity" | "NaN">
  indices: Array<number | "Infinity" | "-Infinity" | "NaN">
  normals: Array<number | "Infinity" | "-Infinity" | "NaN">
  bounds: {
    min: unknown[]
    max: unknown[]
  }
  parts: Array<{
    id: string
    name: string
    triangleStart: number | "Infinity" | "-Infinity" | "NaN"
    triangleCount: number | "Infinity" | "-Infinity" | "NaN"
  }>
  truncated: boolean
  revision: string
  features?: Array<{
    elementId: string
    name: string
    features: Array<{
      id: string
      type: string
      parameters: Array<{
        key: string
        value: string
      }>
    }>
  }>
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
beispiel abrufen
workspace.drawingPreview
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/drawings/${drawingId}/preview`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
GET /api/projects/{id}/workspace/drawings/{drawingId}/preview
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/drawings/<drawingId>/preview" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus
erhalten /api/projects/{id}/workspace/components # workspace.components

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
Antworten
200 Array<Objekt> application/json
Array<{
  id: string
  name: string
  subtitle: string | null
  updatedAt: string
}>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
beispiel abrufen
workspace.components
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/components`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
GET /api/projects/{id}/workspace/components
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/components" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus
erhalten /api/projects/{id}/workspace/components/{componentId}/preview # workspace.componentPreview

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
componentId weg zeichenfolge erforderlich
Antworten
200 objekt application/json
{
  positions: Array<number | "Infinity" | "-Infinity" | "NaN">
  indices: Array<number | "Infinity" | "-Infinity" | "NaN">
  normals: Array<number | "Infinity" | "-Infinity" | "NaN">
  bounds: {
    min: unknown[]
    max: unknown[]
  }
  parts: Array<{
    id: string
    name: string
    triangleStart: number | "Infinity" | "-Infinity" | "NaN"
    triangleCount: number | "Infinity" | "-Infinity" | "NaN"
  }>
  truncated: boolean
  revision: string
  features?: Array<{
    elementId: string
    name: string
    features: Array<{
      id: string
      type: string
      parameters: Array<{
        key: string
        value: string
      }>
    }>
  }>
  parameters: Array<{
    key: string
    value: string
  }>
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
beispiel abrufen
workspace.componentPreview
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/components/${componentId}/preview`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
GET /api/projects/{id}/workspace/components/{componentId}/preview
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/components/<componentId>/preview" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus
erhalten /api/projects/{id}/workspace/toolpaths # workspace.toolpaths

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
Antworten
200 Array<Objekt> application/json
Array<{
  id: string
  name: string
  subtitle: string | null
  updatedAt: string
}>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
beispiel abrufen
workspace.toolpaths
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/toolpaths`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
GET /api/projects/{id}/workspace/toolpaths
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/toolpaths" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus
erhalten /api/projects/{id}/workspace/toolpaths/{toolpathId} # workspace.toolpath

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
toolpathId weg zeichenfolge erforderlich
Antworten
200 objekt application/json
{
  id: string
  name: string
  operationType: string | null
  gcode: string
  stats: {
    rapidMoves: number | "Infinity" | "-Infinity" | "NaN"
    linearMoves: number | "Infinity" | "-Infinity" | "NaN"
    circularMoves: number | "Infinity" | "-Infinity" | "NaN"
    machineFunctions: number | "Infinity" | "-Infinity" | "NaN"
  }
  revision: string
  updatedAt: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
beispiel abrufen
workspace.toolpath
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/toolpaths/${toolpathId}`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
GET /api/projects/{id}/workspace/toolpaths/{toolpathId}
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/toolpaths/<toolpathId>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus
erhalten /api/projects/{id}/workspace/toolpaths/{toolpathId}/preview # workspace.toolpathPreview

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
toolpathId weg zeichenfolge erforderlich
Antworten
200 objekt application/json
{
  segments: Array<{
    kind: "rapid" | "linear" | "circular"
    line: number | "Infinity" | "-Infinity" | "NaN"
    from: unknown[]
    to: unknown[]
  }>
  bounds: {
    min: unknown[]
    max: unknown[]
  }
  stock: {
    min: unknown[]
    max: unknown[]
  }
  truncated: boolean
  stats: {
    rapidMoves: number | "Infinity" | "-Infinity" | "NaN"
    linearMoves: number | "Infinity" | "-Infinity" | "NaN"
    circularMoves: number | "Infinity" | "-Infinity" | "NaN"
    machineFunctions: number | "Infinity" | "-Infinity" | "NaN"
  }
  machine?: {
    kind: "mill" | "lathe" | "3dprinter"
    source: "override" | "kernel" | "generator" | "inferred" | "settings"
    mismatch?: {
      inferred: "mill" | "lathe" | "3dprinter"
      reasons: string[]
    }
    axes: number | "Infinity" | "-Infinity" | "NaN"
    turns: string
    workholding: string
    assumed: Array<"workholding" | "table" | "stock">
    xMode?: "diameter" | "radius"
    turret?: "rear" | "front"
    bodies: Array<{
      id: string
      role: "stock" | "jaw" | "parallel" | "vise-base" | "clamp" | "table" | "chuck" | "collet" | "tailstock" | "bed" | "build-volume"
      shape: {
        type: "box"
        min: {
          x: number | "Infinity" | "-Infinity" | "NaN"
          y: number | "NaN"
          z: number | "NaN"
        }
        max: {
          x: number | "NaN"
        }
      } | {
        type: "cylinder-x"
        x0: number | "NaN"
        x1: number | "NaN"
        radius: number | "NaN"
        inner: number | "NaN"
      } | {
        type: "cone-x"
        x0: number | "NaN"
        r0: number | "NaN"
        r1: number
      rotateX?: number | "Infinity" | "-Infinity" | "NaN"
      spins: boolean
      assumed: boolean
      obstacle: boolean
      wire?: boolean
    }>
    spin: Array<{
      segment: number | "Infinity" | "-Infinity" | "NaN"
      rate: number | "Infinity" | "-Infinity" | "NaN"
    }>
    collisions: Array<number | "Infinity" | "-Infinity" | "NaN">
    operations?: Array<{
      index: number | "Infinity" | "-Infinity" | "NaN"
      name: string
      toolId: string
      startSegment: number | "Infinity" | "-Infinity" | "NaN"
      endSegment: number | "Infinity" | "-Infinity" | "NaN"
      cutter?: {
        diameter: number | "Infinity" | "-Infinity" | "NaN"
        fluteLength: number | "Infinity" | "-Infinity" | "NaN"
        shankDiameter: number | "Infinity" | "-Infinity" | "NaN"
        stickout: number | "Infinity" | "-Infinity" | "NaN"
        noseRadius: number | "Infinity" | "-Infinity" | "NaN"
        holder: {
          diameter: number | "Infinity" | "-Infinity" | "NaN"
          length: number | "Infinity" | "-Infinity" | "NaN"
          kind: string
          assumed: boolean
        }
      }
    }>
    events?: Array<{
      code: string
      severity: "error" | "warning"
      seconds: number | "Infinity" | "-Infinity" | "NaN"
      segment: number | "Infinity" | "-Infinity" | "NaN"
      line?: number | "Infinity" | "-Infinity" | "NaN"
      message: string
    }>
    tool: {
      family: "mill" | "lathe" | "nozzle"
      diameter: number | "Infinity" | "-Infinity" | "NaN"
      width: number | "Infinity" | "-Infinity" | "NaN"
      noseRadius: number | "Infinity" | "-Infinity" | "NaN"
      insert: string
      internal: boolean
      turret?: "rear" | "front"
    }
  }
  part?: {
    positions: Array<number | "Infinity" | "-Infinity" | "NaN">
    indices: Array<number | "Infinity" | "-Infinity" | "NaN">
    normals: Array<number | "Infinity" | "-Infinity" | "NaN">
    bounds: {
      min: unknown[]
      max: unknown[]
    }
    parts: Array<{
      id: string
      name: string
      triangleStart: number | "Infinity" | "-Infinity" | "NaN"
      triangleCount: number | "Infinity" | "-Infinity" | "NaN"
    }>
    truncated: boolean
  }
  revision: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
beispiel abrufen
workspace.toolpathPreview
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/toolpaths/${toolpathId}/preview`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
GET /api/projects/{id}/workspace/toolpaths/{toolpathId}/preview
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/toolpaths/<toolpathId>/preview" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus
erhalten /api/projects/{id}/workspace/library # workspace.library

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
Antworten
200 objekt application/json
{
  materials: Array<{
    id: string
    name: string
    subtitle: string | null
    updatedAt: string
  }>
  tools: Array<{
    id: string
    name: string
    subtitle: string | null
    updatedAt: string
  }>
  machines: Array<{
    id: string
    name: string
    subtitle: string | null
    updatedAt: string
  }>
  components: Array<{
    id: string
    name: string
    subtitle: string | null
    updatedAt: string
  }>
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
beispiel abrufen
workspace.library
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/library`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
GET /api/projects/{id}/workspace/library
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/library" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
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
}
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 workspace.<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.