Jump to content

Recommended Posts

Posted

Is there an easy way from the command prompt: to make a new layer and move ALL to that layer. I would be using a programable keyboard to run the commands.

thank you for your help

Vinni

Posted

In menu macro form...

-layer;m;mynewlayer;;change;all;;p;la;mynewlayer;;

Posted

Perhaps a little overkill, but I had fun :)

 

(defun c:AlltoLayer ( / lay ss )
 ;; © Lee Mac 2010

 (while
   (progn
     (setq lay (getstring t "\nSpecify Layer Name: "))

     (cond
       ( (eq "" lay) )
       ( (tblsearch "LAYER" lay) nil )
       ( (entmakex
           (list
             (cons 0 "LAYER")
             (cons 100 "AcDbSymbolTableRecord")
             (cons 100 "AcDbLayerTableRecord")
             (cons 2 lay)
             (cons 70 0)
           )
         )
        nil
       )
       ( (princ "\n** Invalid Layer Name **") )
     )
   )
 )

 (if (setq ss (ssget "_X" '((0 . "~VIEWPORT"))))
   (ApplyFootoSS
     (lambda ( x )
       (entupd
         (cdr
           (assoc -1
             (entmod
               (subst
                 (cons 8 lay) (assoc 8 (entget x)) (entget x)
               )
             )
           )
         )
       )
     )
     ss
   )
 )
 
 (princ)
)
   
(defun ApplyFootoSS ( foo ss )
 ;; © Lee Mac 2010
 (
   (lambda ( i / e )
     (while (setq e (ssname ss (setq i (1+ i)))) (foo e))
   )
   -1
 )
)

Posted

Hmmmm. I get

; error: bad argument type: lselsetp nil

 

lm8.png

 

:?:

Posted
Hmmmm. I get

; error: bad argument type: lselsetp nil

 

[ATTACH]21511[/ATTACH]

 

:?:

 

I tested in both 2004 & 2009. It worked great.

Posted
Perhaps a little overkill, but I had fun :)

What is difference between

( (eq "" lay) )

and

(eq "" lay)

?

Posted
Hmmmm. I get

; error: bad argument type: lselsetp nil

:?:

 

Sorry Rk, I can't seem to get it to fail - even with nothing in the drawing :(

Posted
What is difference between

( (eq "" lay) )

and

(eq "" lay)

?

 

Its a condition for the COND statement.

Posted
Its a condition for the COND statement.

I got it

Thanks

Posted

Thank you all for your help.

Posted
Thank you all for your help.

 

You're very welcome Vinni :)

 

Did you get it working in the end RK?

Posted
Sorry Rk, I can't seem to get it to fail - even with nothing in the drawing :(

 

Try it with a VIEWPORT entity in the drawing.

Posted
Try it with a VIEWPORT entity in the drawing.

 

Aha! Many thanks - I shall look into that :oops:

Posted

Of course, I overlooked the fact that you cannot entmod a Viewport... - quick workaround posted in previous code post.

Posted
Of course, I overlooked the fact that you cannot entmod a Viewport... - quick workaround posted in previous code post.

 

I hate to point this out, but now it doesn't meet the original objective of the OP. o:)

Posted
I hate to point this out, but now it doesn't meet the original objective of the OP. o:)

 

You could accomplish it using VL, but I can't be bothered to rewrite it :wink:

Posted

Or just use a menu macro to drive the ._Change command... :-)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...