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

calcolo peso

  • Thread starter Thread starter joe
  • Start date Start date

joe

Guest
Could you correct this lisp for me, please?
is used to calculate the weight of elements (drawn in mm) of steel
Thank you.

(defun c:pes ()
(setq val (command "_measuregeom" "v" or "c" pauses"))
(setq num 1000000000)
(setq vn 7850)
(command "_cal" val/num*vn)
(textscr)
(princ)
)
 
if I calculate the volume of a solid with the "misurageom" command, can I store the result in a variable? (setq val...
 
I solved the problem of the calculation of the volume using the massprop command.
I write the data in a file below c: which I call massprop.drm, read the first 5 rows and extract the volume, multiplied by the specific weight the function returns the weight of the solid.

bye
 

Attachments

thank you but you could expose me more clearly because I'm not sure I understand well
 
the massprop command, after selecting the solid, returns several properties of the object, including the volume.
you can save the output in a file, which is what makes the function.
search in c:\ the file that is called massprop.drm and open it with a text editor; Line #5 contains the information we need.
After saving, through the read function of the text files of the lisp, I read the file just written.
I read 5 lines, I delete the first 25 characters, I transform the text extracted into a real variable and the game is done.

bye
 
if you want to write, more precisely add a row to the file without overwriting the content?
 
It is not clear to me what you want to do, also because the creation of the massprop.drm file is autocad and not of the lisp in question.
in any case, to add text to a file you use the function:
(setq fr) (open "c:/massprop.mpr"a")

every time you write in the file:
(write-line txt fr)

add the txt variable content to the end of the file.

Hi.
 

Forum statistics

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

Members online

No members online now.
Back
Top