[求助]插入文件问题
<p>我想将某个图形文件按照原坐标插入到当前图形里。如果是让CAD自己搜索插入的话就没问题,如果我将文件的路径给齐的话插入的图形坐标就不正确了是怎么回事呀?请教高手们</p><p>Sub tfcr()<br/>Dim cn As New ADODB.Connection<br/>Dim hct As New ADODB.Recordset<br/>Dim sqllj As String<br/>Dim tfm As String<br/>Dim objUtil As AcadUtility<br/>Dim varPnt As Variant<br/>Dim strPrmt As String<br/>Dim zjpoint(0 To 2) As Double<br/>Dim x As String, y As String<br/>Dim blockobject As AcadBlock<br/>On Error Resume Next<br/> 'strPrmt = "Left click to confirm, right click to cancel"<br/> strPrmt = "请选择图形插入位置!"<br/>ii: Set objUtil = ThisDrawing.Utility<br/> varPnt = objUtil.GetPoint(Prompt:=strPrmt)<br/> 'No error? Then they "left clicked" (or typed a point on<br/> 'The command line. Meh. Users are crazy.<br/> ClickConfirm = True<br/> zjpoint(0) = varPnt(0)<br/> zjpoint(1) = varPnt(1)<br/> zjpoint(2) = varPnt(2)<br/>sqllj = "provider=sqloledb.1;password= ;persist security info=true;user id=sa;initial catalog=wzdjsj ;data source=huangbin"<br/>cn.Open sqllj<br/>hct.Open "select * from hct where x< " & zjpoint(1) & " order by x desc", cn, adOpenDynamic, adLockBatchOptimistic<br/>If Not hct.EOF Then<br/> x = hct.Fields("x")<br/>End If<br/>hct.Close<br/>hct.Open "select * from hct where y< " & zjpoint(0) & " order by y desc", cn, adOpenDynamic, adLockBatchOptimistic<br/>If Not hct.EOF Then<br/> y = hct.Fields("y")<br/>End If<br/>hct.Close<br/>tfm = Left(x, 3) + Left(y, 3)'此时插入的图形坐标就是正确的。</p><p>'tfm="D\航测图\"+Left(x, 3) + Left(y, 3)'此时插入的图形坐标就不正确的。<br/>' ThisDrawing.SendCommand "-insert" & vbCr & blockname & vbCr & point.Fields("x") & "," & point.Fields("y") & vbCr & ljj.Fields("xs") & vbCr & ljj.Fields("ys") & vbCr & ljj.Fields("zs") & vbCr & ljj.Fields("jd") & vbCr<br/> ThisDrawing.SendCommand "-insert" & vbCr & tfm & vbCr & 0# & vbCr & 1 & vbCr & 1 & vbCr & 0 & vbCr & 0 & vbCr<br/>End Sub</p><p></p>
页:
[1]