entity
DmDataTable
数据表 Python 二次封装类
Source code in dimine_python_sdk\lib\types\entity.py
827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 | |
add_record()
添加一条新记录
Source code in dimine_python_sdk\lib\types\entity.py
940 941 942 | |
get_field_count()
获取字段总数
Source code in dimine_python_sdk\lib\types\entity.py
852 853 854 | |
get_field_display_name(field_index)
通过索引获取字段显示名 :param field_index: 字段索引(从0开始) :return: UTF-8 编码的字段显示名
Source code in dimine_python_sdk\lib\types\entity.py
890 891 892 893 894 895 896 897 898 899 900 | |
get_field_id(field_name)
通过字段名获取字段ID :param field_name: UTF-8 编码的字段名 :return: 字段ID
Source code in dimine_python_sdk\lib\types\entity.py
868 869 870 871 872 873 874 875 876 | |
get_field_name(field_index)
通过索引获取字段名 :param field_index: 字段索引(从0开始) :return: UTF-8 编码的字段名
Source code in dimine_python_sdk\lib\types\entity.py
878 879 880 881 882 883 884 885 886 887 888 | |
get_field_type(field_index)
通过索引获取字段类型 :param field_index: 字段索引(从0开始) :return: 字段类型枚举值
Source code in dimine_python_sdk\lib\types\entity.py
902 903 904 905 906 907 908 909 910 911 912 | |
get_record_count()
获取记录总数
Source code in dimine_python_sdk\lib\types\entity.py
856 857 858 | |
get_record_count_by_condition(field_name, field_value)
根据字段名和值筛选记录数量 :param field_name: UTF-8 编码的字段名 :param field_value: UTF-8 编码的字段值 :return: 符合条件的记录数量
Source code in dimine_python_sdk\lib\types\entity.py
927 928 929 930 931 932 933 934 935 936 937 938 | |
get_record_data(record_index)
通过索引获取单条记录的完整数据 :param record_index: 记录索引(从0开始) :return: 记录数据字典,键为字段名,值为字段值
Source code in dimine_python_sdk\lib\types\entity.py
860 861 862 863 864 865 866 | |
get_record_from_index(record_index)
通过索引获取原始记录对象 :param record_index: 记录索引(从0开始) :return: 原始记录对象
Source code in dimine_python_sdk\lib\types\entity.py
914 915 916 917 918 919 920 921 922 923 924 925 | |
load(file_path)
加载数据表文件 :param file_path: UTF-8 编码的数据表文件路径 :return: 加载结果(成功返回 True/0,失败返回 False/错误码)
example:
dt = DmDataTable()
dt.load("E:/dassistant/tests/123.dmd")
print("字段总数:",dt.get_field_count())
Source code in dimine_python_sdk\lib\types\entity.py
835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 | |
save()
保存数据表
Source code in dimine_python_sdk\lib\types\entity.py
944 945 946 | |
DmDataTableRecord
数据表记录类
Source code in dimine_python_sdk\lib\types\entity.py
772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 | |
as_double(field_name)
获取字段值(浮点形式) :param field_name: UTF-8 编码的字段名 :return: 字段值浮点数
Source code in dimine_python_sdk\lib\types\entity.py
801 802 803 804 805 806 807 808 809 | |
as_string(field_name)
获取字段值(字符串形式) :param field_name: UTF-8 编码的字段名 :return: 字段值字符串
Source code in dimine_python_sdk\lib\types\entity.py
791 792 793 794 795 796 797 798 799 | |
set_value(field_name, value)
设置字段值(支持字符串/浮点数) :param field_name: UTF-8 编码的字段名 :param value: 字段值(字符串或浮点数)
Source code in dimine_python_sdk\lib\types\entity.py
811 812 813 814 815 816 817 818 819 820 821 822 823 824 | |
DmDbDatabase
几何数据库
Source code in dimine_python_sdk\lib\types\entity.py
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | |
add_property(property_name, property_type)
添加属性(底层调用源AddProperty接口) :param property_name: 属性名称(UTF-8编码) :param property_type: 属性类型(UTF-8编码) :return: 操作结果(是否成功,提示信息)
Source code in dimine_python_sdk\lib\types\entity.py
747 748 749 750 751 752 753 754 755 756 757 758 | |
close_polyline()
闭合多段线(底层调用源ClosePolyline接口) :return: 操作结果
Source code in dimine_python_sdk\lib\types\entity.py
729 730 731 732 733 734 | |
create_local_db()
staticmethod
创建本地数据库(底层调用源CreateLocalDB静态接口) :return: 新创建的数据库对象
Source code in dimine_python_sdk\lib\types\entity.py
720 721 722 723 724 725 726 727 | |
get_active_layer()
获取当前激活图层(底层调用源GetActiveLayer接口) :return: 激活图层对象,无激活图层时返回None
example:
dmf = DmDbDatabase()
db = dmf.load('E:/dassistant/tests/123.dmf')
layer = dmf.get_active_layer()
print("当前活动图层:",layer)
Source code in dimine_python_sdk\lib\types\entity.py
704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 | |
get_layer_by_index(layer_index)
通过索引获取图层对象(底层调用源GetLayerFromIndex接口) :param layer_index: 图层索引,从0开始 :return: 图层对象,索引无效时返回None
Source code in dimine_python_sdk\lib\types\entity.py
640 641 642 643 644 645 646 647 648 649 | |
get_layers_count()
获取数据库图层总数(底层调用源GetLayersCount接口) :return: 非负整数,图层总数量
example:
dmf = DmDbDatabase()
db = dmf.load('E:/dassistant/tests/123.dmf')
print("获取图层数量:",dmf.get_layers_count())
Source code in dimine_python_sdk\lib\types\entity.py
626 627 628 629 630 631 632 633 634 635 636 637 638 | |
insert_layer(layer_name)
插入新图层(底层调用源InsertLayer接口) :param layer_name: 图层名称(UTF-8编码) :return: 新创建的图层对象
example:
dmf = DmDbDatabase()
db = dmf.load('E:/dassistant/tests/123.dmf')
layer = dmf.insert_layer("新图层")
print("插入新图层:",layer)
Source code in dimine_python_sdk\lib\types\entity.py
660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 | |
load(file_path)
加载本地数据库文件(底层调用源Load接口) :param file_path: 数据库文件路径(UTF-8编码,底层已处理编码转换) :return: 加载结果,成功返回True/0,失败返回False/错误码
example:
dmf = DmDbDatabase()
db = dmf.load('E:/dassistant/tests/123.dmf')
print(db)
Source code in dimine_python_sdk\lib\types\entity.py
609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | |
save(file_path=None)
保存数据库(底层调用源Save重载接口,自动适配无参/有参) :param file_path: 可选保存路径,为None时保存到当前路径 :return: 保存结果,成功返回True/0,失败返回False/错误码
example:
dmf = DmDbDatabase()
db = dmf.load('E:/dassistant/tests/123.dmf')
layer = dmf.insert_layer("新图层")
print("插入新图层:",layer)
dmf.save("E:/dassistant/tests/123_1.dmf")
Source code in dimine_python_sdk\lib\types\entity.py
679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 | |
set_color(red, green, blue)
设置颜色(底层调用源SetColor接口) :param red: 红色通道值(0-255) :param green: 绿色通道值(0-255) :param blue: 蓝色通道值(0-255)
Source code in dimine_python_sdk\lib\types\entity.py
736 737 738 739 740 741 742 743 744 745 | |
set_file_name(file_path)
设置数据库文件路径(底层调用源SetFileName接口) :param file_path: 数据库文件路径(UTF-8编码)
Source code in dimine_python_sdk\lib\types\entity.py
651 652 653 654 655 656 657 658 | |
switch_to_local_storage()
切换到本地存储模式(底层调用源SetToLocalStorage接口)
Source code in dimine_python_sdk\lib\types\entity.py
700 701 702 | |
DmDbEntity
所有实体对象都继承自该类,包括获取实体类型函数GetType、 将三维实体转换到dmPolyData对象函数ToPolyData、 将对象转换为三维实体对象函数ConvertToShell、 将对象转换为三维多段线对象函数ConvertToPolyline、 将对象转换为直线对象函数ConvertToLine、 将对象转换为点对象函数ConvertToPoint、 设置实体颜色函数SetColor、 获取实体类型名称函数GetEntityTypeName、 获取实体名称函数GetEntityName等
example:
dmf = DmDbDatabase()
db = dmf.load('E:/dassistant/tests/123.dmf')
print("获取图层数量:",dmf.get_layers_count())
act_layer = dmf.get_active_layer()
layerCount = dmf.get_layers_count()
for i in range(layerCount):
layer = dmf.get_layer_by_index(i)
if layer is None:
continue
print("图层实体数量:",layer.get_entities_count())
layer.start_query_entity()
entity = layer.open_next_entity()
while entity is not None:
nType = entity.get_type()
#print("实体类型:",nType)
if nType == EntityType.ETT_POLYLINE:
print("实体类型名称:", entity.get_entity_type_name())
polydata = entity.to_poly_data()
print("获取多边形点集:",polydata.get_dm_points())
print("获取多边形包围盒:",polydata.get_bounds())
elif nType == EntityType.ETT_POINT:
print("实体类型名称:", entity.get_entity_type_name())
point = entity.convert_to_point().get_graph_data()
print(type(point))
print("获取点数据:",point)
elif nType == EntityType.ETT_LINE:
print("实体类型名称:", entity.get_entity_type_name())
line = entity.convert_to_line()
print(type(line))
print("获取线数据:",line)
entity.set_color(255,0,0)
entity = layer.open_next_entity()
Source code in dimine_python_sdk\lib\types\entity.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | |
convert_to_line()
将实体转换为线对象 :return: 转换后的DmDbLine实例
Source code in dimine_python_sdk\lib\types\entity.py
429 430 431 432 433 434 435 | |
convert_to_point()
将实体转换为点对象 :return: 转换后的DmDbPoint实例
Source code in dimine_python_sdk\lib\types\entity.py
437 438 439 440 441 442 443 | |
convert_to_polyline()
将实体转换为多段线对象 :return: 转换后的DmDbPolyline实例
Source code in dimine_python_sdk\lib\types\entity.py
421 422 423 424 425 426 427 | |
convert_to_shell()
将实体转换为Shell对象 :return: 转换后的DmDbShell实例
Source code in dimine_python_sdk\lib\types\entity.py
413 414 415 416 417 418 419 | |
get_entity_name()
获取实体名称(UTF-8编码) :return: 实体名称字符串
example:
entity = DmDbEntity()
entity_name = entity.get_entity_name()
Source code in dimine_python_sdk\lib\types\entity.py
473 474 475 476 477 478 479 480 481 482 483 484 | |
get_entity_type_name()
获取实体类型名称(UTF-8编码) :return: 实体类型名称字符串
example:
entity = DmDbEntity()
entity_type_name = entity.get_entity_type_name()
Source code in dimine_python_sdk\lib\types\entity.py
460 461 462 463 464 465 466 467 468 469 470 471 | |
get_type()
获取实体类型编码 :return: 实体类型的整数编码
Source code in dimine_python_sdk\lib\types\entity.py
398 399 400 401 402 403 | |
set_color(red, green, blue)
设置实体颜色 :param red: 红色分量(0-255) :param green: 绿色分量(0-255) :param blue: 蓝色分量(0-255)
example:
entity = DmDbEntity()
entity.set_color(255, 0, 0)
Source code in dimine_python_sdk\lib\types\entity.py
445 446 447 448 449 450 451 452 453 454 455 456 457 458 | |
to_poly_data()
将实体转换为多边形数据 :return: 转换后的DmPolyData实例(需提前实现该类及_from_obj方法)
Source code in dimine_python_sdk\lib\types\entity.py
405 406 407 408 409 410 411 | |
DmDbLayer
Source code in dimine_python_sdk\lib\types\entity.py
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | |
get_entities_count()
获取实体数量
Source code in dimine_python_sdk\lib\types\entity.py
558 559 560 | |
insert_entity(entity)
插入实体,支持 DmDbEntity 和 dmDbPolyline 类型
Source code in dimine_python_sdk\lib\types\entity.py
569 570 571 | |
insert_line(start, end)
插入直线,返回封装后的实体对象
Source code in dimine_python_sdk\lib\types\entity.py
579 580 581 582 | |
insert_polyline(points)
插入多段线,返回封装后的实体对象
Source code in dimine_python_sdk\lib\types\entity.py
573 574 575 576 577 | |
open_next_entity()
打开下一个实体,返回封装后的实体对象,无实体时返回 None
Source code in dimine_python_sdk\lib\types\entity.py
562 563 564 565 566 567 | |
set_work_plane_entity(work_plane)
设置工作平面实体
Source code in dimine_python_sdk\lib\types\entity.py
584 585 586 | |
start_query_entity()
开始查询实体
example:
dmf = DmDbDatabase()
db = dmf.load('E:/dassistant/tests/123.dmf')
print("获取图层数量:",dmf.get_layers_count())
act_layer = dmf.get_active_layer()
layerCount = dmf.get_layers_count()
for i in range(layerCount):
layer = dmf.get_layer_by_index(i)
if layer is None:
continue
print("图层实体数量:",layer.get_entities_count())
layer.start_query_entity()
entity = layer.open_next_entity()
while entity is not None:
nType = entity.get_type()
#print("实体类型:",nType)
if nType == EntityType.ETT_POLYLINE:
···
entity = layer.open_next_entity()
Source code in dimine_python_sdk\lib\types\entity.py
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 | |
DmDbShell
shell类
Source code in dimine_python_sdk\lib\types\entity.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
__init__()
构造函数,初始化Shell对象
Source code in dimine_python_sdk\lib\types\entity.py
61 62 63 | |
DmDbWorkPlane
Source code in dimine_python_sdk\lib\types\entity.py
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | |
__init__()
构造工作平面
Source code in dimine_python_sdk\lib\types\entity.py
489 490 491 492 493 | |
set_normal(normal)
设置法向量
Source code in dimine_python_sdk\lib\types\entity.py
495 496 497 | |
set_origin(origin)
设置原点
Source code in dimine_python_sdk\lib\types\entity.py
499 500 501 | |
set_x_axis(x_axis)
设置X轴方向
Source code in dimine_python_sdk\lib\types\entity.py
503 504 505 | |
set_y_axis(y_axis)
设置Y轴方向
Source code in dimine_python_sdk\lib\types\entity.py
507 508 509 | |
DmPolyData
多边形数据类
Source code in dimine_python_sdk\lib\types\entity.py
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 118 119 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 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
__init__()
构造函数:初始化多边形数据对象 :return: None
Source code in dimine_python_sdk\lib\types\entity.py
80 81 82 83 84 85 | |
__repr__()
字符串表示 :return: 多边形数据的标准字符串表示
Source code in dimine_python_sdk\lib\types\entity.py
312 313 314 315 316 317 | |
extract_polylines()
提取多段线实体 :return: 多段线列表,每个元素为DmDbPolyline实例
example:
poly_data = DmPolyData()
polylines = poly_data.extract_polylines()
Source code in dimine_python_sdk\lib\types\entity.py
297 298 299 300 301 302 303 304 305 306 307 308 309 | |
get_bounds()
获取数据的包围盒 :return: 包围盒坐标列表 [min_x, max_x, min_y, max_y, min_z, max_z]
example:
poly_data = DmPolyData()
bounds = poly_data.get_bounds()
Source code in dimine_python_sdk\lib\types\entity.py
166 167 168 169 170 171 172 173 174 175 176 177 | |
get_data_type()
获取多边形数据类型 :return: 数据类型编码(整数)
example:
poly_data = DmPolyData()
data_type = poly_data.get_data_type()
Source code in dimine_python_sdk\lib\types\entity.py
88 89 90 91 92 93 94 95 96 97 98 99 | |
get_dm_points()
获取关联的点集合 :return: DmPoints实例
example:
poly_data = DmPolyData()
points = DmPoints()
poly_data.set_dm_points(points)
dm_points = poly_data.get_dm_points()
Source code in dimine_python_sdk\lib\types\entity.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
get_number_of_cells()
获取单元格数量 :return: 单元格数量(整数)
example:
poly_data = DmPolyData()
num_cells = poly_data.get_number_of_cells()
Source code in dimine_python_sdk\lib\types\entity.py
101 102 103 104 105 106 107 108 109 110 111 112 | |
get_number_of_lines()
获取线段数量 :return: 线段数量(整数)
example:
poly_data = DmPolyData()
num_lines = poly_data.get_number_of_lines()
Source code in dimine_python_sdk\lib\types\entity.py
127 128 129 130 131 132 133 134 135 136 137 138 | |
get_number_of_points()
获取点的总数量 :return: 点数量(整数)
example:
poly_data = DmPolyData()
num_points = poly_data.get_number_of_points()
Source code in dimine_python_sdk\lib\types\entity.py
153 154 155 156 157 158 159 160 161 162 163 164 | |
get_number_of_polys()
获取多边形数量 :return: 多边形数量(整数)
example:
poly_data = DmPolyData()
num_polys = poly_data.get_number_of_polys()
Source code in dimine_python_sdk\lib\types\entity.py
140 141 142 143 144 145 146 147 148 149 150 151 | |
get_number_of_verts()
获取顶点数量 :return: 顶点数量(整数)
example:
poly_data = DmPolyData()
num_verts = poly_data.get_number_of_verts()
Source code in dimine_python_sdk\lib\types\entity.py
114 115 116 117 118 119 120 121 122 123 124 125 | |
get_point(point_id)
根据ID获取点 :param point_id: 点的唯一ID(整数) :return: 对应的DmDPoint实例
example:
poly_data = DmPolyData()
point_id = poly_data.insert_unique_point(DmDPoint(0.0, 0.0, 0.0))
point = poly_data.get_point(point_id)
Source code in dimine_python_sdk\lib\types\entity.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |
get_poly_cell(cell_index)
获取指定索引的多边形单元格的点索引 :param cell_index: 单元格索引(整数) :return: 点索引列表(整数列表)
example:
poly_data = DmPolyData()
cell_index = 0
point_indexes = poly_data.get_poly_cell(cell_index)
Source code in dimine_python_sdk\lib\types\entity.py
281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
insert_next_line_cell(point_indexes)
插入线段单元格 :param point_indexes: 点索引列表(整数列表)
example:
poly_data = DmPolyData()
poly_data.insert_next_line_cell([0, 1, 2])
Source code in dimine_python_sdk\lib\types\entity.py
193 194 195 196 197 198 199 200 201 202 203 204 | |
insert_next_poly_cell(point_indexes)
插入多边形单元格 :param point_indexes: 点索引列表(整数列表)
example:
poly_data = DmPolyData()
poly_data.insert_next_poly_cell([0, 1, 2])
Source code in dimine_python_sdk\lib\types\entity.py
206 207 208 209 210 211 212 213 214 215 216 217 | |
insert_next_vert_cell(point_indexes)
插入顶点单元格 :param point_indexes: 点索引列表(整数列表)
example:
poly_data = DmPolyData()
poly_data.insert_next_vert_cell([0, 1, 2])
Source code in dimine_python_sdk\lib\types\entity.py
180 181 182 183 184 185 186 187 188 189 190 191 | |
insert_unique_point(point)
插入唯一的点(自动去重) :param point: 待插入的点(DmDPoint实例) :return: 点的唯一ID(整数)
example:
poly_data = DmPolyData()
point_id = poly_data.insert_unique_point(DmDPoint(0.0, 0.0, 0.0))
Source code in dimine_python_sdk\lib\types\entity.py
220 221 222 223 224 225 226 227 228 229 230 231 232 | |
set_dm_points(points)
设置关联的点集合 :param points: DmPoints实例
example:
poly_data = DmPolyData()
points = DmPoints()
poly_data.set_dm_points(points)
Source code in dimine_python_sdk\lib\types\entity.py
250 251 252 253 254 255 256 257 258 259 260 261 262 | |