ours: наш оверлей к апстриму 1.5.1 (дельта для переноса в 1.6.0)

10 изменённых файлов + 2 новых (engineering/gost_titleblock.py, _fonts/isocpeur.ttf).
Ветка-донор для трёхстороннего переноса в ours-1.6.
This commit is contained in:
2026-10-05 18:04:55 +03:00
parent ca1c79fd01
commit 2e2a2b96a9
12 changed files with 3232 additions and 159 deletions
+5
View File
@@ -30,6 +30,7 @@ class DimensionContract(ABC):
tol_lower: float | None = None,
tol_mode: str = "none",
text_override: str | None = None,
layout: str | None = None,
) -> EntityInfo: ...
@abstractmethod
@@ -42,6 +43,7 @@ class DimensionContract(ABC):
dim_x: float,
dim_y: float,
layer: str | None = None,
layout: str | None = None,
) -> EntityInfo: ...
@abstractmethod
@@ -56,6 +58,7 @@ class DimensionContract(ABC):
tx: float,
ty: float,
layer: str | None = None,
layout: str | None = None,
) -> EntityInfo: ...
@abstractmethod
@@ -71,6 +74,7 @@ class DimensionContract(ABC):
tol_lower: float | None = None,
tol_mode: str = "none",
text_override: str | None = None,
layout: str | None = None,
) -> EntityInfo: ...
@abstractmethod
@@ -86,4 +90,5 @@ class DimensionContract(ABC):
tol_lower: float | None = None,
tol_mode: str = "none",
text_override: str | None = None,
layout: str | None = None,
) -> EntityInfo: ...
+11
View File
@@ -72,6 +72,9 @@ class EntityCreationContract(ABC):
rotation: float = 0.0,
layer: str | None = None,
color: int | None = None,
style: str | None = None,
layout: str | None = None,
inline_font: bool = True,
) -> EntityInfo: ...
@abstractmethod
@@ -85,6 +88,9 @@ class EntityCreationContract(ABC):
rotation: float = 0.0,
layer: str | None = None,
color: int | None = None,
style: str | None = None,
layout: str | None = None,
inline_font: bool = True,
) -> EntityInfo: ...
@abstractmethod
@@ -99,6 +105,9 @@ class EntityCreationContract(ABC):
text_height: float = 2.5,
title: str | None = None,
layer: str = "TEXT",
style: str | None = None,
layout: str | None = None,
inline_font: bool = True,
) -> EntityInfo: ...
@abstractmethod
@@ -110,6 +119,8 @@ class EntityCreationContract(ABC):
landing_gap: float = 1.0,
arrow_size: float = 2.5,
layer: str = "DIM",
layout: str | None = None,
inline_font: bool = True,
) -> EntityInfo: ...
@abstractmethod
+23
View File
@@ -28,6 +28,29 @@ class LayoutContract(ABC):
"""Activate a layout tab ('Model' or a paper-space layout name)."""
...
# MCP card t_b950b5c4 (01.10.2026). A sheet's format is part of the page
# setup, and every plot of the sheet reads it: without a way to state the
# format, a 210x297 frame drawn on a layout that still says A3 exports onto
# A3 with the frame in a corner. The headless backend stores it in the
# layout's paper fields; ActiveX exposes no verified equivalent.
@capability( # noqa: B027
"paper_space",
reason=(
"ActiveX has no verified member for a layout's sheet format (the page setup lives in "
"the drawing's plot configuration, which has not been exercised against a live "
"AutoCAD). Set the format in AutoCAD's Page Setup, or use the headless backend "
"(AUTOCAD_MCP_BACKEND=ezdxf), where layout_create + layout_set_paper store it."
),
)
async def layout_set_paper(self, name: str, width: float, height: float) -> dict:
"""Set the sheet a layout is set up for, in millimetres.
Returns ``{ok, layout, paper_mm}``. This is what
``drawing_export_pdf(page_size='layout')`` reads to size the page, so a
sheet exported at 1:1 is the format it was drawn for.
"""
...
@abstractmethod
async def layout_delete(self, name: str) -> dict:
"""Delete a paper-space layout and everything drawn on it.
+8 -1
View File
@@ -615,11 +615,14 @@ class PremiumContract(ABC):
style: DimStyle = "chain",
offset: float = 10.0,
layer: str | None = None,
layout: str | None = None,
) -> list[EntityInfo]:
"""Generate ISO 129 dimensions across `handles` in the chosen style
(chain | baseline | ordinate). `offset` is the dimension-line
distance from the reference geometry (mm). `layer` defaults to the
active layer set's dimension layer (DIM, or M-DIMEN-T-N for iso13567)."""
active layer set's dimension layer (DIM, or M-DIMEN-T-N for iso13567).
`layout` puts the dimensions on a named paper-space sheet instead of the
current space, so a sheet's dimensions live in paper millimetres."""
if not handles:
return []
dim_layer = layer or self._role_layer("dim")
@@ -661,6 +664,7 @@ class PremiumContract(ABC):
my + ny * off,
rotation=math.degrees(math.atan2(dy, dx)),
layer=dim_layer,
layout=layout,
)
results.append(dim)
@@ -682,6 +686,7 @@ class PremiumContract(ABC):
# baseline, not horizontal.
rotation=base_rot,
layer=dim_layer,
layout=layout,
)
results.append(dim)
@@ -697,6 +702,7 @@ class PremiumContract(ABC):
sx + (ex - sx) / 2.0,
max(sy, ey) + rung,
layer=dim_layer,
layout=layout,
)
results.append(dim)
if abs(ey - sy) > 1e-9:
@@ -709,6 +715,7 @@ class PremiumContract(ABC):
(sy + ey) / 2.0,
rotation=90.0,
layer=dim_layer,
layout=layout,
)
results.append(dim)