تخطَّ إلى المحتوى
CADCAMFUN
الوثائق

الوثائق

مساحة العمل

رسومات المشروع والمكونات ومسارات الأدوات وموارد المكتبة والمعاينات المحدودة للعملاء المرافقين للقراءة فقط.

مترجم تلقائيًا من الإنجليزية. عرض الأصل بالإنجليزية

ساحة التجربة

أرسل هذه الطلبات إلى السايدكار الخاصة بك. تبقى القيم في هذا المتصفح.

غير متصل
كيف يعمل هذا

يستمع السايدكار إلى منفذ الاسترجاع الذي تم اختياره عند بدء التشغيل ويطبعه في منفذ الاسترجاع الخاص به ready خط؛ استخدم عنوان URL هذا و CADCAMFUN_TOKEN لقد بدأ مع. تذهب الطلبات مباشرة من هذه الصفحة إلى هذا العنوان.

يرسل السايدكار رؤوس CORS فقط إلى أصول Tauri وإلى http://localhost أو http://127.0.0.1 على أي منفذ. من المستندات المستضافة، يحظر المتصفح الاستجابة، لذا قم بتشغيل المستندات محليًا (bun run dev في packages/web) لاستخدام الملعب، أو نسخ الطلب كحليقة. للتجربة دون لمس البيانات الحقيقية، ابدأ تشغيل السايدكار باستخدام CADCAMFUN_DATA_DIR أشار إلى دليل مهمل - انظر إرشادات واجهة برمجة التطبيقات.

العمليات

8 نقاط نهاية في workspace المجموعة التي تم إنشاؤها من السايدكار مستند OpenAPI. تأخذ العمليات المحمية Authorization: Bearer $CADCAMFUN_TOKEN; يرى المصادقة. السلوك والحدود موجودة دليل النظام الفرعي.

يحصل /api/projects/{id}/workspace/drawings workspace.drawings
يحصل /api/projects/{id}/workspace/drawings/{drawingId}/preview workspace.drawingPreview
يحصل /api/projects/{id}/workspace/components workspace.components
يحصل /api/projects/{id}/workspace/components/{componentId}/preview workspace.componentPreview
يحصل /api/projects/{id}/workspace/toolpaths workspace.toolpaths
يحصل /api/projects/{id}/workspace/toolpaths/{toolpathId} workspace.toolpath
يحصل /api/projects/{id}/workspace/toolpaths/{toolpathId}/preview workspace.toolpathPreview
يحصل /api/projects/{id}/workspace/library workspace.library
عمليات مساحة العمل في 3د اسحب إلى المدار · قم بالتمرير للتكبير · اسحب بزر الماوس الأيمن للتحريك
كتلة واحدة لكل عملية (8)، مكدسة لكل قسم موارد في هذه الصفحة وملونة حسب الطريقة: GET الأخضر، POST البرتقالي، PUT الأزرق، PATCH البنفسجي، DELETE الأحمر. تم إنشاؤها من مستند OpenAPI في وقت الإنشاء.

/api/projects

يحصل /api/projects/{id}/workspace/drawings # workspace.drawings

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
بطاقة تعريف طريق خيط مطلوب
الردود
200 صفيف <كائن> 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
جلب المثال
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
الحصول على /api/projects/{id}/workspace/drawings
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/drawings" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه
يحصل /api/projects/{id}/workspace/drawings/{drawingId}/preview # workspace.drawingPreview

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
بطاقة تعريف طريق خيط مطلوب
drawingId طريق خيط مطلوب
الردود
200 هدف 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
جلب المثال
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}"
جربه
يحصل /api/projects/{id}/workspace/components # workspace.components

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
بطاقة تعريف طريق خيط مطلوب
الردود
200 صفيف <كائن> 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
جلب المثال
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
احصل على /api/projects/{id}/workspace/components
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/components" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه
يحصل /api/projects/{id}/workspace/components/{componentId}/preview # workspace.componentPreview

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
بطاقة تعريف طريق خيط مطلوب
componentId طريق خيط مطلوب
الردود
200 هدف 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
جلب المثال
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}"
جربه
يحصل /api/projects/{id}/workspace/toolpaths # workspace.toolpaths

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
بطاقة تعريف طريق خيط مطلوب
الردود
200 صفيف <كائن> 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
جلب المثال
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
الحصول على /api/projects/{id}/workspace/toolpaths
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/toolpaths" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه
يحصل /api/projects/{id}/workspace/toolpaths/{toolpathId} # workspace.toolpath

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
بطاقة تعريف طريق خيط مطلوب
toolpathId طريق خيط مطلوب
الردود
200 هدف 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
جلب المثال
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}"
جربه
يحصل /api/projects/{id}/workspace/toolpaths/{toolpathId}/preview # workspace.toolpathPreview

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
بطاقة تعريف طريق خيط مطلوب
toolpathId طريق خيط مطلوب
الردود
200 هدف 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
جلب المثال
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}"
جربه
يحصل /api/projects/{id}/workspace/library # workspace.library

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
بطاقة تعريف طريق خيط مطلوب
الردود
200 هدف 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
جلب المثال
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
الحصول على /api/projects/{id}/workspace/library
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/library" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه

المخططات

يمكن الوصول إلى المخططات المسماة من معلمات هذه المجموعة وأجسامها واستجاباتها. أ ? يمثل حقلاً اختياريًا؛ | null يضع علامة على الحقل الذي قد يكون موجودًا بقيمة فارغة.

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

استدعاء هذه المجموعة

معرفات العملية لها النموذج workspace.<name>. وعد SDK الذي تم إنشاؤه (@cadcamfun/api/sdk) يعرض معظمهم client.<namespace>.<method>(input)، أين input هو كائن مسطح واحد من معلمات المسار وحقول النص؛ يُظهر مثال SDK لكل بطاقة الملحق الدقيق ونوع الإدخال. لا يتم إنشاء التحميلات متعددة الأجزاء والاستجابات الثنائية أو استجابات JavaScript وخطافات الويب الأولية؛ تظهر تلك البطاقات fetch بدلاً من ذلك.

أخطاء من 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
  }
}

استكشاف الأخطاء وإصلاحها

أعراضالسبب المحتمليصلح
401 في كل طلبرمز مميز من إطلاق سابق، أو مفقود Bearer بادئةيرسل Authorization: Bearer <token> بالرمز المميز الذي بدأت به السايدكار.
400 قبل أن يحدث أي شيءالنص أو المعلمة لا يتطابقان مع المخططقارن الحمولة بمخطط الطلب الموجود على البطاقة.
403 أو 404 لسجل يمكنك رؤيته في مكان آخرحساب التمثيل يختلفأرسل الحق x-session-tokenأو استخدم ملف التعريف المحلي الذي يملك السجل.
409حالة متعارضة، مثل اسم مكرر أو رأس فرع قديمأعد قراءة المورد وأعد المحاولة باستخدام البيانات الحالية.
جربه يقول "تم حظره بواسطة CORS"يتم تقديم المستندات من أصل غير استرجاعيقم بتشغيل المستندات محليًا أو انسخ الطلب كـ curly.
رفض اتصالتم إعادة تشغيل السايدكار في منفذ جديدقراءة المنفذ من الجديد ready سطر.