明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3131|回复: 7

[求助]如何生成闭合多段线?

[复制链接]
发表于 2005-3-19 20:17 | 显示全部楼层 |阅读模式
类似CAD自带的边界图案填充命令,拾取点或选择对象时生成闭合多段线,但是源对象不要删除,遇到圆弧时自动用一定数量的线段来代替,线段的长度由用户输入。应该如何编写,或者提供一下思路。
发表于 2005-3-23 08:16 | 显示全部楼层
Just for your reference...It's a reply from Joe Parker Re: Create Boundary
counting the modelspace objects before and after a call to this sub will
tell you if there are any new polylines created- messy but it works
Private Sub Bound()
Dim Pt As Variant, gotpt As Boolean
gotpt = False

Do
On Error Resume Next
Pt = ThisDrawing.Utility.GetPoint(, "Select an Internal Point")
If Err Then
If GetAsyncKeyState(VK_ESCAPE) And &H8000& Then
Exit Function
End If
Err.Clear
gotpt = False
Else
gotpt = True
End If
Loop While Not gotpt
On Error GoTo 0
ThisDrawing.SendCommand Chr(3) & Chr(3) & "-boundary" & vbCr & Pt(0) & "," &
Pt(1) & vbCr & vbCr
End Sub
 楼主| 发表于 2005-3-23 20:22 | 显示全部楼层
GetAsyncKeyState这个函数没有定义
发表于 2005-3-23 22:16 | 显示全部楼层
Option Explicit
Private Const VK_ESCAPE = &H1B
Private Declare Function GetAsyncKeyState Lib "user32" _
(ByVal vKey As Long) As Integer Private Sub Bound()
Dim Pt As Variant, gotpt As Boolean
gotpt = False Do
On Error Resume Next
Pt = ThisDrawing.Utility.GetPoint(, "Select an Internal Point")
If Err Then
If GetAsyncKeyState(VK_ESCAPE) And &H8000& Then
Exit Sub
End If
Err.Clear
gotpt = False
Else
gotpt = True
End If
Loop While Not gotpt
On Error GoTo 0
ThisDrawing.SendCommand Chr(3) & Chr(3) & "-boundary" & vbCr & Pt(0) & "," & _
Pt(1) & vbCr & vbCr
End Sub
 楼主| 发表于 2005-3-24 19:41 | 显示全部楼层
多谢版主的回复,但是程序只相当于正常的边界命令,还达不到我的要求,能否改进一下?谢谢!
 楼主| 发表于 2005-3-30 22:46 | 显示全部楼层
怎么没人知道吗?
 楼主| 发表于 2005-4-10 20:51 | 显示全部楼层
再顶一次。
发表于 2020-3-29 23:09 | 显示全部楼层
NNWS神速神速
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-4 11:32 , Processed in 0.411497 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表