0

我想计算每个 LWPOLYLINE 的电路。目前我正在遍历每条 LWPolyline 并获取点和长度。有人可以告诉我如何计算它,特别是如果 gien LWPolyline 的点数可以不同。

循环遍历每个 LWPolyline:

for num, line in enumerate(msp.query('LWPOLYLINE')):
                    with line.points() as points:
                        print(f'The points = {points}')
                        print(f'The lenght = {len(points)}')

例子:

The points = [(0.0, 0.0, 0.0, 0.0, 0.0), (100.0, 0.0, 0.0, 0.0, 0.0), (100.0, 50.0, 0.0, 0.0, 0.0), (0.0, 50.0, 0.0, 0.0, 0.0)]
The lenght = 4

这里的电路将是 300

The points = [(206.7283886139056, -73.5, 0.0, 0.0, 0.0), (204.7076626717419, -77.0, 0.0, 0.0, 0.0), (206.7283886139056, -80.5, 0.0, 0.0, 0.0), (210.7698404982329, -80.5, 0.0, 0.0, 0.0), (212.7905664403967, -77.0, 0.0, 0.0, 0.0), (210.7698404982329, -73.5, 0.0, 0.0, 0.0)]
The lenght = 6
4

0 回答 0