Jump to content

Recommended Posts

Posted

I am currently writing a program to calculate the weight of a material.

I am having it use the area command. I don't know how to get that information after I run the command. I have it set up to prompt for points just like the area command. So, you choose your points and lets say the area command would normally return with Area = 9.000, Perimeter = 12.000. How can I use that information after I run the command in my program?

Basically:

(command "area" p1 p2 p3 p4 p1 "")

 

Then I am multiplying the area by the thickness and then multiplying by .2835.

I need to pull the area info so I can complete my formula (area * thickness * .2835)

 

Also, Can I run the area command and let it get the user points like normal and then go back to my formula in the program? I am kinda new to this so im not sure.

thanks

Posted

im sorry figured it out. (getvar "area") ... so simple... why could I have typed that an hour ago :(

Posted
(command "area")
(while (= (logand (getvar "cmdactive") 1) 1)
                 (command pause)
               )
(apply '* (list (getvar 'area) thickness 0.2835))

Posted

thanks, I couldn't get that exactly to work, but got this:

(defun C:lbs (/ wgt thk)
 (command "area")
 (while (= (logand (getvar "cmdactive") 1) 1)
                 (command pause)
               )
 (setq thk (getreal "\nEnter thickness: ")
       wgt (* (* thk (getvar "area")) 0.2835)
   )
 (prin1 wgt)
 (princ)
 )

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...