明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1655|回复: 2

selectionset结合Move,rotate使用

[复制链接]
发表于 2008-9-8 16:10:00 | 显示全部楼层 |阅读模式
  1. Private Sub Form_Load()
  2.   Dim tempSet As AcadSelectionSet
  3.   Set tempSet = mmm
  4. End Sub
  5. Function mmm() As AcadSelectionSet
  6.   Dim Sset As AcadSelectionSet
  7.   Set Sset = DrawingGB6170Front(1, 2)
  8.   Dim pp(0 To 2) As Double
  9.   pp(0) = 100: pp(1) = 100: pp(2) = 0
  10.   For ii = 0 To Sset.Count - 1
  11.     Sset.Item(ii).Rotate pp, 90 * 3.1415926 / 180
  12.   Next ii
  13.   Set mmm = Sset
  14. End Function
  15. Function CreateSelectionSet() As AcadSelectionSet
  16.   Dim appAutoCAD As AutoCAD.AcadApplication
  17.   On Error Resume Next
  18.   Set appAutoCad = GetObject(, "AutoCAD.Application")
  19.   If Err Then
  20.     Err.Clear
  21.     Set appAutoCad = CreateObject("AutoCAD.Application")
  22.   End If
  23.   appAutoCad.Visible = True
  24.   Dim AcadDoc As AcadDocument
  25.   Set AcadDoc = appAutoCad.ActiveDocument
  26.   With AcadDoc
  27.     On Error Resume Next
  28.     If Not IsNull(.SelectionSets.Item("MySetSelectionSet")) Then
  29.       Set CreateSelectionSet = .SelectionSets.Item("MySetSelectionSet")
  30.       CreateSelectionSet.Delete
  31.     End If
  32.     Set CreateSelectionSet = .SelectionSets.Add("MySetSelectionSet")
  33.   End With
  34. End Function
  35. Function DrawingGB6170Front(xDirection As Double, yDirection As Double) As AcadSelectionSet
  36.     Dim CadEntity As New MyAcadEntity
  37.   Dim objModelSpace As AcadModelSpace
  38.   Set objModelSpace = CadEntity.objModelSpace
  39.   NN = objModelSpace.Count - 1
  40.   Dim tempCollection() As AcadEntity
  41.   ReDim tempCollection(NN) As AcadEntity
  42.   Dim Sset As AcadSelectionSet
  43. For ii = 0 To objModelSpace.Count - 1
  44.   Set tempCollection(ii) = objModelSpace.Item(ii)
  45.   
  46.   Set Sset = CreateSelectionSet
  47. Next ii
  48.   Sset.AddItems tempCollection
  49.   Set DrawingGB6170Front = Sset
  50. End Function
发表于 2008-9-8 17:04:00 | 显示全部楼层
收下学习一下
发表于 2008-9-23 01:00:00 | 显示全部楼层
要是能配上注解就好了,顺便在注上代码的功能、目的、接口等信息
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-26 07:47 , Processed in 0.153733 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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