hatch problem

Discussion in 'AutoCAD' started by jlspartz, Mar 22, 2005.

  1. jlspartz

    jlspartz Guest

    I have a ceiling grid program that makes a hatch pattern and then shifts the hatch pattern whichever direction you want by how much you want.

    Well, it seems like when shifting the grid sometimes instead of shifting the hatch 12 inches like planned, it will shift it 3.5 or so, until the hatch line is straight up against the side of the wall. And it won't let me shift it anymore horizontally, but it will let me shift vertically, and when I do that, it also shifts it the remaining 8.5 inches horizontally that it didn't before.

    It seems either AutoCAD is being cute and thinking it's helping me out by aligning it along the wall, or it's because I am accepting intergers and then tieing them into reals. Could that be the problem? Here is the code:

    (cond
    ((= choose-repos "S")
    (cond
    ((= gridsize "1")
    (setq defshift-h "6")
    (setq defshift-v "6")
    )
    ((= gridsize "2")
    (setq defshift-h "12")
    (setq defshift-v "12")
    )
    ((= gridsize "3")
    (setq defshift-h "24")
    (setq defshift-v "12")
    )
    ((= gridsize "4")
    (setq defshift-h "12")
    (setq defshift-v "24")
    )
    )
    (while
    (and
    (not (initget "H V D"))
    (setq hvd (getkword "\nHorizontally/Vertically? [H/V] <Done>: "))
    (/= hvd "D")
    )
    (cond
    ((= hvd "H")
    (setq shift-h (getint (strcat "\nEnter distance to shift grid horizontally <" defshift-h ">: ")))
    (if (= shift-h nil)(setq shift-h (atoi defshift-h)))
    (setq ang-h (+ (angtof ang) (DTR 0)))
    (setq center (polar center ang-h shift-h))
    (command "hatchsetorigin" "last" "" center)
    (setq shift-h nil)
    )
    ((= hvd "V")
    (setq shift-v (getint (strcat "\nEnter distance to shift grid vertically <" defshift-v ">: ")))
    (if (= shift-v nil)(setq shift-v (atoi defshift-v)))
    (setq ang-v (+ (angtof ang) (DTR 90)))
    (setq center (polar center ang-v shift-v))
    (command "hatchsetorigin" "last" "" center)
    (setq shift-v nil)
    )
    )
    )
    )
     
    jlspartz, Mar 22, 2005
    #1
  2. jlspartz

    ECCAD Guest

    Just a guess.
    In top of routine do:
    (setq OSM (getvar "osmode"))
    .......
    and, at exit..do:
    (if OSM (setvar "osmode" OSM))

    Perhaps Osnap is getting in the way ?

    Bob
     
    ECCAD, Mar 22, 2005
    #2
  3. jlspartz

    jlspartz Guest

    That was it! Your a life saver! Something as simple as that! I can't believe it.

    I captured the osnap variable, set it to 0, and reset it at the end. Then I captured the osnaphatch variable, set it to 0, and reset it at the end. And now everything works as intended.
     
    jlspartz, Mar 22, 2005
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.