Aller au contenu
CADCAMFUN
Docs

Documentation

Espace de travail

Dessins de projet, composants, parcours d'outils, ressources de bibliothèque et aperçus limités en lecture seule pour les clients compagnons.

Traduit automatiquement de l'anglais. Voir l'original en anglais

Playground

Envoyez ces demandes à votre propre sidecar en cours d’exécution. Les valeurs restent dans ce navigateur.

Non connecté
Comment ça marche

Le sidecar écoute sur un port de bouclage choisi au démarrage et l'imprime dans son ready doubler; utilisez cette URL et le CADCAMFUN_TOKEN ça a commencé avec. Les demandes vont directement de cette page à cette adresse.

Le sidecar envoie les en-têtes CORS uniquement aux origines Tauri et à http://localhost ou http://127.0.0.1 sur n'importe quel port. À partir des documents hébergés, le navigateur bloque la réponse, exécutez donc les documents localement (bun run dev dans packages/web) pour utiliser le terrain de jeu, ou copiez la requête sous forme curl. Pour expérimenter sans toucher aux données réelles, démarrez le sidecar avec CADCAMFUN_DATA_DIR pointé vers un répertoire jetable — voir la procédure pas à pas de l'API.

Opérations

8 endpoints dans le workspace groupe, généré à partir du propre sidecar Document OpenAPI. Les opérations protégées prennent Authorization: Bearer $CADCAMFUN_TOKEN; voir authentification. Le comportement et les limites sont en place le guide du sous-système.

obtenir /api/projects/{id}/workspace/drawings workspace.drawings
obtenir /api/projects/{id}/workspace/drawings/{drawingId}/preview workspace.drawingPreview
obtenir /api/projects/{id}/workspace/components workspace.components
obtenir /api/projects/{id}/workspace/components/{componentId}/preview workspace.componentPreview
obtenir /api/projects/{id}/workspace/toolpaths workspace.toolpaths
obtenir /api/projects/{id}/workspace/toolpaths/{toolpathId} workspace.toolpath
obtenir /api/projects/{id}/workspace/toolpaths/{toolpathId}/preview workspace.toolpathPreview
obtenir /api/projects/{id}/workspace/library workspace.library
Opérations sur l'espace de travail en 3D Faites glisser vers l'orbite · faites défiler pour zoomer · faites glisser vers la droite pour effectuer un panoramique
Un bloc par opération (8), empilé par section de ressources de cette page et coloré par méthode : vert GET, orange POST, bleu PUT, violet PATCH, rouge DELETE. Généré à partir du document OpenAPI au moment de la construction.

/api/projects

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

Nécessite Authorization: Bearer <token>.

Paramètres
NomDansTaperRequis
identifiant chemin chaîne requis
Réponses
200 Tableau<objet> 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
récupérer un exemple
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}"
Essayez-le
obtenir /api/projects/{id}/workspace/drawings/{drawingId}/preview # workspace.drawingPreview

Nécessite Authorization: Bearer <token>.

Paramètres
NomDansTaperRequis
identifiant chemin chaîne requis
drawingId chemin chaîne requis
Réponses
200 objet 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
récupérer un exemple
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}"
Essayez-le
obtenir /api/projects/{id}/workspace/components # workspace.components

Nécessite Authorization: Bearer <token>.

Paramètres
NomDansTaperRequis
identifiant chemin chaîne requis
Réponses
200 Tableau<objet> 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
récupérer un exemple
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
OBTENIR /api/projects/{id}/workspace/components
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/components" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Essayez-le
obtenir /api/projects/{id}/workspace/components/{componentId}/preview # workspace.componentPreview

Nécessite Authorization: Bearer <token>.

Paramètres
NomDansTaperRequis
identifiant chemin chaîne requis
componentId chemin chaîne requis
Réponses
200 objet 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
récupérer un exemple
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}"
Essayez-le
obtenir /api/projects/{id}/workspace/toolpaths # workspace.toolpaths

Nécessite Authorization: Bearer <token>.

Paramètres
NomDansTaperRequis
identifiant chemin chaîne requis
Réponses
200 Tableau<objet> 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
récupérer un exemple
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}"
Essayez-le
obtenir /api/projects/{id}/workspace/toolpaths/{toolpathId} # workspace.toolpath

Nécessite Authorization: Bearer <token>.

Paramètres
NomDansTaperRequis
identifiant chemin chaîne requis
toolpathId chemin chaîne requis
Réponses
200 objet 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
récupérer un exemple
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}"
Essayez-le
obtenir /api/projects/{id}/workspace/toolpaths/{toolpathId}/preview # workspace.toolpathPreview

Nécessite Authorization: Bearer <token>.

Paramètres
NomDansTaperRequis
identifiant chemin chaîne requis
toolpathId chemin chaîne requis
Réponses
200 objet 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
récupérer un exemple
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}"
Essayez-le
obtenir /api/projects/{id}/workspace/library # workspace.library

Nécessite Authorization: Bearer <token>.

Paramètres
NomDansTaperRequis
identifiant chemin chaîne requis
Réponses
200 objet 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
récupérer un exemple
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}"
Essayez-le

Schémas

Schémas nommés accessibles à partir des paramètres, des corps et des réponses de ce groupe. UN ? marque un champ facultatif ; | null marque un champ qui peut être présent avec une valeur nulle.

BadRequestEncoded
{
  _tag: "BadRequest"
  message: string
}
InternalErrorEncoded
{
  _tag: "InternalError"
  message: string
}
NotFoundEncoded
{
  _tag: "NotFound"
  message: string
}
UnauthorizedEncoded
{
  _tag: "Unauthorized"
  message: string
}

Appel à ce groupe

Les identifiants d'opération ont la forme workspace.<name>. Le SDK Promise généré (@cadcamfun/api/sdk) expose la plupart d'entre eux comme client.<namespace>.<method>(input), où input est un objet plat composé de paramètres de chemin et de champs de corps ; L'exemple de SDK de chaque carte montre l'accesseur exact et le type d'entrée. Les téléchargements en plusieurs parties, les réponses binaires ou JavaScript et les webhooks bruts ne sont pas générés ; ces cartes montrent fetch à la place.

Erreurs du SDK Promise
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
  }
}

Dépannage

SymptômeCause probableRéparer
401 à chaque appelJeton d'un lancement précédent, ou manquant Bearer préfixeEnvoyer Authorization: Bearer <token> avec le jeton avec lequel le sidecar a été démarré.
400 avant que quoi que ce soit se produiseLe corps ou le paramètre ne correspond pas au schémaComparez la charge utile avec le schéma de demande sur la carte.
403 ou 404 sur un enregistrement visible ailleursLe compte intérimaire diffèreEnvoyez le droit x-session-token, ou utilisez le profil local propriétaire de l'enregistrement.
409État conflictuel, tel qu'un nom en double ou un chef de succursale obsolèteRelisez la ressource et réessayez avec les données actuelles.
Essayez, il est écrit "bloqué par CORS"Les documents sont servis à partir d'une origine sans bouclageExécutez la documentation localement ou copiez la demande en tant que curl.
Connexion rejetéeLe sidecar a redémarré sur un nouveau portLire le port du nouveau ready ligne.