乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 131|回复: 6

[编程交流] Draw Polyline with x,y, & z co

[复制链接]

2

主题

9

帖子

7

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 21:57:23 | 显示全部楼层 |阅读模式
Background:
 
I receive a .dxf with points. These points are arrayed in x,y,& z coordinates. I have extracted the coordinates into collections and I am trying to draw a polyline using those coordinates as vertices. It is important that the z coordinate be included. All points differ in their x,y,z coordinates.
 
The collection is a collection of arrays (0 to 2).
 
This was my attempt to call vertices straight from the collection:
 
  1. ThisDrawing.ActiveLayer = newLayerSet pLineA = ThisDrawing.ModelSpace.Add3DPoly(pointCollA.Item(1), pointCollA.Item(2), pointCollA.Item(3), _                                               pointCollA.Item(4), pointCollA.Item(5), pointCollA.Item(6), _                                               pointCollA.Item(7), pointCollA.Item(, pointCollA.Item(9), _                                               pointCollA.Item(10), pointCollA.Item(11), pointCollA.Item(12), _                                               pointCollA.Item(13), pointCollA.Item(14), pointCollA.Item(15), _                                               pointCollA.Item(16), pointCollA.Item(17), pointCollA.Item(18), _                                               pointCollA.Item(19), pointCollA.Item(20), pointCollA.Item(21), _                                               pointCollA.Item(22), pointCollA.Item(23), pointCollA.Item(24), _                                               pointCollA.Item(25))ThisDrawing.ActiveLayer = newLayer1Set pLineB = ThisDrawing.ModelSpace.Add3DPoly(pointCollB.Item(1), pointCollB.Item(2), pointCollB.Item(3), _                                               pointCollB.Item(4), pointCollB.Item(5), pointCollB.Item(6), _                                               pointCollB.Item(7), pointCollB.Item(, pointCollB.Item(9), _                                               pointCollB.Item(10), pointCollB.Item(11), pointCollB.Item(12), _                                               pointCollB.Item(13), pointCollB.Item(14), pointCollB.Item(15), _                                               pointCollB.Item(16), pointCollB.Item(17), pointCollB.Item(18), _                                               pointCollB.Item(19), pointCollB.Item(20), pointCollB.Item(21), _                                               pointCollB.Item(22), pointCollB.Item(23), pointCollB.Item(24), _                                               pointCollB.Item(25))
Result is: Compile error: Wrong number of arguments or invalid property assignment.
 
Thank you for help!
回复

使用道具 举报

2

主题

9

帖子

7

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 22:09:46 | 显示全部楼层
BTW ive tried this with AddPolyline & AddLightWeightPolyline too.
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 22:22:50 | 显示全部楼层
It would be almost easier to do a script just need a blank line to end the pline
 
  1. 3dpoly1,2,33,4,56,7,83dpoly9,1,23,4,56,7,8
 
I have used this with a list of pts yes its lisp
  1. ; create pline by picking points press enter when finished(command "_pline")(while (= (getvar "cmdactive") 1 ) (command pause) ; replace the (command pause) with your xyz within a loop)
回复

使用道具 举报

2

主题

9

帖子

7

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 22:32:49 | 显示全部楼层
The points already exist. Its survey points from a crane rail.
回复

使用道具 举报

10

主题

973

帖子

909

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-6 22:47:21 | 显示全部楼层
If
 
 
and the Add3DPoly Method requires a 1 dimensional array then you may need something like this construct:
 
  1. Dim Coords(74) as DoubleDim IndexForArray as IntegerDim CountIndex as Integer….For Index as Integer = 0 to 24IndexForArray = Index – 1CountIndex = Index * 3Coords(CountIndex) = pointCollA.Item(IndexForArray)(0)Coords(CountIndex + 1) = pointCollA.Item(IndexForArray)(1)Coords(CountIndex + 2) = pointCollA.Item(IndexForArray)(2)Next
回复

使用道具 举报

2

主题

9

帖子

7

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 22:47:28 | 显示全部楼层
Yep. It needed two arrays to initialize, then I can append with the additional vertices.
 
Here was the final solution:
 
  1.     For Each coords In railOne       If index < count Then           If index < 1 Then               handle = railOne(index)               Set object = ThisDrawing.HandleToObject(handle)                   points(0) = object.Coordinates(0)                   points(1) = object.Coordinates(1)                   points(2) = object.Coordinates(2)               index = index + 1               handle = railOne(index)               Set object = ThisDrawing.HandleToObject(handle)                   points(3) = object.Coordinates(0)                   points(4) = object.Coordinates(1)                   points(5) = object.Coordinates(2)                   Set pLineA = ThisDrawing.ModelSpace.Add3DPoly(points)                   index = index + 1           Else               handle = railOne(index)               Set object = ThisDrawing.HandleToObject(handle)                   points1(0) = object.Coordinates(0)                   points1(1) = object.Coordinates(1)                   points1(2) = object.Coordinates(2)               pLineA.AppendVertex points1               index = index + 1           End If       Else       End If   Next coords
Thanks for all the help. You guys rock!!
回复

使用道具 举报

2

主题

9

帖子

7

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 22:58:21 | 显示全部楼层
I meant array (0 To 5) to initialize.
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-5-26 01:20 , Processed in 0.315182 second(s), 66 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表