PDA

View Full Version : Autocad version variable in a lisp?


gilsoto13
2009-08-05, 03:45 PM
Hi, This is a question. But if someone solves it, it will be an answer.

I have 3 different autocad versions for 30 people, autocad 2008, 2009 and 2010, and I configured the pdf printer for each version to fit our standards, but since every version has its own autodesk pdf printer version, I had to make 3 different abbreviations and 3 different .pc3 files, and I instructed everyone to use their own abbreviation.

Now I want to see If a can make it easier, that with just one abbreviation I can merge all 3 functions in a lisp to make autocad decide which pc3 file to use according to current autocad version. i know that this option is to let autocad decide for an option,

(if
(progn

but I don't know if it's possible for autocad to recognize its own version taking it from a system variable or some way.

irneb
2009-08-05, 04:50 PM
Check the system var called ACADVER ... it's a text string with the start of it as the "real" acad version number. E.g:

2004 = 16.0
2005 = 16.1
2006 = 16.2
2007 = 17.0
2008 = 17.1To get this you could use (setq version (atof (getvar "ACADVER")))

RobertB
2009-08-05, 04:51 PM
It is easy:

(cond
((= (atof (getvar 'AcadVer)) 18.0) ;| 2010 code here |;)
((= (atof (getvar 'AcadVer)) 17.2) ;| 2009 code here |;)
((= (atof (getvar 'AcadVer)) 17.1) ;| 2008 code here |;)
(T (alert "Unknown version of AutoCAD detected.")))

gilsoto13
2009-08-06, 09:52 PM
It is easy:

(cond
((= (atof (getvar 'AcadVer)) 18.0) ;| 2010 code here |;)
((= (atof (getvar 'AcadVer)) 17.2) ;| 2009 code here |;)
((= (atof (getvar 'AcadVer)) 17.1) ;| 2008 code here |;)
(T (alert "Unknown version of AutoCAD detected.")))


Excellent.... I did it and worked perfect.

This lisp will print automatically a pdf using the same abbreviation from any 2008, 2009, 2010 autocad version and using also a pc3 printing configuration file (which is using also a printing parameters PMP file, not included in the lisp, though) both pc3 and pmp files are to be in the printer configuration search path