Recent Posts

Pages: 1 [2] 3 4 ... 10
11
AutoLISP (Vanilla / Visual) / Re: double apostrophe
« Last post by Grrr1337 on November 11, 2019, 12:19:27 PM »
Hello,
Here are some self-explanations of mine

Then Lee made it clear with his comment

For short he's mapcaring with unnamed/anonymous defun-q.
12
CAD General / ACAD LICENSING
« Last post by jumpy on November 11, 2019, 11:05:41 AM »
Anyone here have any experience using 'home licenses' granted from autodesk alongside a subscription to the AEC collection?

I have a colleague who wants to know if the 3d studio license (which we at work do not use but pay for as part of the collection) is standalone from the subscription license or relies on the same 'seat' as it were.
He's going to be off work on holiday for a while and wanted to know if he could use/request a seat to have a go learning the latest version and want's to know if this would mess with our licensing seats at work. (we only have one for the AEC collection).

He wants to have a go, but not at the expense of messing with our subscription.

Cheers.

13
AutoLISP (Vanilla / Visual) / double apostrophe
« Last post by ElpanovEvgeniy on November 11, 2019, 10:45:47 AM »
Hello!
How does this code work?

Code - Auto/Visual Lisp: [Select]
  1. (setq l '((1 2 3)(4 5)(6 7 8 9)))
  2. ;;>> (list (+ 1 2 3) (+ 4 5) (+ 6 7 8 9))
  3.  
  4.  
  5. (mapcar ''((x) (apply '+ x)) l)

My student wrote it, but I don’t understand this syntax...
14
AutoLISP (Vanilla / Visual) / Re: Numeric text lisp
« Last post by PM on November 09, 2019, 05:28:36 PM »
Hi Dlanor. Thank you for the update !!

15
AutoLISP (Vanilla / Visual) / Re: Numeric text lisp
« Last post by Dlanor on November 09, 2019, 03:15:25 PM »
Try this briefly tested, positive numbers only.

Code - Auto/Visual Lisp: [Select]
  1. (defun rh:get_int (msg / no)
  2.   (initget 7)
  3.   (setq no (getint (strcat "\nEnter " msg " No : ")))
  4. );end_defun
  5.  
  6. (defun rh:get_kword ( msg lst d_val / tmp)
  7.   (cond ( (and (= (type lst) 'LIST) (vl-position d_val lst) (= (type msg) 'STR))
  8.           (initget 1 (vl-string-right-trim " "(apply 'strcat (mapcar '(lambda (x) (strcat x " ")) lst))))
  9.           (cond ( (setq tmp (getkword (strcat "\n" msg " ["(vl-string-right-trim "/" (apply 'strcat (mapcar '(lambda (x) (strcat x "/")) lst))) "] <" d_val "> : ")))) (d_val))
  10.         )
  11.   );end_cond
  12. );end_defun
  13.  
  14. (defun rh:get_str ( msg / tmp)
  15.   (cond ( (= (type msg) 'STR) (setq tmp (getstring (strcat "\n" msg " : ")))))
  16. );end_defun
  17.  
  18. (defun c:numtext ( / *error* c_doc ms sv_lst sv_vals ps pfix sfix s_no e_no str cnt)
  19.  
  20.   (defun *error* ( msg )
  21.     (mapcar '(lambda (x y) (setvar x y)) sv_lst sv_vals)
  22.     (if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nOops an Error : " msg " occurred.")))
  23.     (princ)
  24.   );_end_*error*_defun
  25.  
  26.   (setq sv_lst (list 'dynprompt 'dynmode 'cmdecho)
  27.         sv_vals (mapcar 'getvar sv_lst)
  28.         ps (rh:get_kword "Prefix or Suffix" (list "None" "Prefix" "Suffix" "Both") "None")
  29.   );end_setq
  30.  
  31.   (mapcar 'setvar sv_lst (list 1 3 0))
  32.  
  33.   (cond ( (= ps "Prefix") (setq pfix (rh:get_str "Enter Prefix") sfix ""))
  34.         ( (= ps "Suffix")  (setq sfix (rh:get_str "Enter Suffix") pfix ""))
  35.         ( (= ps "Both")  (setq pfix (rh:get_str "Enter Prefix") sfix (rh:get_str "Enter Suffix")))
  36.         ( (= ps "None") (setq pfix "" sfix ""))
  37.   );end_cond
  38.  
  39.         ms (vla-get-modelspace c_doc)
  40.         s_no (rh:get_int "Start")
  41.         e_no (rh:get_int "End")
  42.         str (strcat pfix (itoa e_no) sfix " - " pfix (itoa s_no) sfix)
  43.   );end_setq
  44.  
  45.   (cond ( (> e_no s_no)
  46.           (setq cnt (1- e_no))
  47.           (while (< (1- s_no) cnt e_no)
  48.             (setq str (strcat pfix (itoa cnt) sfix " - " str)
  49.                   cnt (1- cnt)
  50.             );end_setq
  51.           );end_while
  52.         )
  53.         (t
  54.           (setq cnt (1+ e_no))
  55.           (while (> (1+ s_no) cnt e_no)
  56.             (setq str (strcat pfix (itoa cnt) sfix " - " str)
  57.                   cnt (1+ cnt)
  58.             );end_setq
  59.           );end_while
  60.         )
  61.   );end_cond
  62.  
  63.   (vla-addmtext ms (vlax-3d-point (getpoint "\nSelect Insertion Point : ")) 0 str)
  64.  
  65.   (mapcar '(lambda (x y) (setvar x y)) sv_lst sv_vals)
  66. );end_defun
  67.  
  68.  
17
AutoLISP (Vanilla / Visual) / Re: Making a curve smooth
« Last post by hak_vz on November 09, 2019, 06:34:22 AM »
Here is my first post on TheSwamp.org.

To make lwpolyline smooth you may use my code posted on
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/catmull-rom-spline-from-lwpolyline/m-p/9053098/highlight/true#M390376

It creates Catmul-Rom spline from lwpolyline that consists only from line segments. C-R splines are created as a new lwpolyline that passes through
vertecs of original.
18
AutoLISP (Vanilla / Visual) / Re: Numeric text lisp
« Last post by PM on November 09, 2019, 04:21:30 AM »
Hi nice code.

Code - Auto/Visual Lisp: [Select]
  1.     (defun rh:get_int (msg / no)
  2.       (initget 7)
  3.       (setq no (getint (strcat "\nEnter " msg " No : ")))
  4.     );end_defun  
  5.      
  6.     (defun rh:get_kword ( msg lst d_val / tmp)
  7.       (cond ( (and (= (type lst) 'LIST) (vl-position d_val lst) (= (type msg) 'STR))
  8.               (initget 1 (vl-string-right-trim " "(apply 'strcat (mapcar '(lambda (x) (strcat x " ")) lst))))
  9.               (cond ( (setq tmp (getkword (strcat "\n" msg " ["(vl-string-right-trim "/" (apply 'strcat (mapcar '(lambda (x) (strcat x "/")) lst))) "] <" d_val "> : ")))) (d_val))
  10.             )
  11.       );end_cond        
  12.     );end_defun
  13.      
  14.     (defun rh:get_str ( msg / tmp)
  15.       (cond ( (= (type msg) 'STR) (setq tmp (getstring (strcat "\n" msg " : ")))))
  16.     );end_defun
  17.      
  18.     (defun c:numtext ( / *error* c_doc ms sv_lst sv_vals ps pfix sfix s_no e_no str cnt)
  19.      
  20.             (defun *error* ( msg )
  21.         (mapcar '(lambda (x y) (setvar x y)) sv_lst sv_vals)
  22.                     (if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
  23.                     (if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nOops an Error : " msg " occurred.")))
  24.                     (princ)
  25.             );_end_*error*_defun
  26.      
  27.       (setq sv_lst (list 'dynprompt 'dynmode 'cmdecho)
  28.             sv_vals (mapcar 'getvar sv_lst)
  29.             ps (rh:get_kword "Prefix or Suffix" (list "None" "Prefix" "Suffix" "Both") "None")
  30.       );end_setq
  31.      
  32.       (mapcar 'setvar sv_lst (list 1 3 0))
  33.      
  34.       (cond ( (= ps "Prefix") (setq pfix (rh:get_str "Enter Prefix") sfix ""))
  35.             ( (= ps "Suffix")  (setq sfix (rh:get_str "Enter Suffix") pfix ""))
  36.             ( (= ps "Both")  (setq pfix (rh:get_str "Enter Prefix") sfix (rh:get_str "Enter Suffix")))
  37.             ( (= ps "None") (setq pfix "" sfix ""))
  38.       );end_cond      
  39.      
  40.             ms (vla-get-modelspace c_doc)
  41.             s_no (rh:get_int "Start")
  42.             e_no (rh:get_int "End")
  43.             str (strcat pfix (itoa e_no) sfix " - " pfix (itoa s_no) sfix)
  44.             cnt (1- e_no)
  45.       );end_setq
  46.       (while (< (1- s_no) cnt e_no)
  47.         (setq str (strcat pfix (itoa cnt) sfix " - " str)
  48.               cnt (1- cnt)
  49.         );end_setq
  50.       );end_while
  51.      
  52.       (if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
  53.       (vla-startundomark c_doc)
  54.      
  55.       (vla-addmtext ms (vlax-3d-point (getpoint "\nSelect Insertion Point : ")) 0 str)
  56.      
  57.       (if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))  
  58.       (mapcar '(lambda (x y) (setvar x y)) sv_lst sv_vals)
  59.     );end_defun
  60.      
  61.  


Can any one  add an option to do the oposite

to insert a text  (10 - 9 - 8 - 7 - 6  - 5 - 4 - 3 - 2 - 1 - 10)

for example

1) insert text  (1 - 2 - 3 - ....-1)
2) insert text  (10 - 9 - 8 - ....- 1 -10)

Thanks
19
Another version:
Code: [Select]
(defun ALE_SelSet_ToObjList (SelSet / Countr ObjLst)
  (if SelSet
    (repeat (setq Countr (sslength SelSet))
      (setq ObjLst (cons (vlax-ename->vla-object (ssname SelSet (setq Countr (1- Countr)))) ObjLst))
    )
  )
)
20
AutoLISP (Vanilla / Visual) / Re: Add zero in number
« Last post by Marc'Antonio Alessi on November 09, 2019, 03:50:27 AM »
Another for > 10
Code: [Select]
; (ALE_String_ZeroPad "1" 2)     => "01"
; (ALE_String_ZeroPad "1" 5)     => "00001"
; (ALE_String_ZeroPad "Pippo" 2) => "Pippo"
;  Original By RRB - Robert Bell
;
(defun ALE_String_ZeroPad  (In_Str DgtNum / ZerLst)
  (strcat
    (apply 'strcat
      (repeat (- DgtNum (strlen In_Str))
        (setq ZerLst (cons "0" ZerLst))
      )
    )
   In_Str
  )
)
Pages: 1 [2] 3 4 ... 10