Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

safe arrays in com automation

kooka
Beginner
783 Views

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)

.......

0 Kudos
3 Replies
kooka
Beginner
783 Views

oh, i made a mistake, in this line:

sabounds%extent=2

i mean

sabounds%extent=3

0 Kudos
Les_Neilson
Valued Contributor II
783 Views
kooka:

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

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

Les

0 Kudos
kooka
Beginner
783 Views
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

0 Kudos
Reply