[求助]pb开发AUTOCAD中GETBOUNDINGBOX问题
<p>请教下有谁用过PB开发AUTOCAD 的</p><p>我在VB中使用GETBOUNDINGBOX能够得到坐标</p><p>但在PB下总是空值 ,得不到数据,望达人指点一二~</p><p>int oleok<br/>oleobject olecad,olecaddoc<br/>oleobject olemospace,olepaspace</p><p>//连接CAD<br/>olecad=create oleobject<br/>oleok=olecad.connecttoobject("","autocad.application")<br/>if oleok<> 0 then //没打开AUTOCAD<br/> oleok=olecad.ConnectToNewObject("AUTOCAD.Application")<br/> if oleok > 0 then<br/> messagebox("OLE失败","该功能无法使用!"+"~n"+"请先安装autocad。",stopsign!)<br/> end if<br/>end if <br/>olecad.visible=true<br/>olecaddoc = olecad.activedocument<br/>olemospace = olecaddoc.modelspace<br/>olepaspace = olecaddoc.paperspace</p><p></p><p>oleobject elem<br/>decimal{3} x1,y1,x2,y2,xb1,yb1,xb2,yb2//文字的坐标<br/>decimal{3} minext,maxext//边界的坐标<br/>decimal{3} min[],max[]<br/>double li_elem[],minpoint[],maxpoint[]</p><p>integer li_count,i,m,k<br/>string ls_name<br/>any s</p><p>m=1<br/>//li_elem = upperbound(olemospace.elem[])<br/>//for each elem in olemospace<br/>//next elem<br/>//得到边界坐标<br/>minext[] = olecaddoc.getvariable("extmin")<br/>maxext[] = olecaddoc.getvariable("extmax")<br/>xb1=minext<br/>xb2=maxext<br/>yb1=minext<br/>yb2=maxext<br/>//sle_1.text=string(x1)<br/>//messagebox("wr",string(minext)+" "+string(minext))<br/>//messagebox("wr",string(maxext)+" "+string(maxext))<br/>li_count = olemospace.count</p><p>//messagebox("er",string(li_count))</p><p>for i =1 to li_count - 6<br/>//for i =1 to 44<br/>// ls_name =string(olemospace.item(i).EntityName)<br/> elem = olemospace.item(i)<br/> If elem.EntityName = "AcDbBlockReference" Then<br/> <br/> elem.Explode()</p><p> End If<br/> <br/> If elem.EntityName = "AcDbText" Or elem.EntityName = "AcDbMText" Then<br/>//If olemospace.item(i).EntityName = "AcDbText" Then<br/> elem.getboundingbox(min,max) //得到坐标<br/> ls_name = trim(elem.textstring) <br/> if len(ls_name)<50 then</p><p> dw_1.insertrow(1)<br/>// <br/> dw_1.setitem(1, "name", ls_name)<br/> dw_1.setitem(1, "x1",min)<br/>dw_1.setitem(1, "y1", min)<br/> dw_1.setitem(1, "x2", max)<br/> dw_1.setitem(1, "y2", max)<br/> m=m+1 <br/> end if<br/> end if </p><p><br/>next </p>
页:
[1]