[求助]怎么将cad中的直线偏移一定距离
<p>以下是源程序:程序的目的是在有各种图形的cad图中,把直线选出来,之后再将直线偏移一定的距离。 现在我可以选出直线,但是不知道该怎么偏移。请大家帮下忙~不盛感激。</p><p></p><p>Dim acadDoc As Object<br/>Dim acadApp As Object</p><p><br/>Private Sub CmdTj_Click()</p><p> <br/> MsgBox "There are " & acadDoc.Layers.Count & " layer(s) in the drawing."<br/> MsgBox "There are " & acadDoc.ModelSpace.Count & " object(s) in ModelSpace."</p><p> Dim objCount As Integer<br/> Dim I As Integer<br/> objCount = acadDoc.ModelSpace.Count<br/> <br/> Dim mspaceObj As AcadObject</p><p> For I = 0 To objCount - 1<br/> Set mspaceObj = acadDoc.ModelSpace.Item(I)<br/> If mspaceObj.ObjectName = "AcDbLine" Then<br/> MsgBox "The objects in ModelSpace include: " & mspaceObj.ObjectName, vbInformation, "Count Example"<br/><br/> End If<br/> Next<br/>End Sub</p><p>Private Sub Form_Load()<br/>Set acadApp = GetObject(, "AutoCAD.Application")<br/>Set acadDoc = acadApp.ActiveDocument<br/>End Sub</p><p></p><p></p> <p class="1-liner">Moves an object along a vector.</p><p class="h1-access"><a href="mk:@MSITStore:C:\Program%20Files\AutoCAD%202008\help\acadauto.chm::/move_see_also.htm">See Also</a> | <a href="mk:@MSITStore:C:\Program%20Files\AutoCAD%202008\help\acadauto.chm::/ex_move.htm">Example</a></p><p class="Heading-2">Signature </p><p class="syntax">object.Move Point1, Point2 </p><p class="element">Object</p><p class="element-desc"><a href="mk:@MSITStore:C:\Program%20Files\AutoCAD%202008\help\acadauto.chm::/all_drawing_objects.htm">All Drawing Objects</a>, <a href="mk:@MSITStore:C:\Program%20Files\AutoCAD%202008\help\acadauto.chm::/idh_attributeref_object.htm">AttributeReference</a><br/>The object or objects this method applies to. </p><p class="element">Point1</p><p class="element-desc">Variant (three-element array of doubles); input-only<br/>The 3D WCS coordinates specifying the first point of the move vector. </p><p class="element">Point2</p><p class="element-desc">Variant (three-element array of doubles); input-only<br/>The 3D WCS coordinates specifying the second point of the move vector. </p><p class="Heading-2">Remarks </p><p class="body">The two points you specify define a displacement vector indicating how far the given object is to be moved and in what direction.</p> 谢谢了但是没怎么看明白,能不能稍微详细的解释一下。或者在我的程序的基础上给出源代码呢? lzh741206发表于2009-5-9 15:22:00static/image/common/back.gifMoves an object along a vector.See Also | ExampleSignature object.Move Point1, Point2 ObjectAll Drawing Objects, AttributeReferenceThe object or objects this method applies to. Po<p></p>谢谢 但是你说的是move 我是问怎么offset?最好在我的程序基础上来点代码~~ mspaceObj.offset(dist) <p> 在前面加 Dim entobj As AcadEntity </p><p>在该语句后 MsgBox "The objects in ModelSpace include: " & mspaceObj.ObjectName, vbInformation, "Count Example"<br/></p><p> 加 Set entobj = mspaceObj<br/> entobj.Offset (-5)<br/>-5为偏移量</p> <p>已解决</p> 不知到沿着直线偏移文字怎么弄的
页:
[1]