safearray in com automation error

safearray in com automation error

Hi, im a newby in this topic of com automation, im trying to make a draw in Autocad via a third program. I'm able to connect with autocad and also draw a line, the point is thati don't draw the line iwant. I need two 3d real*8 points ie. p1=(/0.0,0.0,0.0/), p2= (/100.100,0.0,0.0/)representing the start and end of a line. I make that pionts via safearraycreate. But when i send the command to autocad, i only can create a supersmall line, of distance=0. I think the points are not being well created in safearray but i dont know how to view the array values because is a pointer, Do anybody knows?.

Thanks!!!

This is the code

......

ndimcon=1

sabounds%lbound=0

sabounds%extent=3

pstartpointSA= safearraycreate(vt_r8,nDimCON,saBounds)

pendpointSA= safearraycreate(vt_r8,nDimCON,saBounds)

bcoordinate=0.0

do icol=0,2

IRET=safearrayputelement(pStartPointSA,icol,loc(bcoordinate))

end do

bcoordinate=100.0

IRET=safearrayputelement(pEndPointSA,0,loc(bcoordinate))

bcoordinate=100.0

IRET=safearrayputelement(pEndPointSA,1,loc(bcoordinate))

bcoordinate=0.0

IRET=safearrayputelement(pEndPointSA,2,loc(bcoordinate))

! 5 indidcates real*8 nubers for autocad internal conversion to variant types

istatus= $iacadUtility_createtypedarray(putil,startpoint,5,pstartpointSA)

istatus= $iacadUtility_createtypedarray(putil,endpoint,5,pendpointSA)

istatus= $iacadblock_addline(pMspace, Startpoint,endpoint, pline)

iret=safearraydestroy(pstartpointSA)

iret=safearraydestroy(pendpointSA)

.......

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.