乐筑天下

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

反向滑索

[复制链接]

12

主题

150

帖子

3

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
198
发表于 2006-6-21 22:19:51 | 显示全部楼层 |阅读模式
我从Malcom Fernandez那里得到了这些。他是一个很大的帮助,喜欢分享。
一个用于打开,一个用于关闭。
  1. Private Sub reverse_pline(polyEnt As AcadLWPolyline)
  2. 'this does a closed polyline
  3.         Dim idx As Integer
  4.         Dim numPts As Integer
  5.         Dim numBulge As Integer
  6.         Dim bulge As Double
  7. 'set an array to store the coordinates of the pline
  8.         Dim newcoord() As Double
  9.         numPts = UBound(polyEnt.Coordinates) - 1 'was -1
  10.         ReDim newcoord(numPts + 1) 'was 1
  11. 'set an array to store the bludge factor for each segment
  12.         Dim newbulge() As Double
  13.         numBulge = (((numPts)) / 2)  'was -3)/2
  14.         ReDim newbulge(numBulge)
  15. 'loop through the vertices of the pline and save x,y in reverse order
  16.         For idx = 0 To numPts Step 2
  17.             newcoord(numPts - idx) = polyEnt.Coordinates(idx)
  18.             newcoord(numPts - idx + 1) = polyEnt.Coordinates(idx + 1) 'was +1 in 2 places
  19.         Next idx
  20. 'loop through the bulge factors and save in reverse order
  21.         For idx = 0 To numBulge
  22.           If idx  numBulge Then
  23.             newbulge(numBulge - idx) = polyEnt.GetBulge(idx) * -1
  24.             
  25.             Else
  26.             
  27.             newbulge(0) = polyEnt.GetBulge(idx) * -1
  28.             
  29.           End If
  30.         Next idx
  31.         
  32. 'reverse the original pline
  33.         polyEnt.Coordinates = newcoord
  34.         
  35.         For idx = 0 To numBulge
  36.         
  37.           If idx = 0 Then
  38.             polyEnt.SetBulge (numBulge), newbulge(idx)
  39.           Else
  40.             polyEnt.SetBulge (idx - 1), newbulge(idx)
  41.           End If
  42.             
  43.         Next idx
  44.         
  45.         polyEnt.Update
  46. End Sub
  1. Private Sub revPline(polyEnt As AcadLWPolyline)
  2. 'this does an open polyline
  3.         Dim idx As Integer
  4.         Dim numPts As Integer
  5.         Dim numBulge As Integer
  6.         Dim bulge As Double
  7. 'set an array to store the coordinates of the pline
  8.         Dim newcoord() As Double
  9.         numPts = UBound(polyEnt.Coordinates) - 1
  10.         ReDim newcoord(numPts + 1)
  11. 'set an array to store the bludge factor for each segment
  12.         Dim newbulge() As Double
  13.         numBulge = ((numPts - 3) / 2)
  14.         
  15.         If ((UBound(polyEnt.Coordinates) + 1) / 2) Mod 2 = 0 Then
  16.            GoTo myout
  17.         Else
  18.            numBulge = numBulge + 1
  19.         End If
  20. myout:
  21.         ReDim newbulge(numBulge)
  22. 'loop through the vertices of the pline and save x,y in reverse order
  23.         For idx = 0 To numPts Step 2
  24.             newcoord(numPts - idx) = polyEnt.Coordinates(idx)
  25.             newcoord(numPts - idx + 1) = polyEnt.Coordinates(idx + 1)
  26.         Next idx
  27. 'loop through the bulge factors and save in reverse order
  28.         For idx = 0 To numBulge
  29.             newbulge(numBulge - idx) = polyEnt.GetBulge(idx) * -1
  30.         Next idx
  31.         
  32. 'reverse the original pline
  33.         polyEnt.Coordinates = newcoord
  34.         
  35.         For idx = 0 To numBulge
  36.             polyEnt.SetBulge idx, newbulge(idx)
  37.         Next idx
  38.         
  39.         polyEnt.Update
  40. End Sub

本帖以下内容被隐藏保护;需要你回复后,才能看到!

游客,如果您要查看本帖隐藏内容请回复
回复

使用道具 举报

8

主题

65

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
86
发表于 2006-6-22 00:28:43 | 显示全部楼层
您的程序没有保持段的可变宽度…
在LISP上查看我的程序。
http://www.theswamp.org/index.php?topic=8878.msg114590#msg114590
回复

使用道具 举报

12

主题

150

帖子

3

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
198
发表于 2006-6-23 09:42:48 | 显示全部楼层
无论如何,谢谢你,但我不读lisp。我不知道你在那里干什么
使用budge数组作为起点,在此处添加该属性不会有太多工作。
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-7-5 23:54 , Processed in 0.635830 second(s), 58 queries .

© 2020-2025 乐筑天下

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