Jump to content

Search the Community

Showing results for tags 'variables'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions

Categories

  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 8 results

  1. How can I return the osmode to user's previous mode after running any of my lisp? Could you please help? Thanks
  2. How are you. I'm pretty simple with Lisp programming, but develop a routine for my needs I'm having problems with restoring variables; since if the user presses the esc key the variables are not reset at the end of the routine. Can someone help me with error control? I would be very grateful. I attached the routine. ;guarda y establece variables origen________________________________________________________________ (defun s_var (/ gvtho gvomo gvlco) (setq gvtho (getvar "textsize"));Guarda variable text h (setq gvomo (getvar "orthomode"));Guarda variable orthomode (setq gvlco (getvar "clayer"));Guarda variable layer current (setvar 'orthomode 1) (setvar 'tspacefac 1) (setvar 'luprec 2) );endd ;restaura variables de origen (defun r_var () (setvar 'textsize gvtho) (setvar 'orthomode gvomo) (setvar 'clayer gvlco));endd ;Crea y/o establece el layer actual en "_OFFSET Y NIVELES" ____________________________________________ (defun n_lay ( ) (command "._layer" "_M" "_OFFSET Y NIVELES" "_C" "7" "" "") (setvar "clayer" "_OFFSET Y NIVELES"));end ;Preguntar al usuario si el estio tiene Altura_____________________________________________________________________________ (defun q_estion () (initget "Si No") (setq eath (getkword "\nESTILO DE TEXTO ACTUAL TIENE ALTURA? [Si/No] <Si>: "));Estilo actual tiene H (if (= eath "No") (ts) );end if );end ;establece altura de texto cuando el estilo no lo tiene______________________________________________ (defun ts (/ ph) (setq dnht (getdist "\nAltura de Texto: <0.18>: "); Define Nueva H texto dnht (if (null ph) 0.18 ph)) (setvar 'textsize dnht) );end ;if YTN=____________________________________________________________________________________ (defun ytn ( ) (while (setq wpy (getpoint "\nQUE PUNTO: ")) (setq p1y (cadr wpy)) ;coordinada en y (setq v1y (rtos p1y 2 2)) (setq m1y (strcat "TN= " v1y )) (setq t1y (getpoint "\nDONDE TEXTO: ")) (command "mtext" t1y "j" "ml" "r" "90" "w" "0" m1y "") (command "_.move" "l" "" t1y (cons (- (car t1y) -0.17) (cdr t1y))) );while );end ;if YG=____________________________________________________________________________________ (defun yg ( ) (while (setq wpy (getpoint "\nQUE PUNTO: ")) (setq p1y (cadr wpy)) ;coordinada en y (setq v1y (rtos p1y 2 2)) (setq m1y (strcat "G= " v1y )) (setq t1y (getpoint "\nDONDE TEXTO: ")) (command "mtext" t1y "j" "ml" "r" "90" "w" "0" m1y "") (command "_.move" "l" "" t1y (cons (- (car t1y) -0.17) (cdr t1y))) );while );end ;if YB=____________________________________________________________________________________ (defun yb ( ) (while (setq wpy (getpoint "\nQUE PUNTO: ")) (setq p1y (cadr wpy)) ;coordinada en y (setq v1y (rtos p1y 2 2)) (setq m1y (strcat "B= " v1y )) (setq t1y (getpoint "\nDONDE TEXTO: ")) (command "mtext" t1y "j" "ml" "r" "90" "w" "0" m1y "") (command "_.move" "l" "" t1y (cons (- (car t1y) -0.17) (cdr t1y))) );while );end ;if YNC=____________________________________________________________________________________ (defun ync ( ) (while (setq wpy (getpoint "\nQUE PUNTO: ")) (setq p1y (cadr wpy)) ;coordinada en y (setq v1y (rtos p1y 2 2)) (setq m1y (strcat "NC= " v1y )) (setq t1y (getpoint "\nDONDE TEXTO: ")) (command "mtext" t1y "j" "ml" "r" "90" "w" "0" m1y "") (command "_.move" "l" "" t1y (cons (- (car t1y) -0.17) (cdr t1y))) );while );end ;if YMC=____________________________________________________________________________________ (defun ymc ( ) (while (setq wpy (getpoint "\nQUE PUNTO: ")) (setq p1y (cadr wpy)) ;coordinada en y (setq v1y (rtos p1y 2 2)) (setq m1y (strcat "MC= " v1y )) (setq t1y (getpoint "\nDONDE TEXTO: ")) (command "mtext" t1y "j" "ml" "r" "90" "w" "0" m1y "") (command "_.move" "l" "" t1y (cons (- (car t1y) -0.17) (cdr t1y))) );while );end ;if YOTRO_________________________________________________________________________________ (defun yotro (/ dpry ) (setq dpry (getstring t "\nQue prefijo: <R>: ") dpry (if (null dpry)R dpry)) (while (setq wpy (getpoint "\nQUE PUNTO: ")) (setq p1y (cadr wpy)) ;coordinada en y (setq v1y (rtos p1y 2 2)) (setq m1y (strcat dpry "= " v1y )) (setq t1y (getpoint "\nDONDE TEXTO: ")) (command "mtext" t1y "j" "ml" "r" "90" "w" "0" m1y "") (command "_.move" "l" "" t1y (cons (- (car t1y) -0.17) (cdr t1y))) );while );end ;lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll ;if TN=____________________________________________________________________________________ (defun xtn ( ) (while (setq wpx (getpoint "\nQUE PUNTO: ")) (setq p1x (car wpx)) ;coordinada en x (setq p2x (cadr wpx)) ;coordinada en y (setq v1x (rtos p1x 2 2)) (setq v2x (rtos p2x 2 2)) (setq m1x (strcat "OFF= " v1x )) (setq m2x (strcat "TN= " v2x )) (setq t1x (getpoint "\nDONDE TEXTO: ")) (command "mtext" t1x "j" "ml" "r" "90" "w" "0" m1x m2x "") );while );end ;if G=____________________________________________________________________________________ (defun xg ( ) (while (setq wpx (getpoint "\nQUE PUNTO: ")) (setq p1x (car wpx)) ;coordinada en x (setq p2x (cadr wpx)) ;coordinada en y (setq v1x (rtos p1x 2 2)) (setq v2x (rtos p2x 2 2)) (setq m1x (strcat "OFF= " v1x )) (setq m2x (strcat "G= " v2x )) (setq t1x (getpoint "\nDONDE TEXTO: ")) (command "mtext" t1x "j" "ml" "r" "90" "w" "0" m1x m2x "") );while );end ;if B=____________________________________________________________________________________ (defun xb ( ) (while (setq wpx (getpoint "\nQUE PUNTO: ")) (setq p1x (car wpx)) ;coordinada en x (setq p2x (cadr wpx)) ;coordinada en y (setq v1x (rtos p1x 2 2)) (setq v2x (rtos p2x 2 2)) (setq m1x (strcat "OFF= " v1x )) (setq m2x (strcat "B= " v2x )) (setq t1x (getpoint "\nDONDE TEXTO: ")) (command "mtext" t1x "j" "ml" "r" "90" "w" "0" m1x m2x "") );while );end ;if NC=____________________________________________________________________________________ (defun xnc ( ) (while (setq wpx (getpoint "\nQUE PUNTO: ")) (setq p1x (car wpx)) ;coordinada en x (setq p2x (cadr wpx)) ;coordinada en y (setq v1x (rtos p1x 2 2)) (setq v2x (rtos p2x 2 2)) (setq m1x (strcat "OFF= " v1x )) (setq m2x (strcat "NC= " v2x )) (setq t1x (getpoint "\nDONDE TEXTO: ")) (command "mtext" t1x "j" "ml" "r" "90" "w" "0" m1x m2x "") );while );end ;if NU=____________________________________________________________________________________ (defun xnu ( ) (while (setq wpx (getpoint "\nQUE PUNTO: ")) (setq p1x (car wpx)) ;coordinada en x (setq v1x (rtos p1x 2 2)) (setq m1x (strcat "OFF= " v1x )) (setq t1x (getpoint "\nDONDE TEXTO: ")) (command "mtext" t1x "j" "ml" "r" "90" "w" "0" m1x "") (command "_.move" "l" "" t1x (cons (- (car t1x) 0.14) (cdr t1x))) );while );end ;if MC=____________________________________________________________________________________ (defun xmc ( ) (while (setq wpx (getpoint "\nQUE PUNTO: ")) (setq p1x (car wpx)) ;coordinada en x (setq p2x (cadr wpx)) ;coordinada en y (setq v1x (rtos p1x 2 2)) (setq v2x (rtos p2x 2 2)) (setq m1x (strcat "OFF= " v1x )) (setq m2x (strcat "MC= " v2x )) (setq t1x (getpoint "\nDONDE TEXTO: ")) (command "mtext" t1x "j" "ml" "r" "90" "w" "0" m1x m2x "") );while );end ;if XOTRO=____________________________________________________________________________________ (defun xotro (/ dprx ) (setq dprx (getstring t "\nQue prefijo: <R>: ") dprx (if (null dprx) R= dprx)) (while (setq wpx (getpoint "\nQUE PUNTO: ")) (setq p1x (car wpx)) ;coordinada en x (setq p2x (cadr wpx)) ;coordinada en y (setq v1x (rtos p1x 2 2)) (setq v2x (rtos p2x 2 2)) (setq m1x (strcat "OFF= " v1x )) (setq m2x (strcat dprx "= " v2x )) (setq t1x (getpoint "\nDONDE TEXTO: ")) (command "mtext" t1x "j" "ml" "r" "90" "w" "0" m1x m2x "") );while );end ;OK_Y___________________________________ (defun C:vy (/ opry pwy p1y v1y m1y t1y) (s_var) (n_lay) (initget "TN R G B NC MC OTRO") (setq opry (getkword "\nPREFIJO EN Y [TN/R/G/B/NC/MC/OTRO] <R>: ")) (q_estion) (if (= opry "TN") (ytn) );end if (if (= opry "G") (yg) );end if (if (= opry "B") (yb) );end if (if (= opry "NC") (ync) );end if (if (= opry "MC") (ymc) );end if (if (= opry "OTRO") (yotro) );end if (while (setq wpy (getpoint "\nQUE PUNTO: ")) (setq p1y (cadr wpy)) ;coordinada en y (setq v1y (rtos p1y 2 2)) (setq m1y (strcat "R= " v1y )) (setq t1y (getpoint "\nDONDE TEXTO: ")) (command "mtext" t1y "j" "ml" "r" "90" "w" "0" m1y "") (command "_.move" "l" "" t1y (cons (- (car t1y) -0.17) (cdr t1y))) );while (r_var) (princ) );end ;OK_XY___________________________________________________ (defun C:vxy (/ oprx wpx p1x p2x v1x v2x m1x m2x t1x t2x) (s_var) (n_lay) (initget "TN NU R G B NC MC OTRO") (setq oprx (getkword "\nOFFEST + PREFIJO EN Y [TN/NU/R/G/B/NC/MC/OTRO] <R=>: ")) (q_estion) (if (= oprx "TN") (xtn) );end if (if (= oprx "R") (xr) );end if (if (= oprx "G") (xg) );end if (if (= oprx "B") (xb) );end if (if (= oprx "NC") (xnc) );end if (if (= oprx "MC") (xmc) );end if (if (= oprx "NU") (xnu) );end if (if (= oprx "OTRO") (xotro) );end if (while (setq wpx (getpoint "\nQUE PUNTO: ")) (setq p1x (car wpx)) ;coordinada en x (setq p2x (cadr wpx)) ;coordinada en y (setq v1x (rtos p1x 2 2)) (setq v2x (rtos p2x 2 2)) (setq m1x (strcat "OFF= " v1x )) (setq m2x (strcat "R= " v2x )) (setq t1x (getpoint "\nDONDE TEXTO: ")) (command "mtext" t1x "j" "ml" "r" "90" "w" "0" m1x m2x "") );while (r_var) (princ) );end
  3. I have been experimenting with generating variables through code rather than defining them manually. The problem is that when the program creates them, they are defined as global variables. Is there a way to generate them as local variables instead? Below is the sample code that I wrote for testing it. ;ListToVariables creates variables named testvar0, testvar1, testvar2, etc. ;Each newly created variable contains the contents of the correlated slot from testlist. (defun c:test ( / testlist ) (setq testlist (list "aaa" "bbb" "ccc" "ddd" "eee")) (ListToVariables testlist) ) (defun ListToVariables ( listname / i ) (setq i 0) (repeat (length listname) (set (read (strcat "testvar" (rtos i 2 0))) (nth i listname)) (setq i (1+ i)) ) (princ) )
  4. I have a plot setup to plot all the layout tabs in a drawing. I have provided the users the options to select the paper size, plot style, and orientation. These are stored as user variables (PDFPS, PST, and PLO). I have the setup working great, but I am trying to set it up where if the user hasn't selected one of the variables, the command will be cancelled. I have tried an if statement, but I wanted to evaluate all three variables at once. I'm thinking it should be doable, just have been able to figure it out. Any help is appreciated. The code below is the code that plots all the layouts and places them in the PDF folder for each project. ^C^C^C(foreach LL (layoutlist)(setvar "ctab" LL)(command (setq DL (substr (getvar "dwgprefix") 1 (- (strlen (getvar "dwgprefix")) 13))) (setq DN (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4))) (strcat DL DN);(setq FS (strcat DL "52 PDFs" (chr 92) DN "-" (getvar "CTAB") ".pdf")) "plot" "yes" "" "AutoCAD PDF (General Documentation)" PDFPS "Inches" PLO "No" "Extents" "1:1" "Center" "Yes" PST "Yes" "No" "No" "No" FS "Yes" "Yes" "Yes"));(alert "If all settings were selected, PDFs have been made of all layout sheets and saved in the PDFs folder for this project. They were saved as Project Name-Layout Name"); For reference, I have a code that evaluates each variable and displays a message. (if (= nil PDFPS) (alert "No paper size was selected. Please cancel command and select paper size.") (strcat PDFPS))
  5. Hello all, I added in AutoCad 2006 two variables. Firstly, constant "$Dim1= 3000" Secondary, function "ddd=$Dim1-100" How I can connect line geometry dimension value to function? Is mean when I change constant automatically update line geometry dimension value. Best Regards Stanislav Spektor Mechanical Engineer
  6. **I've posted this question on another site which a lot of people here frequent as well so I apologise in advance and don't expect an answer to both forums.** I regularly work between four different CAD standards with their own layer sets, and I use Lee Mac's LayerDirector (Thanks Lee ) with layer lists for each standard but have to reload the right one manually when I switch projects. It's not the end of the world having to do this but I'd like to roll it out to other users to help enforce the correct layer usage, however I'd like it automated so they don't have to load the LayerDirector themselves. My first thought was a variable in the drawing to identify the standard to be used (I thought PROJECTNAME would do it) and then LayerDirector would know what layer list to use, or set a project search path load the correct lisp. Any advice or assistance would very welcome! thanks ps. I don't know whether to start another thread or not as it is a similar question but I currently have a tool palette for each of the CAD standards which are almost identical and allow me to run the same lisps/scripts but modified slightly for each standard. If could set a project search path which is recognised in each drawing, then I'd only need to maintain one version of the tool palette and it would find the right version of the lisp/script accordingly.
  7. Hey everyone. Could use a little assistance here. Not sure if this is even possible, but I assume it should be. I'm still in the "i know enough LISP just to be dangerous, but slightly useful" stage I have a LISP routine that collects 5 variables from the user (r1,r2,r3,r4,r5). (setq r1 (getint "\nEnter First Rev Line Number use ZERO for NONE: ")) (setq r2 (getint "\nEnter Second Rev Line Number use ZERO for NONE: ")) (if (= r2 0)(setq r3 0)(setq r3 (getint "\nEnter Third Rev Line Number use ZERO for NONE: "))) (if (= r3 0)(setq r4 0)(setq r4 (getint "\nEnter Fourth Rev Line Number use ZERO for NONE: "))) (if (= r4 0)(setq r5 0)(setq r5 (getint "\nEnter Fifth Rev Line Number use ZERO for NONE: "))) What I would like to do with them, is sort them by their values, putting the highest value first, then sorting in reverse. Can anyone offer any insight on this? Thank you in advance!
  8. harrison-matt

    VLR-SysVar-Reactor Help

    All, I am looking for a way to create a reactor that changes a system variable back to specific variable when it is changed by a User or AutoCAD. Specifically i am talking about MLEADERSCALE, you might have noticed that if you have several styles and you switch between them your Mleaderscale resets to 1 or the specific scale set in the style. I set dimscale and mleaderscale the same and when that change happens mleaderscale ends up changing forcing me to reset the mleaderscale after each time the style is changed. I want to see the feasibility of using VLR-SysVar-Reactor and :VLR-sysVarWillChange and :VLR-sysVarChanged. I having trouble understanding the right code involved with these reactions. My furthest experience with VLR is just VLR-Command-Reactor's. objective: When Mleaderscale changes, it is reset to the current value of dimscale. Any help or nudge would be greatly appreciated, Matt
×
×
  • Create New...