问一个关于VBA处理...线与块的问题.
<P></P><P>像上面的程序..我希望用..VBA把..那个外部插入时..自动..把中间的线给分开成2段...达到下面那个图的效果.......再把..2段线..分另接到..这个块的..两端.</P>
<P>希望老大帮忙一下..</P> <P>是画气路图吗?哈哈,同道中人.</P> <P>哈哈。。是的。。电气原理图。。我是做成套设备的。。温州这里的。</P>
<P>具体的方法找不到。。现在只能用另一个麻烦些的办法来实现。</P>
<P> </P>
<P>Public Sub addWblock(strFilePath As String)<BR>On Error Resume Next</P>
<P> Dim InsertPoint As Variant<BR> Dim x, y, z As Double<BR> Dim myblock As AcadBlockReference<BR> Dim rstr As String<BR> Dim pos As Variant<BR> Dim tempstr As String<BR>fun:<BR> x = 1<BR> y = 1<BR> z = 1<BR> NL = Chr(13) & Chr(10)<BR> UserForm1.Hide<BR> InsertPoint = ThisDrawing.Utility.GetPoint(, NL)<BR> Set myblock = ThisDrawing.ModelSpace.InsertBlock(InsertPoint, strFilePath, x, y, z, 0, "")<BR> myblock.Update<BR> <BR> GetCursorPos (pos)<BR> ' If (strFilePath = "交叉点(跨越).dwg") Or (strFilePath = "交叉点(竖直).dwg") Or (Left$(strFilePath, 4) = "(开关)") Or (Left$(strFilePath, 2) = "按钮") Then<BR> Dim pnt1 As Variant<BR> Dim entObj1 As AcadEntity<BR> ' ThisDrawing.Utility.GetEntity entObj1, pnt1, "选择图元:"<BR> Dim det1 As String<BR> entObj1 = myblock<BR> det1 = axEnt2lspEnt(entObj1)</P>
<P> Dim Pnt2 As Variant<BR> Dim entObj2 As AcadEntity<BR> ' ThisDrawing.Utility.GetEntity entObj2, Pnt2, "选择被剪图元:"<BR> Dim det2 As String<BR> det2 = GetDoubleEntTable(entObj2, InsertPoint)<BR> ThisDrawing.SendCommand "_trim" & vbCr & det1 & vbCr & vbCr & det2 & vbCr & vbCr<BR> ' End If<BR> 'ThisDrawing.Utility.Prompt "插入外部块>>" + strFilePath<BR> '-------------------------------------<BR> '重复插入<BR> '-------------------------------------<BR> If UserForm1.CheckBox1.Value <> 0 Then<BR> rstr = ""<BR> rstr = ThisDrawing.Utility.GetString(2, NL & "是否重复插入{" & strFilePath & "}?:")<BR> If rstr = "" Then GoTo fun<BR> End If<BR> <BR> UserForm1.Show</P>
<P> End Sub</P>
<P>======================================================</P>
<P>插入外部块后。。。直接利用。。trim来删除中间的那部分的线。。点几下的事。。哈哈。。其它的方法目前还没有想到。。</P>
<P> </P> <P></P>
<P>二次开发专门用于。。电气原理图。。自己感觉和其它专业版本。。有的一比。。哈哈。</P>
页:
[1]