Offset command pixel dependent?

Discussion in 'AutoCAD' started by Fatfreek, Nov 13, 2004.

  1. Fatfreek

    Fatfreek Guest

    I thought I finally had it. I've been following the many threads here on
    how to determine (absolutely) some point within a closed polyline. Well I
    believe I found the scheme and I see no flaws -- but that's not my thought
    My thought is that once I developed the scheme (which I'll outline below),
    the offset command may or may not work depending on the quality of the
    display. Like the Boundary command it appears that the Offset command is,
    indeed, dependent on the display. The closed polylines that I wished to
    offset inwards at times are so small, relative to the current display zoom,
    that the offset goes Outside instead of Inside. Has anyone else come to
    these conclusions?
    Oh, and here is my scheme for determining a point Inside a closed polyline,
    irregardless of its irregular shape.

    Hatch the polyline using Ansi31, to an angle of 135 (horizontal).
    Explode the hatch, resulting in "loose" lines.
    Extract the data from one of the lines (entget (entlast))
    Calculate half the length of that line and deduce the midpoint of it.
    That point is, of course, inside the closed polyline.
    Erase the hatch lines since they're no longer needed.

    Finally, use that point as the Offset direction pickpoint, which doesn't
    always work because of display dependence. Or, is my conclusion wrong?

    Len Miller
    Fatfreek, Nov 13, 2004
  2. Fatfreek

    Joe Burke Guest


    We can't know what's going on without seeing your code. For instance, are you using
    (command "offset"... ) and if so, is osnap turned off? If the answers to those
    questions are yes and no, expect unpredictable results.

    An alternative: the Active X Offset method, where osnap on/off wouldn't matter.

    Your method for determining point inside a pline sounds less than ideal to me. Others
    have posted better methods. For instance, John Uhden's @cv_inside function.

    Joe Burke
    Joe Burke, Nov 14, 2004
  3. Fatfreek

    Fatfreek Guest

    No, osnap is turned off. Yes, I am using (command "offset"... ). I
    remember looking for a VL equivalent but my inexperience left me with an
    empty find. What is it?
    Fatfreek, Nov 14, 2004
  4. Fatfreek

    Fatfreek Guest

    I have found generous examples on this forum for vla-offset thanks to Google
    and no thanks to help within the 2005 Vlide.

    I will now be looking, and I'm sure I'll find it, examples of how to make
    consistent the direction of closed polylines, because their offset (inside
    or outside) appears to be dependent on that.
    Fatfreek, Nov 15, 2004
  5. Fatfreek

    Alaspher Guest

    Try it:
    (defun is-lwpoly-clock (lwpl / pnts angl)
    (setq pnts (mapcar (function cdr)
    (lambda (a) (= (car a) 10))
    (entget lwpl)
    angl (mapcar (function angle)
    (cons (last pnts) pnts)
    (minusp (apply (function +)
    (mapcar (function
    (lambda (b)
    (cond ((< (abs b) pi) b)
    ((minusp b) (+ (* 2 pi) b))
    (t (+ (* -2 pi) b))
    (mapcar (function -)
    (cons (last angl) angl)
    (is-lwpoly-clock (car (entsel)))
    Alaspher, Nov 15, 2004
  6. Fatfreek

    Fatfreek Guest

    Thanks for sharing. I will certainly look your code over to see whether I
    should use my kluge or yours, which looks elegant. My kluge:
    (vlax-ename->vla-object (handent MinorItem))
    (* OffsetValue 1) ;_inside is goal
    (setq EntName (handent MinorItem))
    (setq ObjPrior (vlax-ename->vla-object EntName)
    AreaPrior (vlax-curve-getArea ObjPrior)
    (setq ObjAfter (vlax-ename->vla-object (entlast))
    AreaAfter (vlax-curve-getArea ObjAfter)
    (if (> AreaAfter AreaPrior)
    (entdel (entlast))
    (vla-offset ObjPrior (* OffsetValue -1))
    Fatfreek, Nov 15, 2004
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.