Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/14/2023 in all areas

  1. Might be nice to give credit where credit is due and a link to the original post for others to follow.... BigAl, I tend to use it as a memory aid when I forget the shortcut commands though more often than not use the 'view code' button to modify a LISP in the library - that opens the LISP n notepad
    2 points
  2. I've took some of my free time to make it prettier (I mean code), and BTW. I don't understand last (vl-remove-if (function (lambda ( z ) (z) ...)) lst), so I removed that (z) ... ;; % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ;; % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ;; ;; ROMAN NUMERAL CONVERTERS ;; ;; ALL credit and source material belongs to the following source: ;; Commandobill ;; https://www.cadtutor.net/forum/topic/11354-roman-numeral-converter/ ;; ;; Alterations made from original author and source material are as follows: ;; - Renamed vast majority most function and symbol names from original source due to OCD and personal practice to ;; digest source material. ;; - Patched the -ROMANNUMERAL function (rn function in original source) to handle zeros when input integer is ;; greater than a value of nine (9) and contains zeros, e.g. 108 and 1008. ;; ;; % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ;; % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % (defun c:ROMANNUMERALCONVERTER ( / intgen strgen ) (if (> (setq intgen (atoi (setq strgen (getstring "\n Enter number between 1 (I) and 3999 (MMMCMXCIX): ")))) 0) (-ROMANNUMERAL intgen) (-ROMANNUMERALREVERSE strgen) ) ) (defun -ROMANNUMERALREVERSE ( strgen / lenstr output par romnum ) (setq lenstr (strlen (setq strgen (strcase strgen))) output 0 romnum '( ("MMM" . 3000) ("MM" . 2000) ("M" . 1000) ("CM" . 900) ("DCCC" . 800) ("DCC" . 700) ("DC" . 600) ("D" . 500) ("CD" . 400) ("CCC" . 300) ("CC" . 200) ("C" . 100) ("XC" . 90) ("LXXX" . 80) ("LXX" . 70) ("LX" . 60) ("L" . 50) ("XL" . 40) ("XXX" . 30) ("XX" . 20) ("X" . 10) ("IX" . 9) ("VIII" . 8) ("VII" . 7) ("VI" . 6) ("V" . 5) ("IV" . 4) ("III" . 3) ("II" . 2) ("I" . 1) ) ) (while (and (> lenstr 0) (cdr (assoc (substr strgen 1 1) romnum)) ) (cond ( (setq par (cdr (assoc (substr strgen 1 4) romnum))) (setq strgen (substr strgen 5)) ) ( (setq par (cdr (assoc (substr strgen 1 3) romnum))) (setq strgen (substr strgen 4)) ) ( (setq par (cdr (assoc (substr strgen 1 2) romnum))) (setq strgen (substr strgen 3)) ) ( (setq par (cdr (assoc (substr strgen 1 1) romnum))) (setq strgen (substr strgen 2)) ) ) (setq romnum (-CUTLST romnum par) lenstr (strlen strgen) output (+ output par) ) ) (if (= lenstr 0) (princ output) (princ "Invalid format") ) (princ) ) (defun -ROMANNUMERAL ( intgen / intstr numlst output lenstr ) (setq lenstr (strlen (setq intstr (itoa intgen))) numlst (list "1" "2" "3" "4" "5" "6" "7" "8" "9") output "" ) (if (and (> intgen 0) (< intgen 4000)) (progn (while (> lenstr 0) (cond ( (= lenstr 4) (setq output (strcat output (nth (vl-position (substr intstr 1 1) numlst) (list "M" "MM" "MMM")))) (setq lenstr 3) ) ( (= lenstr 3) (setq output (strcat output (nth (vl-position (substr intstr 1 1) numlst) (list "C" "CC" "CCC" "CD" "D" "DC" "DCC" "DCCC" "CM")))) (setq lenstr 2) ) ( (= lenstr 2) (setq output (strcat output (nth (vl-position (substr intstr 1 1) numlst) (list "X" "XX" "XXX" "XL" "L" "LX" "LXX" "LXXX" "XC")))) (setq lenstr 1) ) ( (= lenstr 1) (setq output (strcat output (nth (vl-position (substr intstr 1 1) numlst) (list "I" "II" "III" "IV" "V" "VI" "VII" "VIII" "IX")))) (setq lenstr 0) ) ) (setq intstr (substr intstr 2)) ;; % % % % % % % % % % % % % % % % % % % % % % % % % % % % ;; % % % % % % % % % % % % % % % % % % % % % % % % % % % % ;; START PATCH - alteration to original source material (if (= (substr intstr 1 1) "0") (while (and (> lenstr 0) (= (substr intstr 1 1) "0")) (setq intstr (substr intstr 2) lenstr (- lenstr 1) ) ) ) ;; END PATCH - alteration to original source material ;; % % % % % % % % % % % % % % % % % % % % % % % % % % % % ;; % % % % % % % % % % % % % % % % % % % % % % % % % % % % ) (princ output) ) (princ "Number Invalid") ) (princ) ) (defun -CUTLST ( lst num ) (cond ( (> num 900) (setq num 1000) ) ( (> num 90) (setq num 100 ) ) ( (> num 9) (setq num 10 ) ) ) (setq lst (vl-remove-if (function (lambda ( z ) (>= (cdr z) num) )) lst ) ) )
    1 point
  3. Is the model very small or is it far away from the X0,Y0,Z0 origin?
    1 point
  4. I'm already refillingl link to the original post: RunLispHelp
    1 point
  5. Not quite what you are wanting, this is a DCL (dialogue box) LISP based menu: If you look in the top LISP in the file there is the filepaths to modify where you store your LISPs, the code runs with LH Added to the end of each of my LISPs is a small section of text with a description of the LISP - looking through the attached will give you the format I use. I did it DCL way so that I could get these descriptions. It isn't perfe4ct and some parts might not work as it is If you pick it to pieces you should find the part that grabs all the LISP names (defined by "Defun C:" ) to make the LISP - start by looking at the main DCL box, and work from the list of LISPs - should get the code you need LISPSHELP - Copy.lsp
    1 point
×
×
  • Create New...