Results 1 to 5 of 5

Thread: Quicker hatch command

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

    Default Quicker hatch command

    Hey gang,

    I'm trying to write a lisp routine that does the following:


    1. Closes the ribbon
    2. Issues the hatch command (using the dialog box)
    3. Restores the ribbon after closing the hatch dialog


    I almost have it here, but it does not restore the ribbon:

    Code:
    (defun C:qh ()
        (command "ribbonclose")
        (initdia) ; allow dialog
        (command "_.hatch")
        (princ)
    )
    (command "ribbon")

    Any advice?

    Thanks as always,

    -JP

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

    Default Re: Quicker hatch command

    Can you elaborate on the reasoning?

    What about using the tool palette to assign a predefined hatch? It is about as quick if not quicker.
    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

  3. #3
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: Quicker hatch command

    Quote Originally Posted by jpcadconsulting347236 View Post
    Hey gang,

    I'm trying to write a lisp routine that does the following:


    1. Closes the ribbon
    2. Issues the hatch command (using the dialog box)
    3. Restores the ribbon after closing the hatch dialog


    I almost have it here, but it does not restore the ribbon:

    Code:
    (defun C:qh ()
        (command "ribbonclose")
        (initdia) ; allow dialog
        (command "_.hatch")
        (princ)
    )
    (command "ribbon")
    The Ribbon is not being re-enabled as the call to do so is outside of your routine's scope.

    Instead, consider this quick adaptation, which first checks to see if the Ribbon is enabled, restoring the Ribbon only as needed, and will also handle any errors:

    Code:
    (defun c:QuickHatch (/ *error* on)
    
      (defun *error* (msg)
        (if on (command "._ribbon"))
        (cond ((not msg))							; Normal exit
    	  ((member msg '("Function cancelled" "quit / exit abort")))	; <esc> or (quit)
    	  ((princ (strcat "\n** Error: " msg " ** ")))			; Fatal error, display it
        )
        (princ)
      )
    
      (if (setq on (= 1 (getvar 'ribbonstate)))
        (command "._ribbonclose")
      )
      (initdia)
      (command "._hatch")
      (*error* nil)
    )


    Now, for the record... The quickest way I know of hatching one or more closed polylines is to simply select them on screen and right click:



    ... Those who may be interested in adding this custom functionality should use the 'Autodesk Exchange' link in my signature.

    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  4. #4
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: Quicker hatch command

    Quote Originally Posted by Opie View Post
    What about using the tool palette to assign a predefined hatch? It is about as quick if not quicker.
    FWIW -

    The next update to my Right Click Hatch app will add 'favorites' functionality, where the user can configure pre-defined, or commonly used hatch patterns (i.e., Favorite Name, Color, Density, Layer, Linetype, Pattern, and Rotation, etc.).
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  5. #5
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: Quicker hatch command

    Quote Originally Posted by BlackBox View Post
    ... The quickest way I know of hatching one or more closed polylines is to simply select them on screen and right click:

    Here's a quick video demonstration.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Similar Threads

  1. Fix the hatch command
    By Wish List System in forum AutoCAD Wish List
    Replies: 2
    Last Post: 2015-02-17, 04:06 PM
  2. Hatch Command
    By nick.259007 in forum AutoLISP
    Replies: 8
    Last Post: 2010-11-15, 06:21 PM
  3. Print quicker in 3D
    By jason907238 in forum AutoCAD General
    Replies: 1
    Last Post: 2008-01-19, 01:51 PM
  4. Hatch command does not work
    By T-Towntech in forum AutoCAD General
    Replies: 12
    Last Post: 2007-04-27, 08:45 PM
  5. Hatch command/dialog box
    By rhayes.99001 in forum ACA General
    Replies: 2
    Last Post: 2006-01-16, 10:08 AM

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
  •