safe arrays in com automation

safe arrays in com automation

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

sabounds%lbound=0

sabounds%extent=2

pstartpointSA= safearraycreate(vt_r8,nDimCON,saBounds)

pendpointSA= safearraycreate(vt_r8,nDimCON,saBounds)

bcoordinate=0.0

do icol=0,2

IRET=safearrayputelement(pStartPointSA,0,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)

.......

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

oh, i made a mistake, in this line:

sabounds%extent=2

i mean

sabounds%extent=3

kooka:

do icol=0,2
IRET=safearrayputelement(pStartPointSA,0,loc(bcoordinate))
end do

In the loop should the ",0,loc" be ",icol,loc" ?

Les

Les_Neilson:
kooka:

do icol=0,2
IRET=safearrayputelement(pStartPointSA,0,loc(bcoordinate))
end do

In the loop should the ",0,loc" be ",icol,loc" ?

Les

yes, another transcription error, the original code was

do icol=0,2
IRET=safearrayputelement(pStartPointSA,icol,loc(bcoordinate))
end do

I sould pos again, sorry

Leave a Comment

Please sign in to add a comment. Not a member? Join today