乐筑天下

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

不确定顶点数目的情况下怎么绘制多段线?

[复制链接]

1

主题

3

帖子

1

银币

初来乍到

Rank: 1

铜币
7
发表于 2006-2-6 11:22:00 | 显示全部楼层 |阅读模式
点的数量是由变量给定,需要据此生成多端线,怎么用vba实现呢?
先谢谢了!
回复

使用道具 举报

1

主题

157

帖子

2

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
161
发表于 2006-2-6 11:32:00 | 显示全部楼层
不能先学定数目再画吗?
回复

使用道具 举报

1

主题

3

帖子

1

银币

初来乍到

Rank: 1

铜币
7
发表于 2006-2-6 14:39:00 | 显示全部楼层
想连续生成截面,每个截面复杂程度不一样啊。
回复

使用道具 举报

3

主题

11

帖子

1

银币

初来乍到

Rank: 1

铜币
23
发表于 2006-2-6 14:54:00 | 显示全部楼层
  1.   Dim index As Integer   
  2.     index = 2
  3.    
  4.     Dim pt1 As Variant
  5.     pt1 = ThisDrawing.Utility.GetPoint(, "输入第一点:")
  6.     If Err Then                     
  7.         Err.Clear
  8.         Exit Sub
  9.     End If
  10.     Dim ptPrevious As Variant, ptCurrent As Variant      
  11.     ptPrevious = pt1
  12.    
  13. nextpt:
  14.     ptCurrent = ThisDrawing.Utility.GetPoint(ptPrevious, "输入下一点:")
  15.     If Err Then                    
  16.         Err.Clear
  17.         Exit Sub
  18.     End If
  19.    
  20.     Dim objPline As AcadLWPolyline
  21.     If index = 2 Then
  22.         Dim points(0 To 3) As Double
  23.         points(0) = ptPrevious(0)
  24.         points(1) = ptPrevious(1)
  25.         points(2) = ptCurrent(0)
  26.         points(3) = ptCurrent(1)
  27.         Set objPline = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
  28.     ElseIf index > 2 Then
  29.         Dim ptVert(0 To 1) As Double
  30.         ptVert(0) = ptCurrent(0)
  31.         ptVert(1) = ptCurrent(1)
  32.         objPline.AddVertex index - 1, ptVert
  33.     End If
  34.     index = index + 1
  35.     ptPrevious = ptCurrent
  36.     GoTo nextpt
是不是要这样?
回复

使用道具 举报

1

主题

3

帖子

1

银币

初来乍到

Rank: 1

铜币
7
发表于 2006-2-6 15:17:00 | 显示全部楼层
嗯,就是楼上这个方法了,用不断添加点的方式实现,谢谢!
回复

使用道具 举报

2

主题

39

帖子

5

银币

初来乍到

Rank: 1

铜币
47
发表于 2006-2-6 21:20:00 | 显示全部楼层
为什么不用sendcommand呢?
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-7-5 00:54 , Processed in 0.551998 second(s), 64 queries .

© 2020-2025 乐筑天下

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