Looking For A Routine

Discussion in 'AutoCAD' started by Tim, Apr 28, 2004.

  1. Tim

    Tim Guest

    Hi guys/gals
    Hoping somebody already has a routine that does what I am looking for.
    Need something that will allow me to offset polylines/lines/arcs on either
    side with a specified distance
    and draw caps on either end making the final product a hollow line siutable
    for hand coloring of solid fills,

    Have already tried to create a linetype to do that...works until you have to
    do a curve..not a pretty site there.

    So if somebody already has one I would rather not try and recreate the wheel
    if possible

    Thanks

    Tim Wilson
     
    Tim, Apr 28, 2004
    #1
  2. Tim

    ECCAD Guest

    Tim,
    You might want to search for 'offset'. Many routines dealing with this topic here. You might find one suitable that you could 'tune' for the end-caps.

    Bob
     
    ECCAD, Apr 28, 2004
    #2
  3. Tim

    TCEBob Guest

    This is hasty programming at its worst, but it works. Only for lines and
    arcs right now but if you want it and send a certified check for $10,000
    I'll expand it. Ok, forget the check.

    (defun c:eek:cap( / odist orig oside ori ori10 ori11
    clone clo clo10 clo11) ;offset and cap
    (setq odist(getreal "\nSpecify offset distance: "))
    (setq orig(entsel "\nSpecify object to offset: "))
    (redraw (car orig) 3)
    (setq oside(getpoint "\nSpecify point on side to offset: "))
    (command "offset" odist orig oside "") ;resets the higlight
    automatically
    (setq ori(entget(car orig)))
    (setq ori10(cdr(assoc 10 ori))
    ori11(cdr(assoc 11 ori)))
    (setq clone(entget(entlast))) ;the new offset object
    (setq clo10(cdr(assoc 10 clone))
    clo11(cdr(assoc 11 clone)))
    (command "line" ori10 clo10 "")
    (command "line" ori11 col11 "")
    (princ))
     
    TCEBob, Apr 28, 2004
    #3
  4. Tim

    Tim Guest

    You will have to upload it as a zip file..firewall thing you know

    Thanks

    Tim
     
    Tim, Apr 28, 2004
    #4
  5. Tim

    Tim Guest

    For whatever reson it only closes 1 side..

    Thanks

    Tim
     
    Tim, Apr 28, 2004
    #5
  6. Tim

    Joe Burke Guest

    Tim,

    I haven't looked at what Mike posted. This might work.

    Joe Burke

    ;; 4/28/2004
    ;; outline lines, arcs or lwplines
    (defun c:demo ( / doc mspace dist obj1 coord p1 p2
    obj2 p3 p4 sp1 ep1 sp2 ep2 )
    (setq doc
    (vla-get-ActiveDocument
    (vlax-get-acad-object)))
    (setq mspace (vla-get-ModelSpace doc))
    (setq dist (getdist "\nEnter offset distance: "))
    (ssget (list (cons 0 "LINE,ARC,LWPOLYLINE")))
    (vlax-for x (vla-get-activeselectionset doc)
    (if (= "AcDbPolyline" (vlax-get x 'ObjectName))
    (progn
    (setq obj1 (car (vlax-invoke x 'offset dist)))
    (setq coord (vlax-get obj1 'Coordinates))
    (setq p1 (list (car coord) (cadr coord) 0.0))
    (setq coord (reverse coord))
    (setq p2 (list (cadr coord) (car coord) 0.0))
    (setq obj2 (car (vlax-invoke x 'offset (- dist))))
    (setq coord (vlax-get obj2 'Coordinates))
    (setq p3 (list (car coord) (cadr coord) 0.0))
    (setq coord (reverse coord))
    (setq p4 (list (cadr coord) (car coord) 0.0))
    (vlax-invoke x 'Delete)
    (vlax-invoke mspace 'AddLine p1 p3)
    (vlax-invoke mspace 'AddLine p2 p4)
    )
    (progn ;line or arc
    (setq obj1 (car (vlax-invoke x 'offset dist)))
    (setq sp1 (vlax-get obj1 'StartPoint))
    (setq ep1 (vlax-get obj1 'EndPoint))
    (setq obj2 (car (vlax-invoke x 'offset (- dist))))
    (setq sp2 (vlax-get obj2 'StartPoint))
    (setq ep2 (vlax-get obj2 'EndPoint))
    (vlax-invoke x 'Delete)
    (vlax-invoke mspace 'AddLine sp1 sp2)
    (vlax-invoke mspace 'AddLine ep1 ep2)
    )
    )
    )
    (princ)
    ) ;end
     
    Joe Burke, Apr 28, 2004
    #6
  7. Tim

    doug k Guest

    OE doesn't like halo.vlx.dat

    don't know why there is a ".dat" in there.
     
    doug k, Apr 28, 2004
    #7
  8. Tim

    Tim Guest

    Thats perfect Joe thank you

    Thanks to all the others who put together something on the fly..

    These fast responses and the knowledge of the various posters on these
    newsgroups are the reasons why I come here first for a solution or an
    answer.

    Thanks Again

    Tim Wilson
     
    Tim, Apr 28, 2004
    #8
  9. Tim

    Tim Guest

    Exactly

    It didnt like the dat extension that was added.

    Tim
     
    Tim, Apr 28, 2004
    #9
  10. Tim

    TCEBob Guest

    Shoot, nobody's perfect.

    Try this

    (defun c:eek:cap( / odist orig oside ori ori10 ori11
    clone clo clo10 clo11) ;offset and cap
    (setq odist(getreal "\nSpecify offset distance: "))
    (setq orig(entsel "\nSpecify object to offset: "))
    (redraw (car orig) 3)
    (setq oside(getpoint "\nSpecify point on side to offset: "))
    (command "offset" odist orig oside "") ;resets the higlight
    automatically
    (setq ori(entget(car orig)))
    (setq ori10(cdr(assoc 10 ori))
    ori11(cdr(assoc 11 ori)))
    (setq clone(entget(entlast))) ;the new offset object
    (setq clo10(cdr(assoc 10 clone))
    clo11(cdr(assoc 11 clone)))
    (command "line" ori10 clo10 "")
    (command "line" ori11 clo11 "") ;REVISED LINE
    (princ))

    RS
     
    TCEBob, Apr 28, 2004
    #10
  11. Tim

    Joe Burke Guest

    Tim,

    You're welcome. I hope I didn't step on Mike's toes.

    BTW, you might want to add some layer control. As is, the new "cap" lines are drawn
    on the active layer. But the offset objects are placed on the source object layer. It
    might make sense to put all new objects on the active layer, or some new layer.

    Joe Burke
     
    Joe Burke, Apr 28, 2004
    #11
  12. Tim

    Jamie Duncan Guest

    It didn't like dat extension?

    Jamie Duncan
     
    Jamie Duncan, Apr 28, 2004
    #12
  13. Tim

    Mike Weaver Guest

    I don't know where the dat extension came from. Hopefully the zip file
    works better for you.

    Mike
     
    Mike Weaver, Apr 28, 2004
    #13
  14. Tim

    Mike Weaver Guest

    My toes are fine:)

    When i post something I understand not everyone will find it useful.

    Halo is a variation on another routine I use, so it isn't like I spent a
    bunch of time putting it together.

    Mike
     
    Mike Weaver, Apr 28, 2004
    #14
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.