line
DmDbLine
线类型
Source code in dimine_python_sdk\lib\types\line.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
__init__()
构造函数,初始化数据库线对象
Source code in dimine_python_sdk\lib\types\line.py
11 12 13 | |
get_graph_data()
获取该线的图形数据(起点和终点) :return: 包含起点和终点的列表,每个元素为DmDPoint实例
example:
line = DmDbLine()
graph_data = line.get_graph_data()
print("线的起点:", graph_data[0])
print("线的终点:", graph_data[1])
Source code in dimine_python_sdk\lib\types\line.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
DmDbPolyline
三维多段线类型
Source code in dimine_python_sdk\lib\types\line.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
__init__()
构造函数 :return: None
Source code in dimine_python_sdk\lib\types\line.py
45 46 47 48 49 50 | |
__repr__()
字符串表示 :return: 多段线的标准字符串表示
Source code in dimine_python_sdk\lib\types\line.py
68 69 70 71 72 73 | |
get_graph_data()
获取多段线的所有顶点坐标 :return: 顶点列表,每个元素为DmDPoint实例
example:
polyline = DmDbPolyline()
graph_data = polyline.get_graph_data()
for point in graph_data:
print(point)
Source code in dimine_python_sdk\lib\types\line.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
is_closed(tolerance=1e-10)
判断多段线是否闭合(起点与终点在容差范围内重合) :param tolerance: 浮点容差阈值,默认1e-10 :return: 闭合返回True,否则返回False
example:
polyline = DmDbPolyline()
is_closed = polyline.is_closed()
if is_closed:
print("多段线闭合")
else:
print("多段线不闭合")
Source code in dimine_python_sdk\lib\types\line.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
set_color(red, green, blue)
设置多段线的颜色 :param red: 红色分量(0-255) :param green: 绿色分量(0-255) :param blue: 蓝色分量(0-255) :return: None
example:
polyline = DmDbPolyline()
polyline.set_color(255, 0, 0) # 设置为红色
Source code in dimine_python_sdk\lib\types\line.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
DmMatrix4x4
二次封装dmMatrix4x4New类
Source code in dimine_python_sdk\lib\types\line.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |
__init__()
构造函数,初始化4x4矩阵
Source code in dimine_python_sdk\lib\types\line.py
122 123 124 | |
align_coord_sys(from_origin, from_x_axis, from_y_axis, from_z_axis, to_origin, to_x_axis, to_y_axis, to_z_axis)
对齐坐标系,将一个坐标系映射到另一个坐标系 :param from_origin: 源坐标系原点(DmDPoint实例) :param from_x_axis: 源坐标系X轴方向(DmDPoint实例) :param from_y_axis: 源坐标系Y轴方向(DmDPoint实例) :param from_z_axis: 源坐标系Z轴方向(DmDPoint实例) :param to_origin: 目标坐标系原点(DmDPoint实例) :param to_x_axis: 目标坐标系X轴方向(DmDPoint实例) :param to_y_axis: 目标坐标系Y轴方向(DmDPoint实例) :param to_z_axis: 目标坐标系Z轴方向(DmDPoint实例) :return: None
example:
matrix = DmMatrix4x4()
matrix.align_coord_sys(
from_origin=DmDPoint(0, 0, 0),
from_x_axis=DmDPoint(1, 0, 0),
from_y_axis=DmDPoint(0, 1, 0),
from_z_axis=DmDPoint(0, 0, 1),
to_origin=DmDPoint(100, 100, 100),
to_x_axis=DmDPoint(0, 0, 1),
to_y_axis=DmDPoint(0, 1, 0),
to_z_axis=DmDPoint(1, 0, 0)
)
Source code in dimine_python_sdk\lib\types\line.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
transform_point(pt_source)
对三维点应用矩阵变换 :param pt_source: 待变换的源点(DmDPoint实例) :return: 变换后的点(DmDPoint实例)
example:
matrix = DmMatrix4x4()
pt = DmDPoint(1, 2, 3)
transformed_pt = matrix.transform_point(pt)
print("变换后的点:", transformed_pt)
Source code in dimine_python_sdk\lib\types\line.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |