TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: TimSpangler on June 07, 2006, 01:45:03 PM

Title: How to check for a hatch pattern?
Post by: TimSpangler on June 07, 2006, 01:45:03 PM
Hey Guys/ gals,

Been awhile since I've been around (new job's got me working - The nerve of some people)

Anayway  triing to fix some problems around here.  I wrote a hatch program to do some standard hatching, now I need to add a check for a hatch pattern.  The prgram is passed the pattern name, scale, rotation, and layer.  I want thecheck to make sure the pattern exsist before I try to hatch with it.  Currently running some test and I found if I through it a bogus hatch it crashes.

Would like a lisp example, but ActiveX will be fine also (I don't get that stuff yet)

Thanks all.

TIM
Title: Re: How to check for a hatch pattern?
Post by: LE on June 07, 2006, 02:30:02 PM
Maybe something like this?
Code: [Select]
(setq name "TEST") ;; test an invalid one it will return an error.
(setq name "ANSI31") ;; test a valid one it will return T

(vl-load-com)
(not (vl-catch-all-error-p
   (setq return
  (vl-catch-all-apply
    'vla-setvariable
    (list
      thisdwg "HPNAME" name)))))
Title: Re: How to check for a hatch pattern?
Post by: GDF on June 07, 2006, 02:34:51 PM
Hey Guys/ gals,

Been awhile since I've been around (new job's got me working - The nerve of some people)

Anayway  triing to fix some problems around here.  I wrote a hatch program to do some standard hatching, now I need to add a check for a hatch pattern.  The prgram is passed the pattern name, scale, rotation, and layer.  I want thecheck to make sure the pattern exsist before I try to hatch with it.  Currently running some test and I found if I through it a bogus hatch it crashes.

Would like a lisp example, but ActiveX will be fine also (I don't get that stuff yet)

Thanks all.

TIM



Tim

Lokk at http://www.turvill.com/t2/free_stuff/index.htm
GETPAT.lsp

Gary
Title: Re: How to check for a hatch pattern?
Post by: TimSpangler on June 07, 2006, 03:44:31 PM
Luis,

I can't get your solution to work.  they both return nil for me.

Gary,
What I am triing to do is check to see if a pattern is availible before I hatch.  Your solution gets patterns from a drawing.

I'll keep on triing.  There has got to be a way to see if a hatch is availible.

Thanks Guys
Title: Re: How to check for a hatch pattern?
Post by: CAB on June 07, 2006, 03:51:54 PM
Did you include this?
(setq thisdwg (vla-get-activedocument (vlax-get-acad-object)))
It is required.
Title: Re: How to check for a hatch pattern?
Post by: LE on June 07, 2006, 03:53:30 PM
Did you include this?
(setq thisdwg (vla-get-activedocument (vlax-get-acad-object)))
It is required.

Sorry I forgot, It has been a long day..... Thank you!
Title: Re: How to check for a hatch pattern?
Post by: TimSpangler on June 07, 2006, 03:55:54 PM
DOH!

So did I

Thanks CAB works like a charm.

Thanks LE.