Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/24/2025 in all areas

  1. Here's another way - (defun ctoe ( y m d ) (if (not ctoj) (load "julian.lsp" nil)) (if ctoj (- (ctoj y m d 0 0 0) 2415019)) )
    1 point
  2. Thanks everyone for their input. The below code is what I managed to get working. I want to improve this by making the command repeatable in terms of placing the block or clicking something to change the previous selections. is this possible? ;;Takes the user through a two step selection process and then inserts the block on the defined layer based on the two steps. (defun c:LE-ManholeFW () ;initget sets the options for the user to select (initget 1 "Existing Proposed") ;MHCondition is the variable that stores the user's selection regarding the condition of the manhole (setq MHCondition (getkword "\nSelect an option [Existing/Proposed]: " ) ) ;The cond function checks the user's selection and sets the MHC variable accordingly 0 for Existing and 10 for Proposed (cond ((= MHCondition "Existing") (princ "\nYou selected Existing.") (setq MHC 0)) ((= MHCondition "Proposed") (princ "\nYou selected Proposed.") (setq MHC 10)) (t (princ "\nNo valid option selected.")) ) (princ) ;initget sets the options for the user to select the type of manhole ;MHS is the variable that stores the user's selection regarding the type of manhole (initget 1 "Adoptable Private") (setq MHState (getkword "\nSelect an option [Adoptable/Private]: " ) ) ;The cond function checks the user's selection and sets the MHS variable accordingly 1 for Adoptable, 2 for Private, and 3 for Highways (cond ((= MHState "Adoptable") (princ "\nYou selected Adoptable.") (setq MHS 1)) ((= MHState "Private") (princ "\nYou selected Private.") (setq MHS 2)) (t (princ "\nNo valid option selected.")) ) (princ) ;Status is the variable that stores the sum of MHC and MHS to determine the final selection ;Existing Public 1 ;Existing Private 2 ;Existing Highways 3 ;Proposed Public 11 ;Proposed Private 12 ;Proposed Highways 13 ;The cond function checks the value of Status and sets the current layer accordingly ;The setvar function sets the current layer to the specified layer based on the user's selection (setq Status (+ MHC MHS)) (cond ((= Status 1) (princ "\nYou selected Existing Public.") (setvar "clayer""-LE-D-FW-Existing Public Manhole")) ((= Status 2) (princ "\nYou selected Existing Private.") (setvar "clayer""-LE-D-FW-Existing Manhole")) ((= Status 11) (princ "\nYou selected Proposed Public.") (setvar "clayer""-LE-D-FW-Adoptable Manhole")) ((= Status 12) (princ "\nYou selected Proposed Private.") (setvar "clayer""-LE-D-FW-Private Manhole")) (t (princ "\nNo valid option selected.")) ) (princ) ;Inserts Manhole Block (command "_.-INSERT" "Manhole" (getpoint "\nPick the insertion point for the block: ") "1" "" "") )
    1 point
  3. Version 2

    1,952 downloads

    Multiple Radio Buttons Multiple Radio Buttons is a library routine that allows you to create as many Buttons of input as required (subject to Autocad limits) using a dialouge rather than the command line. You can have horizontal or vertical buttons choice is yours Its use is intended where you want the user to pick one only of preset values it can be a number, a character or a whole word. It can be used in most lisp code with just a couple of lines of code, compared to a hard coded solution of around 50+ lines repeated every time you want to use a dcl. To use just save the "Multi Radio Buttons.lsp" to a directory that is included in you Autocad search path. If you need more information how to do this send an email to info@alanh.com.au It only requires 3 lines of code in any lisp to use. (if (not AH:Butts)(load "Multi radio buttons.lsp")) ; loads the program if not loaded already (if (= but nil)(setq but 1)) ; this is needed to set default button for user pick (setq ans (ah:butts but "V" '("A B C D " "A" "B" "C" "D" ))) ; V is for vertical H for horizontal layout In the example above the variable ans will have the button string value. (setq ans (ah:butts but "V" '("Please choose " "Alpha" "Beta" "1" "2" "No words"))) Pick button 5 ans = "No words" The program resets the default button to last pick so click Ok, can be removed if not required. Copy the 3 lines above to your command line to see how it works. There is extra examples in the top of the code how to use in your code. For programmers it is a replacement for the Initget function. If you want further information or conversion of your code email info@alanh.com.au
    1 point
×
×
  • Create New...