BHATCH PROBLEM

Discussion in 'AutoCAD' started by Bob Quinn, Aug 4, 2004.

  1. Bob Quinn

    Bob Quinn Guest

    I am attempting to use the -bhatch command from within an autolisp
    application. I am specifying a picked internal point with the routine.
    If zoomed in close to the feature when the routine runs, everything works
    fine, but if zoomed out a little bit it does not hatch the area, and
    returns an error "Point is directly on an object." which it is not.... Any
    thoughts? Thanks for your help!! :)
     
    Bob Quinn, Aug 4, 2004
    #1
  2. Bob Quinn

    Tom Smith Guest

    I believe that even though you're feeding it a point, the command treats it
    as it would if you manually picked it -- if you're too far away to get your
    pickbox inside the area , it says the point is on an object. Try setting
    pickbox=0 in your routine.
     
    Tom Smith, Aug 4, 2004
    #2
  3. Bob Quinn

    Dean McCarns Guest

    Bob;

    You need to change your OSNAPCOORD variable to 1 in your routine before
    selecting point in a LISP command. The reason being is this variable
    controls the priority for coordinate data entry and the default is "Keyboard
    entry except scripts" and LISP is considered a script in this situation.
    Setting the variable to 1 sets the "Keyboard entry" option.

    If you go into the options dialog under User Preferences
    (Tools->Options/->User Preferences) you will see the three settings in the
    "Priority for Coordinate Data Entry". OSNAPCOORD controls this setting.

    So whenever I am creating a routine that involves picking points (especially
    if I am using the COMMAND function) I do the following:

    (defun c:SomeCommand ( / *Error* iOldCord)

    (defun *Error* (msg)
    ....error handling
    (if iOldCord
    (setvar "OSNAPCOORD" iOldCord) <--- sets setting back to
    original
    )
    value in case of error
    (gc)
    (princ)
    )

    (setq iOldCord (getvar "OSNAPCOORD")) <--- Saves the current setting
    (setvar "OSNAPCOORD" 1) <--- Changes setting to keyboard entry
    .....function LISP
    (command ...some command script info)
    .....function LISP
    (setvar "OSNAPCOORD" iOldCord) <--- Sets setting back to original value
    (princ)
    )

    Good luck Bob.

    (p.s. watch the word wrap)
     
    Dean McCarns, Aug 4, 2004
    #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.