Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/23/2021 in all areas

  1. In all honesty didn't see it until i pasted it into notepad++. its a better notepad and you can get a lisp plug in for it. also look into Visual Studio its has even more featurs then notepad++ but can be a bit overwhelming. If your inputting the same customer I suggest use the second code. It will save and remember the last input between drawings. (or (setq JOBN (getenv "4PAN")) (setq JOBN "CUSTOMER")) ;looks for JOBN in registry if not found sets it to Customer (if (= "" (setq a (getstring (strcat "\nENTER JOB NAME [" JOBN "]: ")))) (setq a JOBN) ;if you hit enter it will set a to dia value else override it to what you input ) (setenv "4PAN" JOBN)
    1 point
  2. Guessing you looked at this? The only thing wrong is calling the wrong variable. you have an extra N in the text command. either change that or the ldata to match (COMMAND "TEXT" "J" "R" TXT5 "1.000" "0" JOBNANS) ;needs to be JOBANS Its good practice to use "_non" in front point values (txt5) so if you have snaps on it could jump to something near.
    1 point
  3. 1st use NENTSEL to pick attribute then make a Field string 2nd use the lisp attached to pick cell 3rd put field string into cell pick cell in table.lsp
    1 point
  4. Steven posted 'just' before I was able to post and have made some comments for the first half of your code but its ba-sick-ly what Steven said : some variables are not set , not by the code you posted anyway. Also you should localize your variables and maybe think about some better names for your variables unless you want to become the human Kelvinator (some know what I mean and some probably not haha) (defun Section_print ( / ) (setvar "osmode" 0) ;;; unknown : sc1 (setq sc2 (/ sc1 100)) (setq oo1 (list(- (car set3) (* sc2 1.500)) (- (cadr set3) (* sc2 0.700))) oo2 (list(- (car set3) (* sc2 1.300)) (- (cadr set3) (* sc2 1.380))) oo3 (list(- (car set3) (* sc2 11.90)) (- (cadr set3) (* sc2 0.215))) oo4 (list(- (car set3) (* sc2 11.90)) (- (cadr set3) (* sc2 0.645))) oo5 (list(- (car set3) (* sc2 11.90)) (- (cadr set3) (* sc2 1.075))) oo6 (list(- (car set3) (* sc2 11.90)) (- (cadr set3) (* sc2 1.505))) sca (rtos (* 1 sc1) 2 2) scp (/ 1000 sc1) ) (Command "style" "mntn" "microsoft Yi Baiti" "2" "1" "0" "n" "n") ;;; unknown tbn (command "insert" tbn set3 sc2 sc2 0) (command "mtext" oo1 "j" "mc" "h" (* sc2 0.120) "r" 0 "w" (* sc2 4) cro "") (command "mtext" oo2 "j" "ml" "h" (* sc2 0.120) "r" 0 "w" (* sc2 4) sca "") (command "mtext" oo3 "j" "ml" "h" (* sc2 0.120) "r" 0 "w" (* sc2 6) des "") (command "mtext" oo4 "j" "ml" "h" (* sc2 0.120) "r" 0 "w" (* sc2 4) dat "") (command "mtext" oo5 "j" "ml" "h" (* sc2 0.120) "r" 0 "w" (* sc2 4) dra "") (command "mtext" oo6 "j" "ml" "h" (* sc2 0.120) "r" 0 "w" (* sc2 4) drb "") ) (defun C:Single_print ;;; localize your variables ( / ch1 chpdf pdfsaveA pdfsaveB pdfsaveC set1 set2 bloh bupc blowc s1 na set4 set5 set6 set3 xx3 xx4 ;;; other variabbles that could be localized here / are missing in action pdfsave sett incrs bh sc1 sc2 pdf_pri ptde scp ) ;;; *** chpdf not needed if you use getint instead of getreal? ;;; *** (setq ch1 (getint "\nWhat ch.? : ") pdfsaveA (itoa ch1)) (setq ch1 (getreal "What ch ..")) (setq chpdf (fix ch1)) (setq pdfsaveA (itoa chpdf)) (setq pdfsaveB (strcat "CH " pdfsaveA)) ;;; unknown : pdfsave (setq pdfsaveC (strcat pdfsave pdfsaveB)) ;;; unknown : sett , incrs , bh (setq set1 (/ sett incrs) set2 (* set1 ch1) bloh (* bh -8) bupc (- 0.25 bh) blowc (- (+ 0.25 bh))) (setvar "osmode" 0) (command "zoom" "c" (list set2 0) 300) ;;; *** if nothing is selected ssget will be nil so test for this with IF or some like to use it in AND statement (if (setq s1 (ssget "w" (list (- set2 200) bupc) (list (+ set2 200) blowc))) (progn (setq na (entget (ssname s1 0))) (setq set4 (cdr (assoc 10 na))) (setq set5 (cdr (assoc 11 na))) (setq set6 (/ (+ (car set5) (car set4)) 2)) (setq set3 (list set6 bloh)) ) ) ;;; section_print uses sc1 , where is this set? (Section_print) ;;; sc2 is set in section_print so make sure its not localized in section_print (setq xx3 (list(+ (car set3) (* sc2 13.76)) (- (cadr set3) (* sc2 2.51))) xx4 (list(- (car set3) (* sc2 13.76)) (+ (cadr set3) (* sc2 16.310))) xx5 (list(- (car set3) (* sc2 13.76)) (+ (cadr set3) (* sc2 0.1))) ) ; (command "zoom" "p") ;;; *** unknowns : pdf_pri , ptde , scp (if (= pdf_pri 1) (command "plot" "y" "" ptde "ISO expand A4 (297.00 x 210.00 MM)" "m" "l" "" "w" xx3 xx4 scp "c" "y" "" "y" "" pdfsaveC "n" "y") (command "plot" "y" "" ptde "A4 (210 x 297 MM)" "M" "L" "" "w" xx3 xx4 scp "0,0" "" "" "" "" "" "" "") ) (command "erase" "C" xx3 xx5 "") ;;; (command "plot" "w" xx3 xx4 "5" "n" "n" "m" "0,0" "90" "n" "n" scp "0") )
    1 point
  5. Danellis, At this point I'm of same mind. I'll make the attributes an mtext style and keep the block malleable to change on the fly. We do road, site civil and survey projects on the regular so the amount of borders I maintain is sizeable. Thank you all for your input and explanations into this subject. Should anyone else have their two cents to add, I'm all ears.
    1 point
  6. I've used a global variable for this scenario for a long time. All of my global variables use the prefix gv_ (defun get_dia (/ d) (or gv_dia (setq gv_dia 2.)) (initget 5) (setq d (getdist (strcat "\nDiameter <" (rtos gv_dia 2 2) ">: "))) (or d (setq d gv_dia)) (setq gv_dia d) d) The gv_ is global only in the current session. It can be used with with numerous inputs and or rules. HTH -David
    1 point
  7. the simplest is to use ldata it ill persists in the drawing if you save it. (defun C:CIR (/ a dia pt1) (setq dia (vlax-ldata-get "cir" "dia")) ;checks for ldata and sets the variable (if (= dia nil) (setq dia "4")) ;first time running it will default to this value (if (= "" (setq a (getstring (strcat "\nIngresa Dia [" dia "]: ")))) (setq a dia) ;if you hit enter it will set a to dia value else override it to what you input ) (setq pt1 (getpoint "\nSeleciona centro: ")) (vl-cmdf "_.Circle" pt1 "D" a) (vlax-ldata-put "cir" "dia" a) ;save variable to ldata persists in drawing when saved. (princ) );defun You can also save the variable into the Registry so it will remember between drawings. might need admin access to save variable IDK (defun C:CIR (/ a dia pt1) (or (setq dia (getenv "CirDia")) (setq dia "4")) ;looks for CirData in registry if not found sets it to 4 (if (= "" (setq a (getstring (strcat "\nIngresa Dia [" dia "]: ")))) (setq a dia) ;if you hit enter it will set a to dia value else override it to what you input ) (setq pt1 (getpoint "\nSeleciona centro: ")) (vl-cmdf "_.Circle" pt1 "D" a) (setenv "CirDia" a) ; saves update value dia value to registry (princ) )
    1 point
  8. Is it a reactor that needs removing? Try (vlr-remove-all)? https://documentation.help/AutoLISP-Functions/WS1a9193826455f5ff1a32d8d10ebc6b7ccc-677b.htm Otherwise rrbI:DeleteAllXRecs may be an option to delete an xrecord, I originally found in: https://www.theswamp.org/index.php?topic=7560.msg95561#msg95561
    1 point
×
×
  • Create New...