Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

AutoLISP & MASSPROP command

501 views
Skip to first unread message

Joseph Brabet

unread,
Apr 2, 1998, 3:00:00 AM4/2/98
to

Does anyone know how to make use of the MASSPROP command with AutoLISP in
Release 14? I have an AutoLISP program I wrote in Release 12 that used
SOLMASSP (the earlier version of the command now called MASSPROP) to
return a list of mass properties data which I stored in a variable. I was
then able to extract the information about the location of the centroid
(center of gravity) from this list.

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

claudia.kofler

unread,
Apr 2, 1998, 3:00:00 AM4/2/98
to

(setvar "QAFLAGS" 2) -> no enter prompt

http://xarch.tu-graz.ac.at/autocad/news/annoying_problems.03

McManamy

unread,
Apr 2, 1998, 3:00:00 AM4/2/98
to

Here's the rotinue that I use to do this. Yes you do have to hit the return
for the program to continue when it goes to the text window. I don't know what
these programmers are smoking but the idea behing using the massprop command is
typically because you want to use this information for calculations or to add
the weights in a bill of materials. Let me know if you need any assistance
understanding this.

(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


hoangvu

unread,
Apr 6, 1998, 3:00:00 AM4/6/98
to McManamy

Hi Fellows:

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!

0 new messages