;Program written by Bill Le Couteur ;Auckland NZ ;Rev 0 date 3.11.09 ;This program works out the mass- ;WITH THE MASS DERIVED FROM ;PICKING A SOLID (defun c:KGS() (setq oldosmode (getvar "osmode")) (IF (EQ (GETVAR "ATTREQ") 0) (PROGN (PRINT "YOU HAVE GOT ATTREQ SET TO 0-SET IT TO 1") (EXIT) );END PROGN );END IF (setvar "osmode" 0) (setvar "attdia" 0) (setvar "filedia" 0) (command "massprop" pause "" "Y" "C:/bilro/mass.mpr") ;;;;now open the file (setq sfile (open "C:/bilro/mass.mpr" "r")) (setq count 5) (while (> count 0)(setq the_volume (read-line sfile)) (progn; (setq count (- count 1)) );end progn );end while (setq howlong (strlen the_volume)) (setq the_actualvolume (substr the_volume 26 howlongdes)) (setq the_actualvolumef (atof the_actualvolume)) (setq the_actualvolumefcm ( / the_actualvolumef 1000000000)) (setq the_mass (* the_actualvolumefcm 7850)) (setq the_masss (rtos the_mass 2 2)) (setq the_masss (strcat the_masss " kg")) (close sfile) (setvar "filedia" 1) (setvar "osmode" oldosmode) (setvar "attdia" 1) (prompt "The mass in kilograms of this steel item is:") (print the_mass) (princ) )