Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/19/2024 in all areas

  1. I would add a does new layer exist ? The oldlayer ssget will fail if the layer does not exist so that is handled. (if (= (tblsearch "LAYER" newlayer) nil) (command "-layer" "m" newlayer "C" 3 "" "") )
    2 points
  2. Ok sooooo I added the part that BIGAL suggested shown below and the ssget error is gone. It now says select objects but will not allow me to select anything. I tried a CTRL+A which worked for selecting in this instance however nothing happens after that. Who knew it would be such a tough one to get to work. (defun c:relocate ( / MySS MyEnt ed acount) (setq OldLayer "1 EXISTING TO RELO" ) (setq OldColour 5 ) (setq NewLayer "1 RELO NEW LOCATION" ) (if (= (tblsearch "LAYER" newlayer) nil) (command "-layer" "m" newlayer "C" 3 "" "") ) (if (setq MySS (ssget (list (cons 8 OldLayer)(cons 62 OldColour)))) (progn (setq acount 0) ;; a counter (while (< acount (sslength MySS)) ;; a while loop (setq MyEnt (ssname MySS acount)) ;; nth position entity of selection set (setq ed (entget MyEnt)) ;; nth entity definition (setq ed (subst (cons 8 NewLayer) (assoc 8 ed) ed )) (entmod ed) ;; update the entitiy with the new definition (setq acount (+ acount 1)) ;; counter + 1 ) ; end while ;; end while loop ) ; end progn (princ "Nothing Selected") ;; Error if nothing seleted in selection set ) ; end if (princ) ;;exit silently )
    1 point
  3. Try this one, I've added in 3 lines at the top to make updating for other layers and colours slightly easier... but will join up with a selection pop-up box in the future if needed. (that means that the 'ssget' line needs a small change) Also added an 'if' statement, in the case that there are no entities coloured blue and on layer 'OldLayer' it will report 'nothing selected' - that might be where your error was, nothing on the layer in your example drawing. (defun c:relocate ( / MySS MyEnt ed acount) (setq OldLayer "1 EXISTING TO RELO" ) (setq OldColour 5 ) (setq NewLayer "1 RELO NEW LOCATION" ) (if (setq MySS (ssget (list (cons 8 OldLayer)(cons 62 OldColour)))) (progn (setq acount 0) ;; a counter (while (< acount (sslength MySS)) ;; a while loop (setq MyEnt (ssname MySS acount)) ;; nth position entity of selection set (setq ed (entget MyEnt)) ;; nth entity definition (setq ed (subst (cons 8 NewLayer) (assoc 8 ed) ed )) (entmod ed) ;; update the entitiy with the new definition (setq acount (+ acount 1)) ;; counter + 1 ) ; end while ;; end while loop ) ; end progn (princ "Nothing Selected") ;; Error if nothing seleted in selection set ) ; end if (princ) ;;exit silently )
    1 point
  4. Ok found the X&Y problem just change this in line 101 (trans cen 1 0) the trans was the other way around need 1 0. (setq lst3 (cons (list (strcat pre (rtos box 2 0)) (strcat str) (trans cen 1 0) rad ) lst3))
    1 point
×
×
  • Create New...