Results 1 to 10 of 10

Thread: How to Write LISP Routine Drawing Associative Hatch Pattern?

  1. #1
    AUGI Addict
    Join Date
    2006-04
    Location
    (getpoint "Anywhere on the Enter Key =>")
    Posts
    1,160
    Login to Give a bone
    0

    Default How to Write LISP Routine Drawing Associative Hatch Pattern?

    Hi ALL,

    Every time I write a hatch founction, the LISP draws a nonassociative hatch pattern.

    How to get it associating with its boundaries?


    Thanks

    Ke

  2. #2
    All AUGI, all the time
    Join Date
    2000-12
    Location
    Blue Springs, MO
    Posts
    658
    Login to Give a bone
    0

    Default Re: How to Write LISP Routine Drawing Associative Hatch Pattern?

    You could alway use the HPASSOC system variable in your routine to ensure your hatch will alway be associative.

  3. #3
    AUGI Addict
    Join Date
    2006-04
    Location
    (getpoint "Anywhere on the Enter Key =>")
    Posts
    1,160
    Login to Give a bone
    0

    Default Re: How to Write LISP Routine Drawing Associative Hatch Pattern?

    Quote Originally Posted by jmctamney View Post
    You could alway use the HPASSOC system variable in your routine to ensure your hatch will alway be associative.

    I checked my drawing & my code again.

    HPASSOC on my drawing & code has already been set to 1.

    I can't see the hatch is associative.

    The following was subtracted from my code:
    (setvar "HPASSOC" 1)
    (command "_hatch" "MUDST" 20 "0" ent1 "")



  4. #4
    100 Club
    Join Date
    2006-11
    Location
    UTAH
    Posts
    135
    Login to Give a bone
    0

    Default Re: How to Write LISP Routine Drawing Associative Hatch Pattern?

    Quote Originally Posted by ke.li View Post
    I checked my drawing & my code again.

    HPASSOC on my drawing & code has already been set to 1.

    I can't see the hatch is associative.

    The following was subtracted from my code:
    (setvar "HPASSOC" 1)
    (command "_hatch" "MUDST" 20 "0" ent1 "")


    Change your hatch command to this:
    Code:
    (command "._-HATCH" "P" "MUDST" 20 "0" "A" "A" "Y" "" "S" ent1 "" "")
    This forces the command-line version of hatch to run, where you can specify whether or not it should be associative. The usual lisp version of hatch is extremely old and therefore doesn't give you the option.

    Cheers!

  5. #5
    AUGI Addict
    Join Date
    2006-04
    Location
    (getpoint "Anywhere on the Enter Key =>")
    Posts
    1,160
    Login to Give a bone
    0

    Default Re: How to Write LISP Routine Drawing Associative Hatch Pattern?

    Quote Originally Posted by Mike_R View Post
    Change your hatch command to this:
    Code:
    (command "._-HATCH" "P" "MUDST" 20 "0" "A" "A" "Y" "" "S" ent1 "" "")
    This forces the command-line version of hatch to run, where you can specify whether or not it should be associative. The usual lisp version of hatch is extremely old and therefore doesn't give you the option.

    Cheers!

    It doesn't work on my 2005 Mechanical as the command prompt returns the following:

    Command: ._-HATCH Unknown command "-HATCH". Press F1 for help.

    Command: P Unknown command "P". Press F1 for help.

    Command: MUDST Unknown command "MUDST". Press F1 for help.

    Command: 20

    Command: 0 Unknown command "0". Press F1 for help.

    Command: A Unknown command "A". Press F1 for help.

    Command: A Unknown command "A". Press F1 for help.

    Command: Y Unknown command "Y". Press F1 for help.

    Command: SD Unknown command "SD". Press F1 for help.

    Command: S Unknown command "S". Press F1 for help.

    Command: <Entity name: 7ED79A58>


    NOTE: "SD" is my routine command.




    And your suggestion may not work for the old versions, ie 2005 Mechanical.

    I tried to understand what you said & did a test:

    Firstly, I set HPASSOC to 1 in command line.
    Then enter "-H" and select a rectangle. It does a hatch.

    If I check the hatch it will tell me it is a nonassociative hatch!

    Now, I know the one I did below can only create a nonassociative hatch.
    (command "_hatch" "MUDST" 20 "0" ent1 "")

    Is it what you mean?
    Last edited by BoKirra; 2007-10-19 at 01:55 AM.

  6. #6
    100 Club
    Join Date
    2006-11
    Location
    UTAH
    Posts
    135
    Login to Give a bone
    0

    Default Re: How to Write LISP Routine Drawing Associative Hatch Pattern?

    Okay, as it turns out, "-HATCH" apparently isn't recognizable in 2005, so this time I checked with 2002 and realized that it has to be "._-BHATCH"... So change it to this:
    Code:
    (command "._-BHATCH" "P" "MUDST" 20 "0" "A" "A" "Y" "" "S" ent1 "" "")
    Replace it with that and it should work this time. Sorry about that.

    Cheers!

  7. #7
    AUGI Addict
    Join Date
    2006-04
    Location
    (getpoint "Anywhere on the Enter Key =>")
    Posts
    1,160
    Login to Give a bone
    0

    Default Re: How to Write LISP Routine Drawing Associative Hatch Pattern?

    Quote Originally Posted by Mike_R View Post
    Okay, as it turns out, "-HATCH" apparently isn't recognizable in 2005, so this time I checked with 2002 and realized that it has to be "._-BHATCH"... So change it to this:
    Code:
    (command "._-BHATCH" "P" "MUDST" 20 "0" "A" "A" "Y" "" "S" ent1 "" "")
    Replace it with that and it should work this time. Sorry about that.

    Cheers!

    It's Great! Thank you very much!

    Thing that I wish to learn is the reason you use "." and "_" at the front of the command.

    Thanks again, Mike



    Ke

  8. #8
    100 Club
    Join Date
    2006-11
    Location
    UTAH
    Posts
    135
    Login to Give a bone
    0

    Default Re: How to Write LISP Routine Drawing Associative Hatch Pattern?

    The "_" is to tell AutoCAD to translate the following command into whatever the local language of the user is. Most of the time it's in English, but sometimes it's Polish, German, etc.

    The "." is to tell AutoCAD to use the built-in version of the command, even if it's been undefined previously. It just insures that no other customization gets in the way of the program running as it should.

  9. #9
    AUGI Addict
    Join Date
    2006-04
    Location
    (getpoint "Anywhere on the Enter Key =>")
    Posts
    1,160
    Login to Give a bone
    0

    Default Re: How to Write LISP Routine Drawing Associative Hatch Pattern?

    Quote Originally Posted by Mike_R View Post
    The "_" is to tell AutoCAD to translate the following command into whatever the local language of the user is. Most of the time it's in English, but sometimes it's Polish, German, etc.

    The "." is to tell AutoCAD to use the built-in version of the command, even if it's been undefined previously. It just insures that no other customization gets in the way of the program running as it should.

    Thanks for your help.

  10. #10
    100 Club
    Join Date
    2006-11
    Location
    UTAH
    Posts
    135
    Login to Give a bone
    0

    Default Re: How to Write LISP Routine Drawing Associative Hatch Pattern?

    Anytime ke.

Similar Threads

  1. 2013: LISP Routine for adding Coords / Leader / Northing + Easting to Drawing
    By Wayne.Tappe in forum AutoCAD General
    Replies: 1
    Last Post: 2013-12-11, 02:10 PM
  2. Replies: 2
    Last Post: 2012-04-02, 02:33 PM
  3. Replies: 10
    Last Post: 2009-06-04, 03:53 PM
  4. Selecting Associative Hatch also selects Hatch Boundary
    By gadjet in forum AutoCAD General
    Replies: 4
    Last Post: 2006-08-11, 07:14 PM
  5. Write a LISP routine to enhance the revcloud command
    By melissa.j.seidel in forum AutoLISP
    Replies: 7
    Last Post: 2005-11-14, 06:08 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
  •