Results 1 to 4 of 4

Thread: Custom keyboard shortcut for layer management

  1. #1
    Member
    Join Date
    2016-01
    Posts
    34
    Login to Give a bone
    0

    Default Custom keyboard shortcut for layer management

    I know this will be a snap for someone out there:

    I would like a keyboard shortcut that will turn off[or turn on with another key combination] a specific layer. That layer is named '_watermark'.

    I have written one for when I want to change my snap points to tan only [^C^C_osmode;256;] but I just cannot figure out how to control layers with keyboard shortcuts. All help is greatly appreciated.

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,658
    Login to Give a bone
    0

    Default Re: Custom keyboard shortcut for layer management

    I use a lisp by Jimmy Bergmark https://jtbworld.com/autocad-layer-toggle-freeze-lsp
    Save the lisp anywhere in your support file search path and this macro should work:
    Code:
    ^P(or layer-toggle-freeze(load "layer-toggle-freeze.lsp"))(layer-toggle-freeze '("_watermark"))

  3. #3
    Member
    Join Date
    2016-01
    Posts
    34
    Login to Give a bone
    0

    Default Re: Custom keyboard shortcut for layer management

    Sorry for the delay in getting back but we had a customer that wanted to push up their project.

    I couldn’t get your code to run without errors & wasn’t able to get time to debug. I ended up using a snip from the lee-mac site. Just a quick & dirty code - if unfrozen then freeze, and vica versa. Yes, there isn’t any error checking to see if the layer is there but I’m willing to live with it throwing a fit if I use it in a drawing without the layer.

    Here what I use:
    Code:
    (defun FreezeThawLayer ( layer / dx en )
      (setq en (tblobjname "LAYER" layer))
      (setq en (entget en)
    	dx (assoc 70 en)
    	en (entmod (subst (cons 70 (boole 6 1 (cdr dx))) dx en))
    	)
      (princ)
    )
    
    ;and my keyboard shortcut macro
    ;^C^C^P(FreezeThawLayer "__watermark")

  4. #4
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,658
    Login to Give a bone
    0

    Default Re: Custom keyboard shortcut for layer management

    Quote Originally Posted by lynx_20 View Post
    Sorry for the delay in getting back but we had a customer that wanted to push up their project.

    I couldn’t get your code to run without errors & wasn’t able to get time to debug.
    Did you save Jimmy Bergmark's code in a folder in the Support path? I use his code since it will toggle a list of layers at one time. I've modified it to import (using Lee's Steal From Drawing) or create layers as needed if they're not in the drawing.
    Glad Lee Mac's Code worked for you. I use a lot of his code on a daily basis.
    Code:
    ;;; toggle the freeze state of layer
    ;;; and regens only the objects on the layer
    ;;; but if layer is xref dependant it regens
    ;;;
    ;;; By Jimmy Bergmark
    ;;; Copyright (C) 1997-2006 JTB World, All Rights Reserved
    ;;; Website: www.jtbworld.com
    ;;; E-mail: info@jtbworld.com
    ;;; 2000-03-05 - First release
    ;;;
    ;;; Tested on AutoCAD 2000
    ;;; Argument: layer {list of layers}
    ;;; Example: (layer-toggle-freeze '("Layer1" "Layer2"))
    
    (defun layer-toggle-freeze (layer / en f ss ent i fg)
      (foreach la layer
        (setq en (entget (tblobjname "layer" la)))
        (setq f (cdr (assoc 70 en)))
        (setq f (boole 6 f 1))
        (if (and (wcmatch la "*|*") (eq 0 (logand 1 f))) (setq rg T))
        (setq en (subst (cons 70 f) (assoc 70 en) en))
        (entmod en)
        (setq ss (ssget "X" (list (cons 8 la))))
        (setq i 0)
        (if ss 
          (while (setq ent (ssname ss i))
            (entupd ent)
            (setq i (1+ i))
          )
        )
      )
      (setq sset nil)
      (if rg (command "._regenall"))
      (princ)
    )

Similar Threads

  1. Revit Keyboard Shortcut Editor version 6.0 (and 5.1)
    By ShaunKapot in forum Revit - R & D Lounge
    Replies: 36
    Last Post: 2005-11-17, 09:12 AM
  2. Keyboard Shortcut Highway for Revit 7.0
    By Marek Brandstatter in forum Revit - R & D Lounge
    Replies: 17
    Last Post: 2005-05-25, 06:14 AM
  3. View Range - Shortcut @ keyboard
    By Steve_Stafford in forum Revit Architecture - Wish List
    Replies: 2
    Last Post: 2004-08-17, 09:26 PM
  4. keyboard shortcut
    By sfaust in forum Revit Architecture - General
    Replies: 2
    Last Post: 2004-08-12, 01:51 AM
  5. Keyboard Shortcut List
    By bclarch in forum Revit Architecture - Wish List
    Replies: 1
    Last Post: 2003-06-04, 04:18 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •