See the top rated post in this thread. Click here

Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24

Thread: AutoLISP routine to calculate the total weight of steel

  1. #11
    Certifiable AUGI Addict Robert.Hall's Avatar
    Join Date
    2004-07
    Location
    Detroit Michigan
    Posts
    2,508
    0 Did you find this post helpful? Yes

    Talking Re: AutoLISP routine to calculate the total weight of steel

    That is awesome, me likey, me likey....one last quick favor, can you make the output
    be in KG. Your a lifesaver, I do this calculation daily.

  2. #12
    Administrator RobertB's Avatar
    Join Date
    2001-08
    Location
    Dallas TX USA
    Posts
    5,846
    0 Did you find this post helpful? Yes

    Default Re: AutoLISP routine to calculate the total weight of steel

    Quote Originally Posted by rhall.72202
    That is awesome, me likey, me likey....one last quick favor, can you make the output
    be in KG. Your a lifesaver, I do this calculation daily.
    I have modified the code. Just download the attachment in this post again.

  3. #13
    Certifiable AUGI Addict Robert.Hall's Avatar
    Join Date
    2004-07
    Location
    Detroit Michigan
    Posts
    2,508
    0 Did you find this post helpful? Yes

    Default Re: AutoLISP routine to calculate the total weight of steel

    I have the command line autohide. Is there a way to display an autocad
    text window at the end of this routine? I have to keep checking the
    command line after running the routine.

  4. #14
    I could stop if I wanted to
    Join Date
    2006-07
    Posts
    233
    0 Did you find this post helpful? Yes

    Default Re: AutoLISP routine to calculate the total weight of steel

    At the end of the lisp routine there is a section of code that looks like this
    Code:
            (prompt                                                                ; return calculated weight
             (strcat "Weight (for "
                     inpMat
                     "; density "
                     (rtos usedDensity 2 4)
                     ") is estimated to be:\n"
                     (rtos (getvar "UserR2") 2 4)
                     " pounds, "
                     (rtos (getvar "UserR3") 2 4)
                     " kilograms.\n"))))
     (princ))
    If you change where it says prompt to alert then this will display an autocad message box with the weight calculations. Code should look like below for autocad message box to display.

    Code:
            (alert                                                                 ; return calculated weight
             (strcat "Weight (for "
                     inpMat
                     "; density "
                     (rtos usedDensity 2 4)
                     ") is estimated to be:\n"
                     (rtos (getvar "UserR2") 2 4)
                     " pounds, "
                     (rtos (getvar "UserR3") 2 4)
                     " kilograms.\n"))))
     (princ))

  5. #15
    Certifiable AUGI Addict Robert.Hall's Avatar
    Join Date
    2004-07
    Location
    Detroit Michigan
    Posts
    2,508
    0 Did you find this post helpful? Yes

    Default Re: AutoLISP routine to calculate the total weight of steel

    Quote Originally Posted by Lions60
    At the end of the lisp routine there is a section of code that looks like this
    Code:
            (prompt                                                                ; return calculated weight
             (strcat "Weight (for "
                     inpMat
                     "; density "
                     (rtos usedDensity 2 4)
                     ") is estimated to be:\n"
                     (rtos (getvar "UserR2") 2 4)
                     " pounds, "
                     (rtos (getvar "UserR3") 2 4)
                     " kilograms.\n"))))
     (princ))
    If you change where it says prompt to alert then this will display an autocad message box with the weight calculations. Code should look like below for autocad message box to display.

    Code:
            (alert                                                                 ; return calculated weight
             (strcat "Weight (for "
                     inpMat
                     "; density "
                     (rtos usedDensity 2 4)
                     ") is estimated to be:\n"
                     (rtos (getvar "UserR2") 2 4)
                     " pounds, "
                     (rtos (getvar "UserR3") 2 4)
                     " kilograms.\n"))))
     (princ))
    That works, however, if I click ok, then it is gone. I would have to run the routine
    again. It is still nice to scroll back through the command line if I want to look
    up the numbers again. Is there a way to invoke the Autocad command window?

    What about

    Code:
    (while (> (getvar "CMDACTIVE") 0)
    	(command pause)
    )
    Could this be used somehow? I am not sure what to do here.
    Last edited by Robert.Hall; 2007-06-22 at 05:53 PM.

  6. #16
    100 Club
    Join Date
    2006-11
    Location
    UTAH
    Posts
    135
    0 Did you find this post helpful? Yes

    Default Re: AutoLISP routine to calculate the total weight of steel

    Change the (alert) back to (prompt) and add this code to the end of your routine...

    Code:
    (command "_.textscr")
    That will bring up the text screen when the routine finishes.

    Edit: Misunderstood the request... Changed from command line to text screen coming up...
    Last edited by Mike_R; 2007-06-25 at 07:57 PM.

  7. #17
    Certifiable AUGI Addict Robert.Hall's Avatar
    Join Date
    2004-07
    Location
    Detroit Michigan
    Posts
    2,508
    0 Did you find this post helpful? Yes

    Default Re: AutoLISP routine to calculate the total weight of steel

    Thanks. That works out nicely. I will have to remember that for some of my other routines.

  8. #18
    I could stop if I wanted to
    Join Date
    2002-02
    Location
    Kansas
    Posts
    485
    0 Did you find this post helpful? Yes

    Default Re: AutoLISP routine to calculate the total weight of steel

    Code:
    ;;John W. Anstaett 06/28/2007
    ;;Tested in ADT 2007 should work in other rev.
    ;; this list add 3 commands to Autocad
    ;;command Setth
    ;; set the Theckness
    ;;command Startarea
    ;; start the Weight program
    ;; it display the weight and theckness on the status line
    ;; using the last area command you use
    ;; and change each time you do a area command
    ;;command endarea
    ;; set the status line back to the way it was
     
     
    (vl-load-com)
    ;;this should be the first line in all program that use ActiveX
    ;;This function loads the extended AutoLISP functions
    ;;provided with Visual LISP. The Visual LISP extensions implement
    ;;ActiveX and AutoCAD reactor support through AutoLISP, and also
    ;;provide ActiveX utility and data conversion functions,
    ;;dictionary handling functions, and curve measurement functions.
     
     
    (DEFUN C:SETTH()
    (setvar "userr1" (distof (INPUTBOX "Enter Stell Thickness mm" "John W. Anstaett InputBox")))
    )
    (defun c:StartArea()
    (setq SaveModemacro (getvar "mademacro"))
    (setvar "MODEMACRO" "$(*,$(/,$(getvar,area), $(getvar,userr1)) , 0.2833):th=$(getvar,userr1)")
    )
    (defun c:EndArea()
    (if modemacro
    (setvar "modemacro" saveModemacro)
    (setvar "modemacro" "")
    )
    )
    ;;Functuion inputbox
    ;;input
    ;; myprompt is the text for the prompt
    ;; mytitle is the text for the title
    ;; system variable users1 is used for the default input
    ;; return the text enter in the box
    ;; and system variable users1 is set then the same 
    (defun inputbox (myprompt mytitle / myapp)
    (setq myapp (vlax-get-acad-object))
    (vla-eval myapp "myappz = ThisDrawing.GetVariable( \"users1\")")
    (vla-eval myapp (strcat "myappy = inputbox(\"" myprompt "\",\"" mytitle "\", myappz)"))
    (vla-eval myapp "ThisDrawing.SetVariable \"users1\", myappy")
    (getvar "users1")
    )
    Note Some time you need to click to get the status line to up date
    Last edited by jwanstaett; 2007-06-28 at 07:03 PM.
    Note:
    update to 2011
    I am using ADT 2007 08/06/2008

    PS. If you use any Code I post or Down Load Attachment I would like to know if it was helpful. So please post reply to this thread, on how you use the code or down load. Thank You

  9. #19
    Member
    Join Date
    2007-10
    Location
    Arlington, TX
    Posts
    20
    0 Did you find this post helpful? Yes

    Default Re: AutoLISP routine to calculate the total weight of steel

    Hello, I am needing something very similar to this. I copied and pasted into my lsp file and it won't run the command. I need it to calculate steel weight, using inches and pounds. Any help will be greatly appreciated. I am very low level in programming so something simple to your eye I may not be able to catch. When i load the lisp file i get:
    Command: ; error: no function definition: POUNDS

    Thanks.

  10. #20
    I could stop if I wanted to
    Join Date
    2002-02
    Location
    Kansas
    Posts
    485
    0 Did you find this post helpful? Yes

    Default Re: AutoLISP routine to calculate the total weight of steel

    Witch code did you copy and pasted.


    If the error come up when you are loading the lisp file the you did not copy and pasted the code right.Try to save the file and load it, no need to copy and past. You my be missing a ( ) or " in the code you copped.



    If it was my code to display the weight and theckness on the status line.
    The command is Startarea. Then you need to do a area command.
    Use the command Setth to set the Theckness
    Use the command endarea to set the status line back to the way it was.

    If it was the CalcWt.lsp by Written by: R. Robert Bell the command is CalcWt.
    Last edited by jwanstaett; 2012-07-17 at 01:29 PM.
    Note:
    update to 2011
    I am using ADT 2007 08/06/2008

    PS. If you use any Code I post or Down Load Attachment I would like to know if it was helpful. So please post reply to this thread, on how you use the code or down load. Thank You

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. calculate the total length of a group of polylines
    By eebryant in forum AutoCAD Map 3D - General
    Replies: 3
    Last Post: 2008-10-20, 06:36 PM
  2. Calculate weight
    By Ed Jobe in forum ACA General
    Replies: 16
    Last Post: 2008-04-14, 02:16 PM
  3. Calculate Steel Weight
    By nick.beaven in forum Revit Structure - Wish List
    Replies: 0
    Last Post: 2007-12-17, 01:56 PM
  4. total building weight
    By Steve Jager in forum Revit Structure - General
    Replies: 1
    Last Post: 2006-11-01, 04:46 AM
  5. Total building weight
    By Steve Jager in forum Revit Architecture - General
    Replies: 1
    Last Post: 2006-10-31, 02:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •