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