lisp routine for this?

Discussion in 'AutoCAD' started by cadd_monkey, Apr 21, 2004.

  1. cadd_monkey

    cadd_monkey Guest

    i'm wondering if there is a lisp routine that would trace 1 polyline around a group of circles? say you have 7 circles together crossing one another and i would like to select those circles then let the lisp routine draw a path around the "outside" edge of them.

    any ideas? we use to use landcadd for some small stuff and it had this function but for the life of me i could not pull it out of the software.

    thanks all
    JC
     
    cadd_monkey, Apr 21, 2004
    #1
  2. I don't know about a Lisp routine, but you get a similar result by using the
    REGION command to turn the circles into regions, and then the UNION command
    to join them together into one region, which has the
    outside-edges-of-the-collected-circles as its boundary. Maybe that will do
    what you want.

    Kent Cooper, AIA

    around a group of circles? say you have 7 circles together crossing one
    another and i would like to select those circles then let the lisp routine
    draw a path around the "outside" edge of them.
    function but for the life of me i could not pull it out of the software.
     
    Kent Cooper, AIA, Apr 21, 2004
    #2
  3. cadd_monkey

    cadd_monkey Guest

    thanks kent, will try that out

    JC
     
    cadd_monkey, Apr 22, 2004
    #3
  4. cadd_monkey

    cadd_monkey Guest

    k that works kinda like i need it to. forgot to say the circles i'm needing to do this too are blocks. (landscape architect work), so i guess thats why i would need a lisp routine. i could trace them all with a circle i suppose. but a lisp routine would be ideal.


    thanks again

    JC
     
    cadd_monkey, Apr 22, 2004
    #4
  5. cadd_monkey

    Jeff Mishler Guest

    Post a small sample file which includes the blocks placed as you'd normally
    find them and I'll take a look at it.

    Jeff

    needing to do this too are blocks. (landscape architect work), so i guess
    thats why i would need a lisp routine. i could trace them all with a circle
    i suppose. but a lisp routine would be ideal.
     
    Jeff Mishler, Apr 22, 2004
    #5
  6. cadd_monkey

    Jeff Mishler Guest

    OK, give this a whirl.

    It can still be modified to return plines if needed, rather than the region
    object it does now.

    Sorry about the formatting, that's vlide for ya. I didn't want to save the
    file & zip since I'd like anyone that wants to to comment.

    Jeff

    ;| Function to 'trace' the boundary of a group of circles
    contained within blocks. Returns a region in the color
    red.
    by Jeff Mishler April 2004
    |;
    (defun c:circ_trace (/ circarray circlist count ent newents
    new_reg reg1 reglist space ss x)
    ;;derived from input by Luis Esquivel & Doug Broad
    (defun get_space ()
    (if (= 1 (vla-get-activespace *doc*))
    (vla-get-modelspace *doc*);we're in modelspace
    (if (= (vla-get-mspace *doc*) :vlax-true)
    (vla-get-modelspace *doc*);we're in modelspace
    ;thru paperspace VPort
    (vla-get-paperspace *doc*);we're in paperspace
    )
    )
    )
    (if (or (setq ss (ssget "I" '((0 . "INSERT"))))
    (setq ss (ssget '((0 . "INSERT"))))
    )
    (progn
    (setq space (get_space)
    count -1)
    (while (< (setq count (1+ count)) (sslength ss))
    (setq ent (vlax-ename->vla-object (ssname ss count)))
    (setq newents (vlax-safearray->list
    (vlax-variant-value (vla-explode ent))))
    (foreach x newents
    (if (= (vla-get-objectname x) "AcDbCircle")
    (setq circlist (cons x circlist))
    (vla-delete x);delete if not a circle
    )
    )
    )
    (if circlist
    (progn
    (setq circarray (vlax-safearray-fill
    (vlax-make-safearray
    vlax-vbobject
    (cons 0 (1- (length circlist))))
    circlist)
    new_reg (vlax-invoke-method space "addregion" circarray)
    )
    (mapcar 'vla-delete circlist);delete temp circles
    (setq reglist (vlax-safearray->list
    (vlax-variant-value new_reg))
    reg1 (car reglist)
    reglist (cdr reglist))
    (mapcar '(lambda (x)
    (vla-boolean reg1 acunion x))
    reglist)
    (vla-put-color reg1 acred)
    )
    )
    )
    )
    (princ)
    )
     
    Jeff Mishler, Apr 22, 2004
    #6
  7. Another line of thought.....

    Place another circle or shape around ALL the circles
    giving yourself enough free space around the circles.

    Then use the boundary command and pick the point
    in between the two groups of entities.

    Works fine.

    HTH
    Andrew McDonald



    around a group of circles? say you have 7 circles together crossing one
    another and i would like to select those circles then let the lisp routine
    draw a path around the "outside" edge of them.
    function but for the life of me i could not pull it out of the software.
     
    Andrew McDonald, Apr 22, 2004
    #7
  8. cadd_monkey

    Jeff Mishler Guest

    Shoot, I forgot to add a little code snip that I don't need but you
    may/will. Add these to the code just prior to the commented line of
    ";derived from input......"

    (vl-load-com)
    (or *doc* (setq *doc* (vla-get-activedocument
    (vlax-get-acad-object))))
     
    Jeff Mishler, Apr 22, 2004
    #8
  9. cadd_monkey

    cadd_monkey Guest

    jeff,

    i can't thank you enough!!!!

    when i get some spare time today after some modeling i have to do i will pull all that in and give it a try. this will be the best lisp routine i have to use!!!!

    again thank you!!!

    JC
     
    cadd_monkey, Apr 23, 2004
    #9
  10. cadd_monkey

    cadd_monkey Guest

    too many plants to go through the drawing and do that for every grouping, thanks tho just would be to much time.

    JC
     
    cadd_monkey, Apr 23, 2004
    #10
  11. cadd_monkey

    btlsp Guest

    btlsp, Apr 23, 2004
    #11
  12. cadd_monkey

    cadd_monkey Guest

    thanks jeff!!!! from me and my intire office, there going crazy over here...lol

    thanks again your a life saver!

    JC
     
    cadd_monkey, Apr 23, 2004
    #12
  13. cadd_monkey

    Jeff Mishler Guest

    You're welcome! I'm glad it does what you want and that you can put it to
    use.

    Jeff
     
    Jeff Mishler, Apr 23, 2004
    #13
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.