Jump to content

Leaderboard

Popular Content

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

  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
×
×
  • Create New...