Skip to content

models

Native Layer v2 数据模型

使用标准库 dataclasses 定义 native 层内部传递的数据结构, 不强制依赖 Pydantic。

NativeEntity dataclass

几何实体数据模型

Source code in dimine_python_sdk\lib\native\models.py
62
63
64
65
66
67
68
69
70
71
@dataclass
class NativeEntity:
    """几何实体数据模型"""

    entity_type: str         # "point" | "line" | "polyline" | "shell" | "text" | ...
    name: str = ""
    geometry: Optional["np.ndarray | NativeTin"] = None
    color: list[int] = field(default_factory=lambda: [0, 0, 0])
    properties: list[NativeProperty] = field(default_factory=list)
    feature_name: str = ""   # 所属要素名称

NativeFeature dataclass

DMF 要素定义

Source code in dimine_python_sdk\lib\native\models.py
89
90
91
92
93
94
@dataclass
class NativeFeature:
    """DMF 要素定义"""

    name: str
    properties: list[NativeProperty] = field(default_factory=list)

NativeFieldDef dataclass

字段定义

Source code in dimine_python_sdk\lib\native\models.py
37
38
39
40
41
42
43
@dataclass
class NativeFieldDef:
    """字段定义"""

    name: str
    type: int | str
    size: int = 0

NativeLayer dataclass

DMF 图层数据模型

Source code in dimine_python_sdk\lib\native\models.py
 97
 98
 99
100
101
102
@dataclass
class NativeLayer:
    """DMF 图层数据模型"""

    name: str
    entities: list[NativeEntity] = field(default_factory=list)

NativeLithologyModel dataclass

隐式建模岩性实体模型

Source code in dimine_python_sdk\lib\native\models.py
54
55
56
57
58
59
@dataclass
class NativeLithologyModel:
    """隐式建模岩性实体模型"""

    name: str        # 岩性(地层)名称
    tin: NativeTin   # 实体三角网模型

NativeProperty dataclass

属性键值对

Source code in dimine_python_sdk\lib\native\models.py
28
29
30
31
32
33
34
@dataclass
class NativeProperty:
    """属性键值对"""

    name: str
    value: str | int | float | datetime | None = None
    type: PropertyType = "string"

NativeText dataclass

文本实体数据模型

Source code in dimine_python_sdk\lib\native\models.py
74
75
76
77
78
79
80
81
82
83
84
85
86
@dataclass
class NativeText:
    """文本实体数据模型"""

    position: "np.ndarray"  # shape (3,)
    text: str
    height: float = 20.0
    rotation: float = 0.0
    thickness: float = 0.0
    face2_user: bool = False
    normal: "np.ndarray" = field(
        default_factory=lambda: np.array([0, 0, 1]) if np is not None else [0, 0, 1]
    )

NativeTin dataclass

三角网模型

Source code in dimine_python_sdk\lib\native\models.py
46
47
48
49
50
51
@dataclass
class NativeTin:
    """三角网模型"""

    points: "np.ndarray"  # shape (N, 3)
    faces: "np.ndarray"   # shape (M, 3)