laoxie_198 发表于 2008-5-6 20:39:00

[求助]插入文件问题

<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/>&nbsp; 'strPrmt = "Left click to confirm, right click to cancel"<br/>&nbsp; strPrmt = "请选择图形插入位置!"<br/>ii:&nbsp; Set objUtil = ThisDrawing.Utility<br/>&nbsp; varPnt = objUtil.GetPoint(Prompt:=strPrmt)<br/>&nbsp; 'No error? Then they "left clicked" (or typed a point on<br/>&nbsp; 'The command line. Meh. Users are crazy.<br/>&nbsp; ClickConfirm = True<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zjpoint(0) = varPnt(0)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zjpoint(1) = varPnt(1)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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&lt; " &amp; zjpoint(1) &amp; " order by x desc", cn, adOpenDynamic, adLockBatchOptimistic<br/>If Not hct.EOF Then<br/>&nbsp; x = hct.Fields("x")<br/>End If<br/>hct.Close<br/>hct.Open "select * from hct where y&lt; " &amp; zjpoint(0) &amp; " order by y desc", cn, adOpenDynamic, adLockBatchOptimistic<br/>If Not hct.EOF Then<br/>&nbsp; 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" &amp; vbCr &amp; blockname &amp; vbCr &amp; point.Fields("x") &amp; "," &amp; point.Fields("y") &amp; vbCr &amp; ljj.Fields("xs") &amp; vbCr &amp; ljj.Fields("ys") &amp; vbCr &amp; ljj.Fields("zs") &amp; vbCr &amp; ljj.Fields("jd") &amp; vbCr<br/>&nbsp;ThisDrawing.SendCommand "-insert" &amp; vbCr &amp; tfm &amp; vbCr &amp; 0# &amp; vbCr &amp; 1 &amp; vbCr &amp; 1 &amp; vbCr &amp; 0 &amp; vbCr &amp; 0 &amp; vbCr<br/>End Sub</p><p></p>
页: [1]
查看完整版本: [求助]插入文件问题