明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2068|回复: 12

求助

  [复制链接]
发表于 2004-6-19 20:33:00 | 显示全部楼层 |阅读模式
怎样把一个整个图层中的图形MIRROR或MOVE


怎么把图形中倒数第N个图形MIRROR 或MOVE
发表于 2004-6-19 20:42:00 | 显示全部楼层

Signature

object.Move Point1, Point2

Object

MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/all_drawing_objects.htm" target="_blank" >All Drawing Objects, MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_attributeref_object.htm" target="_blank" >AttributeReference
The object or objects this method applies to.

Point1

Variant (three-element array of doubles); input-only
The 3D WCS coordinates specifying the first point of the move vector.

Point2

Variant (three-element array of doubles); input-only
The 3D WCS coordinates specifying the second point of the move vector.

Signature

RetVal = object.Mirror(Point1, Point2)

Object

MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/all_drawing_objects.htm" target="_blank" >All Drawing Objects
The object or objects this method applies to.

Point1

Variant (three-element array of doubles); input-only
The 3D WCS coordinates specifying the first point of the mirror axis.

Point2

Variant (three-element array of doubles); input-only
The 3D WCS coordinates specifying the second point of the mirror axis.

RetVal

Mirrored object
This object can be one of any MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/all_drawing_objects.htm" target="_blank" >Drawing Objects.

 楼主| 发表于 2004-6-19 20:56:00 | 显示全部楼层
这个我在帮助里看到过


我现在要做的是把倒数第32到最后一个图形,整体移动


或者说把一个图层中的所有图形
发表于 2004-6-19 21:01:00 | 显示全部楼层
用For循环做呀 或SendCommand 参见http://bbs.mjtd.com/forum.php?mod=viewthread&tid=20705
 楼主| 发表于 2004-6-19 21:32:00 | 显示全部楼层
  1. Sub QSelLayerControl()
  2. '程序功能:快速选取一层的所有对象,进行相应的操作
  3.        Dim i   As AcadEntity
  4.        Dim ss As AcadSelectionSet
  5.        Dim ft(0) As Integer, fd(0)
  6.        Dim pLayer As String
  7.        Dim pControl As String
  8.        pLayer = ThisDrawing.Utility.GetString(0, vbCrlLf & "请输入层名:")
  9.        ft(0) = 8: fd(0) = pLayer
  10.        Set ss = ThisDrawing.ActiveSelectionSet
  11.        ss.Clear
  12.        ss.Select acSelectionSetAll, , , ft, fd
  13.        If ss.Count = 0 Then
  14.                ss.Delete
  15.                ThisDrawing.Utility.Prompt "层内没有对象或层不存在!"
  16.        Else
  17.                ThisDrawing.Utility.InitializeUserInput 1, "Move Copy Erase"
  18.                pControl = ThisDrawing.Utility.GetKeyword(vbCr & "请输入操作名[Move(移动)/Copy(复制)/Erase(删除)]:")
  19.                ThisDrawing.SendCommand "." & pControl & vbCr & "p" & vbCr & vbCr
  20.        End If
如果我不需要在CAD中选择等操作,直接在代码中实现.可以吗?
发表于 2004-6-19 22:19:00 | 显示全部楼层
假设pObjs是你程序中获得的实体数组或集合或选择集
  1. For Each i In pObjs
  2.            i.Move Point1, Point2
  3. Next i
复制代码
 楼主| 发表于 2004-6-20 08:19:00 | 显示全部楼层
lzh741206发表于2004-6-19 22:19:00假设pObjs是你程序中获得的实体数组或集合或选择集 For Each i In pObjs i.Move Point1, Point2 Next i
大哥:帮我写完整一点好吗? 先MIRROR后MOVE(层中的所有图形) 急用
发表于 2004-6-20 10:10:00 | 显示全部楼层
Sub MMLayer(ByVal LayerName As String, ByVal p1, ByVal p2, ByVal p3, ByVal p4)
Dim i As AcadEntity
Dim ft(0) As Integer, fd(0)
Dim ss As AcadSelectionSet
Set ss = ThisDrawing.SelectionSets.Add("*TlsTest*")
ft(0) = 8: fd(0) = LayerName
ss.Select acSelectionSetAll, , , ft, fd
For Each i In ss
i.Mirror(p1, p2).Move p3, p4
i.Delete
Next i
ErrHandle:
ss.Delete
End Sub
 楼主| 发表于 2004-6-20 10:12:00 | 显示全部楼层
  1. Sub zhouhui1()
  2. Dim layerObj As AcadLayerSet layerObj = ThisDrawing.Layers.Add("ABC")  Dim x As AcadObject
  3. 'x.Color = acByLayer
  4. For Each x In ThisDrawing.ModelSpace
  5.      x.Layer = "ABC"
  6.      
  7. ' 指定“ABC”图层的颜色为红色     ' x.Color = acRed
  8.        x.Update
  9. Next xDim point1(0 To 2) As Double
  10.        Dim point2(0 To 2) As Double
  11.        point1(0) = 0: point1(1) = 0: point1(2) = 0
  12.        point2(0) = 2: point2(1) = 0: point2(2) = 0
  13. Dim i As AcadObject
  14. For Each i In layerObj
  15.            i.Move point1, point2
  16. Next iEnd Sub
帮我看看最后几行吧,有问题呀
 楼主| 发表于 2004-6-20 10:17:00 | 显示全部楼层
大哥帮忙呀. 我已经写了上面的程序了,可是运行到For Each i In layerObj 出现错误
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-28 02:54 , Processed in 0.202144 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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