Results 1 to 5 of 5

Thread: Hide text in command line when using tool palette commands

  1. #1
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Unhappy Hide text in command line when using tool palette commands

    Hey gang,

    I have the following code in a tool palette icon:

    Code:
    ^C^C(if ASPHALTTOPCOURSE (ASPHALTTOPCOURSE) (princ "Asphalt Top Course not loaded."))
    This issues a command defined in acaddoc.lsp that creates a hatch:

    Code:
    ;Asphalt Top Course
    (defun ASPHALTTOPCOURSE ( / TMP CAS NHS)
        (setvar "NOMUTT" 1)
        (setvar "CMDECHO" 0)
        (setq TMP (getvar 'clayer))
        (setq CAS (getvar 'cannoscalevalue))
        (setq NHS (/ 0.3333333333333333 CAS))
        (command
            "_.-layer" "_m" "L-HTCH-SCRN-MEDM" "_c" "8" "L-HTCH-SCRN-MEDM" ""
            "_.-hatch" "_p" "ANSI31" NHS "45" "_a" "_a" "_y" ""
        )
        (while (= 1 (logand 1 (getvar 'cmdactive))) (vl-cmdf "\\"))
        (setvar 'clayer tmp)
        (setvar "NOMUTT" 0)
        (setvar "CMDECHO" 1)
        (princ)
    )
    It works fine except that when I click the icon, I get this at the command line:
    Command: (if ASPHALTTOPCOURSE (ASPHALTTOPCOURSE) (princ "Asphalt Top Course not loaded."))

    It shouldn't echo anything unless the command has not loaded and then it should simply report "Asphalt Top Course not loaded."

    Any idea why it's echoing the entire command string and how I might prevent it from doing so?

    Thanks in advance for your help.

    -JP

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

    Default Re: Hide text in command line when using tool palette commands

    Try:
    Code:
     ^C^C^P(if ASPHALTTOPCOURSE (ASPHALTTOPCOURSE) (princ "Asphalt Top Course not loaded."))
    You could also use a diesel expression.

  3. #3
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Hide text in command line when using tool palette commands

    That is just absolutely brilliant.

    ^P... who knew?

    Thanks Tom!!!

  4. #4
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,096
    Login to Give a bone
    0

    Default Re: Hide text in command line when using tool palette commands

    Quote Originally Posted by jpcadconsulting347236 View Post
    ^P... who knew?
    Tom. Tom knew.

    You can see more control characters in the AutoCAD 2015 Help.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  5. #5
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Hide text in command line when using tool palette commands

    FWIW, this works great... maybe too great.

    The ^P also hides the string of text in the command line after the hatch command is issued so the users never see the hatch options:

    "Specify internal point or [Properties/Select objects/draW boundary/remove Boundaries/Advanced/DRaw order/Origin/ANnotative/hatch COlor/LAyer/Transparency]:"

    So I wound up removing it and modifying my LISP that creates the hatch to this (It's a little clunky I know but it works and is only slightly more verbose than the ^P method):

    Code:
    ;Groundcover 01
    (defun GC01 ( / TMP CAS NHS)
        (setvar "CMDECHO" 0)
        (setq TMP (getvar 'clayer))
        (setq CAS (getvar 'cannoscalevalue))
        (setq NHS (/ 0.5 CAS))
        (command
            "_.-layer" "_m" "L-PL-HATCH-LITE" "_c" "44" "L-PL-HATCH-LITE" ""
            "_.-hatch" "_p" "ANSI31" NHS "0" "_a" "_a" "_y" "" ""
            "cmdecho" "1"
            "_.-hatch"
        )
        (while (= 1 (logand 1 (getvar 'cmdactive))) (vl-cmdf "\\"))
        (setvar 'clayer tmp)
        (princ)
    )
    Thanks for your help Tom and Opie!
    Last edited by jpcadconsulting347236; 2014-10-28 at 06:09 PM.

Similar Threads

  1. 2012: Add Custom Commands to Tool Palette
    By Darren Allen in forum AutoCAD General
    Replies: 14
    Last Post: 2013-04-02, 04:27 PM
  2. Link Tool Palette Text Command to a Library Drawings
    By Jas.Bart in forum AutoCAD Customization
    Replies: 1
    Last Post: 2007-08-21, 05:20 AM
  3. Tool Palette Auto Hide time, can this be controlled
    By Maverick91 in forum AutoCAD General
    Replies: 4
    Last Post: 2006-11-09, 10:32 PM
  4. Command Line Auto-Hide
    By Steve_Bennett in forum AMEP Wish List
    Replies: 1
    Last Post: 2005-06-04, 04:59 AM
  5. Tool palette won't auto hide
    By vanderloo5 in forum ACA General
    Replies: 3
    Last Post: 2005-01-19, 05:54 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
  •