Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/03/2021 in all areas

  1. Ah, I see what you're after. Here in this case, you'd want to look at the getkword function with the help of initget. So first you use initget to initialise into AutoCAD the choices the user would like to make: (initget "VERBRAUCHER-1 VERBRAUCHER-2 VERBRAUCHER-3") After that you prompt the user for the choice like: (setq ly (getkword "\nSpecify layer to check [VERBRAUCHER-1/VERBRAUCHER-2/VERBRAUCHER-3] <exit>: ")) So in total, it will look like: (and ; AND can be used to stop the command as soon as the first expression hits nil. (progn (initget "VERBRAUCHER-1 VERBRAUCHER-2 VERBRAUCHER-3") (setq ly (getkword "\nSpecify layer to check [VERBRAUCHER-1/VERBRAUCHER-2/VERBRAUCHER-3] <exit>: ")) ) (setq ss (ssget (list '(0 . "INSERT") (cons 8 ly) '(66 . 1)))) ; First, prompt user to select the blocks containing the attributes to sum. (if att .... The rest of the code Once you've gotten the hang of how the language works, I suggest that, as opposed to the above approach, you open your own list of the layers to check (like how I set 'att' to either nil, or your own attribute tag string), and then use some List To String conversion functions to put them with the initget and the getkword message. (P.S. As opposed to buying a book, I self-taught myself through google-searching every single function I know up to date one-by-one, so there are still heaps of methods and functions that I'm not aware of. The rest is just experience. )
    1 point
  2. this is the dark theme layout in the dark theme firefox with dark theme colors in Autocad. My vampire eyes can be at ease.
    1 point
  3. 1 point
  4. No that would not be possible. Why would you want it there anyway? I prefer the Quick Access Toolbar for the Layer List Combo Box also found in the Layers panel in the ribbon. As the QAT doesn't use up any screen space and is accessible in any Ribbon state no matter what tab is active it's the perfect place for it. Hard to imagine anything easier than hitting L+Spacebar for line or C+Spacebar for circle. To many things in those menus make finding what you need harder not easier. I've set up both Object & Objects shortcut menus for almost every object type in AutoCAD but have only made a few modifications to the Edit and Default menus. Being able to do any modification I want to an object or group of objects with a right-click without hunting for a button saves a lot of time.
    1 point
  5. Lee, you remind me Steve Wozniak: his greatest gift has always been to be able to create electronic circuits (Apple), with the n. minimum of components!
    1 point
  6. That's why I'm thinking that the best admin setting may be to paste as plain text by default. That way, all pasted text look fine in all themes unless the user explicitly changes it. TBH, the need to paste pre-formatted text is an edge case (I think).
    1 point
  7. We have that 'paste as plain text' user option enabled over there at CCleaner. (Plus a similar user option for embedded/textline only links). I usually select 'paste as plain text' everytime it asks, and then redo any formating required in the post editor itself. It needs to be selected for each paste that you make, and of course the user may not use it because their already formatted 'paste' may look fine in the Theme that they are using. PS. We have had this Invision version over there since last August, and we (and Invision) are still tweaking the settings but not as often as we had to when it first came out.
    1 point
  8. No worries. Would you by any chance be interested in learning the language? It will definitely save you hassles to keep requesting for code if nobody else is keen to help out. After all, you already know how to execute AutoLISP routines. If you can attempt to write something up, post it here and see where you get stuck, we can assist you. Then the next time you want to code something up, you can actually do it yourself as opposed to posting in this forum. (Just my encouragement for you to take the first step to learning AutoLISP.)
    1 point
  9. What I don't understand is, what happens to the text on the right after the command ends?
    1 point
  10. This I think was answered by PBE at Autodesk\forums or at least a method of picking text in a window and making a list of it.
    1 point
  11. ;;;;;;;;;;;;;;;;;;;;;;;; CODE PROTECTION ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;; BY HANDASA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;protect your main lisp function "(PROTECTED-LISP)" by a serial number and a trail period ;upon calling "test" command this lisp will generate a code like this LICESNE: 141217654405-6310 ; consisting of date "141217" as DDMMYY and the NEXT 6 "654405" are the last 6 strings of "C" hard drive ID by calling (#Asmi_Get_Drive_Serial "C:") ;the 4 strings "6310" after the "-" string are code you use to generate a serial number for the user where serial = (63 - factor1)*(10 - factor1) * factor2 ;assuming factor1 is 4 and factor2 is 50 then the activation code for this user will be (63 - 4)*(10 - 4) * 50 = 17700 ; this serial is unique for this computer and will expire after the trail period and/or if windows reinstalled ; you can change your own factors 4 as you like which is factor1 variable in the lisp ;;;; hint: don't use values more than 10 ; you can change your own factors 50 as you like which is factor2 variable in the lisp ; you can change your own trial period which is ndays variable in the lisp code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun PROTECTED-LISP ( ) (alert (strcat "HELLO YOU ARE NOW HAVE FULL ACCESS TO THE PROGRAM FOR " (rtos ndays 2 0) " DAYS")) ;;;;;;;;;;;;;;;;; ;<YOUR CODE HERE> ;;;;;;;;;;;;;;;;; ) (DEFUN C:test ( / D1 D2 FACTOR1 FACTOR2 FIRST INPUTVALUE LOCK LOCK2 LOCK3 PCID) (setq ndays 30) ;;; define trail period days (setq factor1 4);;; define factor1 (setq factor2 50);;; define factor1 (if (not (GETENVX "INSTALLED")) ;FIRST RUN SETTING (progn (SETENVX "INSTALLED" "1") (alert "This Program Created By Eng.Mustapha Abdel Baset \n Please Like ,Subscribe And Share If You Like My work \n For contact Email me \n <Eng.Mustafa1288@gmail.com>") (getlock) (SETENVX "EXPIRED" 1) ;;; remove or comment this line to enable trail for n-days );progn ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;IF LISP IS REGISTERED TO PC (if (not (GETENVX "EXPIRED")) (progn (setq lock (GETENVX "LOCK_TOFF")) (setq d1 (menucmd "M=$(edtime,$(getvar,date),DD/MO/YY)")) (setq d2 (substr lock 1 ) (if (< (comparex d1 d2) -5) (alert "DATE AND TIME WERE CHANGED")) (if (or (> (comparex d1 d2) ndays)(< (comparex d1 d2) -5)) (progn (alert "expired") (SETENVX "EXPIRED" 1) (getlock) ) ;(alert "valid") (PROTECTED-LISP) ;;; main function here ) ) ) (if (GETENVX "EXPIRED") (progn (if (not (GETENVX "CODE")) (progn (setq d1 (menucmd "M=$(edtime,$(getvar,date),DD/MO/YY)")) (setq lock (GETENVX "LOCK_TOFF")) (setq lock2 (substr lock 9 20)) (setq lock3 (* (- (read (substr lock2 1 2)) factor1)(- (read (substr lock2 3 factor1)) 4) factor2) ) (setq pcid (rtos (#Asmi_Get_Drive_Serial "C:") 2 0)) (setq pcid (substr pcid (max 1 (- (strlen pcid) 5)) 20)) (setq first (vl-string-subst "" "/" (vl-string-subst "" "/" d1))) (SETENVX "LOCK3" (rtos (+ (* lock3 13) 1300) 2 0)) (SETENVX "CODE" (strcat "LICESNE: " first pcid "-" lock2)) ) ) (alert (strcat (GETENVX "CODE") "\n contact me to get your new activation code \n <Eng.Mustafa1288@gmail.com>")) (inputbox (GETENVX "CODE") "LISP EXPIRED" "") (if (and inputvalue (or (= (strcase inputvalue) "MUX")(= (read inputvalue) (/ (- (read (GETENVX "LOCK3")) 1300) 13)))) (progn (delenvx "EXPIRED") (delenvx "CODE") (getlock) (alert "LISP REGISTERED") ;;; main function here (PROTECTED-LISP) ) (progn (alert "NOT VALID KEY")) ) ) ) );DEFUN (defun delenvx (var) (vl-registry-delete "HKEY_CURRENT_USER\\TAKEOFF" var) ) (defun setenvx (var val) (vl-registry-write "HKEY_CURRENT_USER\\TAKEOFF" var val) ) (defun Getenvx (var) (vl-registry-read "HKEY_CURRENT_USER\\TAKEOFF" var) ) (defun comparex (d1 d2 / ALLDAYS DAY1 DAY2 DAY3 MO1 MO2 MO3 YR1 YR2 YR3) (setq yr1 (read (substr d1 7 2)) ;extract the year mo1 (read (substr d1 4 2)) ;extract the month day1 (read (substr d1 1 2)) ;extract the day );setq (setq yr2 (read (substr d2 7 2)) ;extract the year mo2 (read (substr d2 4 2)) ;extract the month day2 (read (substr d2 1 2)) ;extract the day );setq (if (> day1 day2) (setq day3 (- day1 day2)) (progn (setq day1 (+ day1 30)) (setq mo1 (- mo1 1)) (setq day3 (- day1 day2)) ) ) (if (> mo1 mo2) (setq mo3 (- mo1 mo2)) (progn (setq mo1 (+ mo1 12)) (setq yr1 (- yr1 1)) (setq mo3 (- mo1 mo2)) ) ) (setq yr3 (- yr1 yr2)) (setq alldays (+ (* yr3 365) (* mo3 30) day3)) );defun (defun rnd (/ modulus multiplier increment random) (if (not seed) (setq seed (getvar "DATE")) ) (setq modulus 65536 multiplier 25173 increment 13849 seed (rem (+ (* multiplier seed) increment) modulus) random (/ seed modulus) ) ) (defun getlock () (setq rand "123") (while (or (not (equal 4 (strlen rand))) (not (read (substr rand 3 2)))(< (read (substr rand 3 2)) (1+ factor1))) (setq rand (rtos (fix(* 10000 (rnd))) 2 0)) ) (SETENVX "LOCK_TOFF" (strcat (menucmd "M=$(edtime,$(getvar,date),DD/MO/YY)") rand)) ) ;;; **** PC Hardware Functions ****** ;;; ********************************* ;;; * ;;; Retrieves Hard Drive serial number * ;;; * ;;; Arguments: * ;;; Path - Path of Hard Drive, for example "C:" (string) * ;;; * ;;; Output: * ;;; Hard Drive serial number (integer) or NIL in case of error. * ;;; * (defun #Asmi_Get_Drive_Serial(Path / fsObj hSn abPth cDrv) (vl-load-com) (if (and (setq fsObj(vlax-create-object "Scripting.FileSystemObject")) (not (vl-catch-all-error-p (setq abPth(vl-catch-all-apply 'vlax-invoke-method (list fsObj 'GetAbsolutePathName Path)) ); end setq ); end vl-catch-all-error-p ); end not ); end and (progn (setq cDrv(vlax-invoke-method fsObj 'GetDrive (vlax-invoke-method fsObj 'GetDriveName abPth ); end vlax-invoke-method );end vlax-invoke-method ); end setq (if (vl-catch-all-error-p (setq hSn(vl-catch-all-apply 'vlax-get-property (list cDrv 'SerialNumber)))) (progn (vlax-release-object cDrv) (setq hSn nil) ); end progn ); end if (vlax-release-object fsObj) ); end progn ); end if hSn ); end of #Asmi_Get_Drive_Serial ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun inputbox (prompt title default) (setq dcl_id (load_dialog "inputbox.dcl")) (if (not (new_dialog "inputbox" dcl_id)) (exit) ) (set_tile "prompt" prompt) (set_tile "title" title) (set_tile "eb1" default) (mode_tile "eb1" 2) (action_tile "cancel" "(done_dialog) (setq result nil)" ) (action_tile "accept" "(setq inputvalue (get_tile \"eb1\")) (done_dialog) (setq result T)" ) (start_dialog) (unload_dialog dcl_id) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;; end of coding ;;;;;;;;;;;;;;;;;;;;; (PRINC "\nTYPE 'TEST' TO RUN THE LISP")
    1 point
  12. Try this code and do not forget to change the name of the layer as per yours . (defun c:Test (/ doc objs) ;; Tharwat 10. Apr. 2014 ;; (cond ((eq (getvar 'ctab) "Model") (princ "\n ** Command is not allowed in Model Space !!") ) (t (vlax-for x (vla-get-paperspace (setq doc (vla-get-activedocument (vlax-get-acad-object) ) ) ) (if (and (/= (vla-get-objectname x) "AcDbViewport") (eq (vla-get-layer x) [color=magenta]"Layer1"[/color]) ) (setq objs (cons x objs)) ) ) (if objs (vlax-invoke doc 'CopyObjects objs (vla-get-ModelSpace doc) ) ) ) ) (princ) )(vl-load-com)
    1 point
  13. AFAIK chspace may be the best method to accomplish this task due to the matrix math required otherwise, although chspace is an express tools function is seems as if you need a tool for a few local machines, assuming express tools is loaded onto any that would use such a routine, something like this, quick and dirty. (defun C:layCSpace ( / ss) [font=Courier New](setq ss (ssget "x" (list (cons 8 "[color=red]PID[/color]")))) ;create selection set of all items on layer "PID" and assign them to the variable "SS"[/font] (sssetfirst nil ss) ;grip select selection set (C:CHspace) ;change space [font=Courier New]) ;defun[/font] Obviously you would need to change "PID" to your layer name.
    1 point
×
×
  • Create New...