MASSPROP is now a normal command which cannot be invoked directly from
AutoLISP, unlike SOLMASSP. The only way to use it is via the (command)
function within AutoLISP. Unfortunately, the (command) function only
returns NIL, not a list of the mass properties. To get around this, I was
planning to make use of the option of the MASSPROP command that allows the
information gained by the command to be written to a text file on disk. I
then hoped to use the (read-line) function to extract the relevant
Centroid data from that file. The MASSPROP command has prevented me from
doing even this, because it flips automatically to the text screen. It
returns more than a single screenful of information, requiring the user
to press RETURN to continue. For some reason this interrupts the operation
of the (command) function, which is not able to send a RETURN to the text
screen. Does anyone know how to solve that problem? It's a thorny one...
--
Joseph Brabet, B. Arch (hons)
Tel: +61 414 377 438
Multimedia Designer/Programmer
http://xarch.tu-graz.ac.at/autocad/news/annoying_problems.03
(defun C:MASSRPT (/)
(setq old_tilemode (getvar "tilemode"))
(command ".tilemode" 1)
(if (= mprdensity nil)
(setq mprdensity 1)
)
;;(if (= rptname nil) (setq rptname "massreport"))
(setq rptname (strcat (getvar "dwgprefix") (getvar "dwgname")))
(command ".massprop" "all" "" "Y" rptname)
(setq mprfile (strcat rptname ".mpr"))
(setq file (open mprfile "r"))
(setq mpr (read-line file)
mpr (read-line file)
mpr (read-line file)
mprmass (* mprdensity (atof (substr (read-line file) 26)))
mprvolume (atof (substr (read-line file) 26))
mpr (read-line file)
mpr (read-line file)
mpr (read-line file)
mprX (atof (substr (read-line file) 26))
mprY (atof (substr (read-line file) 26))
mprZ (atof (substr (read-line file) 26))
mprIX (atof (substr (read-line file) 26))
mprIY (atof (substr (read-line file) 26))
mprIZ (atof (substr (read-line file) 26))
mprIXY (atof (substr (read-line file) 26))
mprIYZ (atof (substr (read-line file) 26))
mprIZX (atof (substr (read-line file) 26))
mprRX (atof (substr (read-line file) 26))
mprRY (atof (substr (read-line file) 26))
mprRZ (atof (substr (read-line file) 26))
)
(close file)
(setq pt1 (list mprX mprY mprZ))
(command ".point" pt1)
(princ)
(setvar "tilemode" old_tilemode)
(princ)
)
Rodney McManamy
mcma...@aol.com
We are looking for an experienced AutoLISP programmer for a project in
Los Angeles or Orange County, California. Do you know anyone?
Also, is there a AutoCAD/AutoLISP user group in these counties?
Thank you very much for your help!