Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

what'S wrong with this lisp to import excel x y to cad

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
syria89
710 Views, 2 Replies

what'S wrong with this lisp to import excel x y to cad

i attached a lsp with and excel

the lsp does creat circles with diameter of 5 related to imported points from excel

i realsed that it is able to get the first column but can get the coordinate from the second one

                (setq posX (atof (substr line 1 nPos)))  (this is ok)
                (setq posY (atof (substr line (1+ nPos)))) (not this one)

 

2 REPLIES 2
Message 2 of 3
Kent1Cooper
in reply to: syria89


@syria89 wrote:

....

the lsp does creat circles with diameter of 5 related to imported points from excel

i realsed that it is able to get the first column but can get the coordinate from the second one

                (setq posX (atof (substr line 1 nPos)))  (this is ok)
                (setq posY (atof (substr line (1+ nPos)))) (not this one)

 


Given this line [the first one]:
 

288390.6;5052934

 

and that nPos has been set by this:

 

(setq nPos (vl-string-position (ascii ";") line))

 

then nPos will be 8, and posX will be 288390.6.  But you want posY to be read starting at the tenth position, not the ninth, because (substr) counts the first character as 1, whereas (vl-string-position counts it as 0.  Try:
 

                (setq posY (atof (substr line (+ nPos 2))))

Kent Cooper, AIA
Message 3 of 3
syria89
in reply to: Kent1Cooper

A BIG THANKS

Robot Happy

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost