Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/13/2022 in all areas

  1. DOSLib Version 9.0.3 Supports AutoCAD 2013 thru 2021 and would be the version you need to load for it to work in AutoCAD 2013.
    1 point
  2. Have at it. Hope it helped. However, you need not credit me on this as the only thing you used of mine was my function name. lol I thought I'd post a couple examples of your desired result. Both are recursive, but the second uses list over string manipulation as it's just faster (not that it's going to make much of a difference on something like this. (defun _numPad (str len) ((lambda (foo) (if (wcmatch str "-*") (strcat "-" (foo (substr str 2) len)) (foo str len) ) ) (lambda (n l) (if (< (strlen n) l) (foo (strcat "0" n) l) n ) ) ) ) (defun _numPad2 (str len) ((lambda (foo lst) (vl-list->string (if (eq (car lst) 45) (cons 45 (foo (cdr lst) len)) (foo lst len) ) ) ) (lambda (x l) (if (< (length x) l) (foo (cons 48 x) l) x ) ) (vl-string->list str) ) )
    1 point
  3. I reckon that circle #1 is a wipeout boundary, and circle #2 is a circle.
    1 point
  4. @turbosocks Give this a try. (defun c:layerprefix (/ e el l f s tm) ;; RJP » 2022-08-12 (or (setq f (getenv "RJP_LayerPrefix")) (setq f (getenv "username"))) (cond ((and (setq f (cond ((/= "" (setq tm (getstring (strcat "\nEnter prefix [<" f ">]: ")))) tm) (f) ) ) (setq s (ssget ":L" (list '(-4 . "<NOT") (cons 8 (strcat f "*")) '(-4 . "NOT>")))) ) (setenv "RJP_LayerPrefix" f) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (setq el (entget (tblobjname "layer" (setq l (cdr (assoc 8 (entget e))))))) (or (tblobjname "layer" (setq nl (strcat f l))) (entmakex (subst (cons 2 nl) (assoc 2 el) el)) ) (entmod (subst (cons 8 nl) (assoc 8 (entget e)) (entget e))) ) ) ) (princ) )
    1 point
  5. Mhupp Started using the setvars method today on some new code, THANKS. Easier than foreach.
    1 point
  6. 1 point
  7. If your setting a bunch of values like this. (defun sm-error (msg) (setvar "cmdecho" 0) (if oldattdia (setvar "attdia" oldattdia)) (if oldattreq (command "attreq" oldattreq)) (if oldangbase (setvar "angbase" oldangbase)) (if oldlay (setvar "clayer" oldlay)) (if oldosmode (setvar "osmode" oldosmode)) (princ "Sm Error: ") (setq *error* olderror) (setvar "cmdecho" 1) (princ) ) have this at the start of the main lisp. first two are needed to capture the values. the third line you can set new values all at once but isn't needed. (setq vars '(attdia attreq angbase clayer osmode) ;list of variables vals (mapcar 'getvar vars) ;store old values in a list called vals ) (mapcar 'setvar vars '(# # # "layername" #)) ;set new values So to reset all values back you only need this line. (mapcar 'setvar vars vals) ;sets all values back to before
    1 point
  8. It's not a bug, it's user error for selecting an entity on a layer with the suffix "-DEMO" A belt and braces lisp. You can't select a layer with "-DEMO" in the layer name If the layer already has an associated "-demo" layer it moves it to that layer Otherwise it creates the demo layer and moves it. (defun change_layer_color_ltp ( ent / dlname) (setq dlname (cdr (assoc 8 (entget ent)))) (cond ( (and (not (wcmatch (strcase dlname) "*-DEMO")) (setq dlname (strcat dlname "-DEMO")) (not (tblsearch "layer" dlname)) ) (command "_.layer" "_make" dlname "_color" 40 "" "_ltype" "HIDDEN2" "" "" "_.chprop" ent "" "_layer" DLname "" ) ) ( (tblsearch "layer" dlname) (command "_.chprop" ent "" "_layer" dlname "")) ) (princ) ) (defun c:clcl ( / ss i) ;; selection (princ "\nMake selection: ") (setq ss (ssget '((-4 . "<NOT") (8 . "*DEMO") (-4 . "NOT>")))) ;; now perform the function for every selected entity (setq i 0) (repeat (sslength ss) (change_layer_color_ltp (ssname ss i)) (setq i (+ i 1)) ) (princ) )
    1 point
  9. Sure, I renamed the command CLCL (defun change_layer_color_ltp ( ent / DLname) (setq ;;ent (car esel) DLname (strcat (cdr (assoc 8 (entget ent))) "-DEMO") ) (command "_.layer" "_make" DLname "_color" 40 "" "_ltype" "HIDDEN2" "" "" "_.chprop" ent "" "_layer" DLname "" ) (princ) ) (defun c:clcl ( / ss i) ;; selection (princ "\nMake selection: ") (setq ss (ssget)) ;; now perform the function for every selected entity (setq i 0) (repeat (sslength ss) (change_layer_color_ltp (ssname ss i)) (setq i (+ i 1)) ) (princ) )
    1 point
×
×
  • Create New...