明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2278|回复: 2

如何计算图形中直线的条数(VBA)

[复制链接]
发表于 2008-5-5 16:58:00 | 显示全部楼层 |阅读模式

我正在做一个服装款式的编程,想识别一定范围内的直线条数,借此来划分款式类别。

本人学编程不久,请各位一定要帮忙啊!!

发表于 2008-5-6 11:47:00 | 显示全部楼层
Sub GetLinesCount()
On Error Resume Next
Dim LinesCount As Integer
Dim LinesSelection As AcadSelectionSet
Dim FilterType(0) As Integer
Dim FilterData(0) As Variant
FilterType(0) = 0
FilterData(0) = "LINE"
Set LinesSelection = ThisDrawing.SelectionSets.Item("YH_tools")
If Err <> 0 Then
Set LinesSelection = ThisDrawing.SelectionSets.Add("YH_tools")
End If
LinesSelection.Clear
LinesSelection.Select acSelectionSetAll, , , FilterType, FilterData
MsgBox "图档里面共有" & LinesSelection.Count & "条直线"
End Sub
 楼主| 发表于 2008-5-6 19:06:00 | 显示全部楼层

谢谢!!!!!!!!!!!!!

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

本版积分规则

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

GMT+8, 2025-2-27 23:20 , Processed in 0.181680 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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