Results 1 to 1 of 1

Thread: Preset your Hatching

  1. #1
    AUGI Addict madcadder's Avatar
    Join Date
    2000-11
    Location
    Broken Arrow, OK
    Posts
    1,005
    Login to Give a bone
    0

    Default Preset your Hatching

    Here's a trick for those not using palettes...



    There are many instances in daily operations where I repeatedly set down certain patterns. Usually on set layers at predetermined scales. Etc.

    So how do you normally do that? Open the hatch dialog, set scale, pick pattern, blah, blah, blah. You know what you do.

    Time consuming and then you have to do it again for the next pattern.

    Per request and due to recent automation threads I though I’d share a way to resolve most of your hatch issues into as little as 3 clicks.

    When testing on a new drawing I counted it at 12 clicks, not counting typing or scrolling, to do this.

    The following Lisp will:

    1) Presets the snapbase for this hatch pattern.
    2) Checks to see if a layer exists, creates if needed, and sets it current.
    3) Creates an 8 in tile flooring pattern with “island detection” preset to OUTER
    4) Allows single or multiple selection of hatching area(s)
    5) Sets layer, snapbase, hatch name, angle, scale, etc. back to what they were before command.


    Code:
     (DEFUN |hatcherror| (|msg|)
        (IF (OR (= |msg| "Function cancelled")
      	  (= |msg| "quit / exit abort")
      	  )
      	(PRINC (STRCAT "\nError: " |msg|))
        )
        (SETVAR "clayer" |clayer|)
        (SETVAR "hpang" |hpang|)
        (SETVAR "hpname" |hpname|)
        (SETVAR "hpscale" |hpscale|)
        (SETQ *error* |olderror|)
        (COMMAND "undo" "end")
        (SETVAR "cmdecho" |cmdecho|)
        (PRINC)
      )
      
      
      (DEFUN c:tile8 (/ |hpang| |hpname| |hpscale| |olderror|	|autosnap|
      		|clayer| |cmdecho| |orthomode| |polarmode|
      		   )
        (COMMAND "undo" "begin")		; start undo
        (SETQ |cmdecho| (GETVAR "cmdecho"))	; save current cmdecho
        (SETVAR "cmdecho" 0)			; turn off echo
        (SETQ |olderror| *error*)		; save current error code
        (SETQ *error* |hatcherror|)		; set error code for this routine
        (SETQ |clayer| (GETVAR "clayer"))	; save current layer
        (SETQ |hpang| (GETVAR "hpang"))	; save current hatch angle
        (SETQ |hpname| (GETVAR "hpname"))	; save current hatch name
        (SETQ |hpscale| (GETVAR "hpscale"))	; save current hatch scale
        (SETQ |osmode| (GETVAR "osmode"))	; saves current osnap settings
        (SETQ |snapbase| (GETVAR "snapbase"))	;save current snapbase point
        (SETVAR "osmode" 0)			; turn off osnaps
        (SETQ |newbase| (GETPOINT "\nPick SNAPBASE for hatching area: "))
     			 	 ; Select snapbase point for this pattern
        (SETVAR "snapbase" (LIST (CAR |newbase|) (CADR |newbase|)))
     					; set snapbase to point selected
        (SETVAR "hpang" 0)			; set hatch angle to 0
     (SETVAR "hpname" "net,o")		; set hatch name with OUTER island detection (",I" inner ",O" outer ",N" normal)
     (SETVAR "hpscale" 64)			; set hatch scale (to equal 8" tile)
        (IF (NOT (TBLSEARCH "layer" "dwgtexture"))
     					; search to see if layer exists
     	(COMMAND "_.-layer"	"_make"	"dwgtexture" "_color" "8" "dwgtexture"
      		 ""
     		)	 		 ; makes layer named dwgtexture with color set to 8 if not found
     	(COMMAND "_.-layer" "_thaw"	"dwgtexture" "_on" "dwgtexture"	"_set"
      		 "dwgtexture" ""
     		)	 		 ; sets layer current if found
        )
        (PRINC
      	"\nHatch Pattern for 8in Tile Flooring ready: "
        )
        (PRINC "\nSelect internal point: ")
     (COMMAND "-bhatch")			; starts hatch with dialog box supressed
        (WHILE (> (GETVAR "cmdactive") 0)	; loops while selecting hatch area(s)
      	(COMMAND pause)
        )
        (SETVAR "clayer" |clayer|)		; set layer back to original layer
        (SETVAR "hpang" |hpang|)		; sets hatch angle back to original angle
        (SETVAR "hpname" |hpname|)		; sets hatch name back to original name
        (SETVAR "hpscale" |hpscale|)		; sets hatch scale back to original scale
        (SETQ *error* |olderror|)		; sets error back to original error
        (COMMAND "undo" "end")		; ends undo 
        (SETVAR "cmdecho" |cmdecho|)		; set echo back to original
        (PRINC)				; exit quietly
      )
     
     
      
    Last edited by madcadder; 2005-08-11 at 03:18 PM.

Similar Threads

  1. Section preset Depth
    By Wish List System in forum Revit MEP - Wish List
    Replies: 0
    Last Post: 2012-11-07, 01:32 PM
  2. Can you preset the Z offset for a beam?
    By mthurnauer in forum Revit Structure - General
    Replies: 1
    Last Post: 2009-07-01, 01:50 PM
  3. Preset de rendu
    By METANAMORPHOSE in forum Français - 3ds Max / Maya
    Replies: 0
    Last Post: 2009-02-08, 02:54 PM
  4. Preset Text Direction
    By Henry D in forum Revit Architecture - Wish List
    Replies: 0
    Last Post: 2007-08-08, 08:08 PM
  5. How do I Preset Viewport Scale?
    By steven.bryan in forum VBA/COM Interop
    Replies: 5
    Last Post: 2006-04-13, 04:55 PM

Posting Permissions

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