wzw393831667 发表于 2009-5-9 15:10:00

[求助]怎么将cad中的直线偏移一定距离

以下是源程序:程序的目的是在有各种图形的cad图中,把直线选出来,之后再将直线偏移一定的距离。 现在我可以选出直线,但是不知道该怎么偏移。请大家帮下忙~不盛感激。
Dim acadDoc As Object
Dim acadApp As Object
Private Sub CmdTj_Click()
   
    MsgBox "There are " & acadDoc.Layers.Count & " layer(s) in the drawing."
    MsgBox "There are " & acadDoc.ModelSpace.Count & " object(s) in ModelSpace."
    Dim objCount As Integer
    Dim I As Integer
    objCount = acadDoc.ModelSpace.Count
   
    Dim mspaceObj As AcadObject
    For I = 0 To objCount - 1
   Set mspaceObj = acadDoc.ModelSpace.Item(I)
      If mspaceObj.ObjectName = "AcDbLine" Then
         MsgBox "The objects in ModelSpace include: " & mspaceObj.ObjectName, vbInformation, "Count Example"
      End If
    Next
End Sub
Private Sub Form_Load()
Set acadApp = GetObject(, ".Application")
Set acadDoc = acadApp.ActiveDocument
End Sub

雪山飞狐_lzh 发表于 2009-5-9 15:22:00

Moves an object along a vector.
|
Signature
object.Move Point1, Point2
Object
,
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.
Remarks
The two points you specify define a displacement vector indicating how far the given object is to be moved and in what direction.

wzw393831667 发表于 2009-5-9 22:17:00

谢谢了但是没怎么看明白,能不能稍微详细的解释一下。或者在我的程序的基础上给出源代码呢?

wzw393831667 发表于 2009-5-10 10:50:00


谢谢但是你说的是move我是问怎么offset?最好在我的程序基础上来点代码~~

雪山飞狐_lzh 发表于 2009-5-10 21:23:00

mspaceObj.offset(dist)

xuyajun1979 发表于 2009-5-14 19:13:00

在前面加 Dim entobj As AcadEntity
在该语句后 MsgBox "The objects in ModelSpace include: " & mspaceObj.ObjectName, vbInformation, "Count Example"
      加 Set entobj = mspaceObj
      entobj.Offset (-5)
-5为偏移量

wzw393831667 发表于 2009-5-16 10:53:00

已解决

lifefun 发表于 2012-11-7 16:59:00

不知到沿着直线偏移文字怎么弄的
页: [1]
查看完整版本: [求助]怎么将cad中的直线偏移一定距离