Jump to content

Leaderboard

Popular Content

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

  1. Sorry my code was wrong. when running for the first time it was setting dia variable to 4 but as an integer. this caused an error in the if statement because it needs to be a string. changed (setq dia 4) to (setq dia "4") so its stored as a string. Also wasn't storing the correct variable in CirDia to have the updated input. (defun C:CIR (/ a dia pt1) (or (setq dia (getenv "CirDia")) (setq dia "4")) (if (= "" (setq a (getstring (strcat "\nIngresa Dia [" dia "]: ")))) (setq a dia) ) (setq pt1 (getpoint "\nSeleciona centro: ")) (vl-cmdf "_.Circle" pt1 "D" a) (setenv "CirDia" a) (princ) ) also WELCOME TO THE FORUMS
    1 point
  2. Another: http://www.lee-mac.com/localising.html
    1 point
  3. variables within parenthesis: ( x / y ) x are for anything passed to the function when it is run typically from another function y are local variables used only for this function. If you don't define y here they become global variables and their value can be used by any function - global variables can mess things up if you aren't careful. Unless you need to, define all variables as local and put them in these parenthesis
    1 point
  4. 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
  5. (defun c:cir(/) (setq dia(getreal (strcat "\nIngresa Dia <" (vl-princ-to-string dia) "> ? : "))) (setq pt1 (getpoint "\nSeleciona centro: ")) (command "_circle" pt1 "d" dia))
    1 point
  6. Try this, (defun c:GetFolder() ;;opens the drawings folder ;; (command "shell" (strcat "explorer \"" (getvar 'dwgprefix) "\"")) (startapp "explorer" (strcat "/e,\"" (vl-string-right-trim "\\" (getvar 'dwgprefix)) "\"")) (princ) ) It's been a while since I made this up but from what I remember it will work either way with the 'shell' line or with the 'startapp' line. Might even work with both and open explorer twice if you leave both lines in. 'Startapp' might be a bit quicker.
    1 point
  7. What part didn't work? Did you manage to remove the unwanted annotation scales? ANNOAUTOSCALE is '0' now, but what was it earlier? Do you have the toggles shown here on your task bar? If so, accidentally hitting the one for ANNOAUTOSCALE will toggle it on and off. Maybe that has happened more than once.
    1 point
  8. Macro I've used for years: ^C^C^P(vla-activate(vla-open (vla-get-documents (vlax-get-acad-object))(findfile(getfiled "Select File" (getvar 'dwgprefix) "dwg" 8)) :vlax-false)) My acaddoc.lsp starts with (vl-load-com) which could be added to the start of the macro if you don't already have it loaded as most visual lisp requires it.
    1 point
  9. It is simple to remove the unwanted scales and to stop it from continuing. Type the command OBJECTSCALE. You will see a prompt to select annotative object(s). After one or more is selected, a dialog box will pop up where you can both delete the unwanted scales and add others at the same time. If you have not changed the value of PICKFIRST to something greater than zero, you can select the objects before executing the command. To stop the scales from being added automatically, set the system variable, ANNOAUTOSCALE to 0 (zero) and watch out for the toggle buttons on the task bar with the Annotate Icon on them. Hitting the wrong one leads to this sort of inconvenience. I think the default is to add them. I don't remember. I threw the switch to OFF in 2007 when I started using annotative objects. I do keep one of the annotative toggles set to on, ANNOALLVISIBLE which shows all annotative objects at all scales in modelspace whether they match the current annotative scale or not. (They don't plot that way) It works for me because I try and keep only one scale assigned to each of my annotation objects which will be the one current in the viewport they go to. You can get to the add/delete annotative dialog box another way. On the Annotate tab of the ribbon at the far right is a selection for it. You can select multiple annotative objects at once to perform this task and fix them all at once. Only select objects which are to be all assigned to the same scale together. There is no provision to have your resulting efforts assigned different single scales at the same time during one execution of the command and dialog box. Basically just select objects that you want to be set to the same scale. Of course you can assign more than one scale to ALL of the selected objects at the same time using OBJECTSCALE, but right now that is not what we are trying to do. There are a couple of serious pitfalls to watch out for when adding or removing scales from multiple annotative objects at once. A serious error happens if you select non-annotative objects along with annotative objects. Apparently the program code does not separate out the non annotative stuff. Up until version 2019 I am sure, AutoCAD crashes abruptly on an unhandled error condition apparently caused by the non-anno things. In version 2021, the error still occurs but the program does not always crash. A crash occurs without ANY warning or error message if you LAYISO your annotative stuff and select them with a window that includes anything on one or more locked layers. As soon as you click OK in the Add/Remove dialog, the program disappears. Apparently the locked layers are not programmed for. In all cases where the program crashes, you lose work back to the last autosave at least and maybe back to the last hard save.
    1 point
×
×
  • Create New...