@@ -0,0 +1,67 @@
|
||||
"""PCB contracts extend geometry without changing the schematic wire schema."""
|
||||
from typing import Literal
|
||||
from pydantic import BaseModel, Field
|
||||
from .schematic import Document, Primitive, SchematicObject, Point, Bounds
|
||||
from .api import RenderStatus
|
||||
|
||||
|
||||
class PCBPrimitive(Primitive):
|
||||
layer_ids: list[str] = Field(default_factory=list)
|
||||
|
||||
|
||||
class PCBObject(SchematicObject):
|
||||
native_uid: str = ''
|
||||
layer_ids: list[str] = Field(default_factory=list)
|
||||
|
||||
|
||||
class Footprint(BaseModel):
|
||||
id: str
|
||||
designator: str = ''
|
||||
name: str = ''
|
||||
value: str = ''
|
||||
comment: str = ''
|
||||
description: str = ''
|
||||
library_reference: str = ''
|
||||
source_library: str = ''
|
||||
position: Point
|
||||
rotation: float = 0
|
||||
mirrored: bool = False
|
||||
bounds: Bounds
|
||||
parameters: dict[str, str] = Field(default_factory=dict)
|
||||
primitive_ids: list[str] = Field(default_factory=list)
|
||||
object_ids: list[str] = Field(default_factory=list)
|
||||
|
||||
|
||||
class PCBData(Document):
|
||||
document_type: Literal['pcb'] = 'pcb'
|
||||
components: list[Footprint]
|
||||
primitives: list[PCBPrimitive]
|
||||
objects: list[PCBObject]
|
||||
|
||||
|
||||
class PCBStatus(RenderStatus):
|
||||
document_type: Literal['pcb', 'pcb_comparison']
|
||||
status_url: str
|
||||
layers: list[dict] | None = None
|
||||
net_count: int | None = None
|
||||
|
||||
|
||||
class PCBUploadResponse(PCBStatus):
|
||||
viewer_token: str | None = None
|
||||
|
||||
|
||||
class PCBComparisonStatus(PCBStatus):
|
||||
comparison_id: str
|
||||
url: str
|
||||
summary: dict[Literal['added','removed','modified','moved'], int] | None = None
|
||||
total_changed: int | None = None
|
||||
changes: list[dict] | None = None
|
||||
old: dict | None = None
|
||||
new: dict | None = None
|
||||
nets: dict | None = None
|
||||
matching: dict | None = None
|
||||
limitations: list[str] | None = None
|
||||
|
||||
|
||||
class PCBComparisonUploadResponse(PCBComparisonStatus):
|
||||
viewer_token: str | None = None
|
||||
مرجع در شماره جدید
مسدود کردن کاربر