• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

vlisp - take values from excel files if they contain formulas

  • Thread starter Thread starter Dr.Lube
  • Start date Start date

Dr.Lube

Guest
Hello.
I made a small program that assigns to x and y the coordinates of a point that I would then insert in cad.
being the point derived from a processing (there is a hole in that cell), cannot take the value. How can I do that?
Code:
(defun c:pin (/ x y xy)
(vl-load-com)
(setq xl (vlax-get-or-create-object "excel.application"))
(setq x 10) ;mi serve solo for il debug
(setq y 5) ;idem

(getexcel "c:\\users\\studio 3\\cobiax\\xls\\inerzia.xls" "inerzia" nil)

(setq x (getcell "k6") ; problem: in questa cella ho una formula e non trova quindi il valore
(setq y (getcell "l6") ;problem: in questa cella ho una formula e non trova quindi il valore
(setq xy (list x y))

(command "point" xy \r)
(princ)
)

grazie, dennis
 
I could solve by doing a macro on excel that copies the values of those cells in two other important ones. Is that the only way?
 
Okay, I realized that's not the problem. still exports the value even if there is a formula. .

the problem is that it does not matter all the document but only the first 8 columns.
(getexcel "c:\\users\\studio 3\\cobiax\\xls\\inerzia.xls" "inerzia" nil)
(("1" "10" "0.13653246" "0.00853317" "x" "0.13653246" "0.0853317" "5") etc
ergo is wrong the syntax of the getexcel

edit: correction
Code:
(getexcel "c:\\users\\studio 3\\cobiax\\xls\\inerzia.xls" "inerzia" "s35")
import up to cell s35;)
 
I have a problem, I can't put the point.
Code:
_$ (setq xy (list x y))
(10 20)
_$ (setq x (getcell "k6")
1185681175
_$ (setq y (getcell "l6")
"11.09372276"
_$ (setq xy (list x y))
("11.85681175" 11.09372276")
Perhaps the error is the structure of xy as a list. .
Code:
(command "punto" xy \r)
Is that right?
 
solved!
Code:
(defun c:pin (/ x y xy)
(vl-load-com)

(setq xl (vlax-get-or-create-object "excel.application"))
(setq z 0)

(getexcel "c:\\users\\studio 3\\cobiax\\xls\\inerzia.xls" "inerzia" "l6")

(setq x (atof (getcell "k6")))
(setq y (atof (getcell "l6")))
(setq xy (list x y z))

(command "point" xy \r)
(princ)
)
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top