See the top rated post in this thread. Click here

Results 1 to 8 of 8

Thread: Draw 2circles from 1 center point

  1. #1
    Login to Give a bone
    0

    Default Draw 2circles from 1 center point

    Hi to All,
    I am looking for a lisp;
    Get 2radius by selecting text and Draw 2circles from 1 center point.
    An explanation image attaching here:
    Thanks in advance
    Attached Images Attached Images

  2. #2
    I could stop if I wanted to
    Join Date
    2004-11
    Location
    Somewhere close to hell
    Posts
    228
    Login to Give a bone
    0

    Default Re: Draw 2circles from 1 center point

    Try this:

    Code:
    (defun c:dbl ()
      (setq rad1 (getstring "\n First Radius "))
      (setq rad2 (getstring "\n Second Radius "))
      (setq cntr (getpoint "\n Select Center Point "))
      (if (/= cntr nil)
        (progn
      (command ".circle" cntr rad1)
      (command ".circle" cntr rad2)
      )
        )
      
      )
    Hope this helps!
    Rob

  3. #3
    I could stop if I wanted to
    Join Date
    2004-11
    Location
    Somewhere close to hell
    Posts
    228
    Login to Give a bone
    0

    Default Re: Draw 2circles from 1 center point

    oops, guess it would help if I wasn't asleep.
    I forgot you want to select text.

    Are your labels text or attributes?
    Rob

  4. #4
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    1

    Default Re: Draw 2circles from 1 center point

    Here is something for you to start with, but it do not treat stupid text
    Code:
    (defun c:2c (/ Ent1 Ent2 Pkt1 )
      (if
        (and
          (setq Ent1 (car (entsel "Select text: " )) )
          (not (redraw Ent1 3 ))
          (setq Ent2 (car (entsel "Select text: " )) )
          (not (redraw Ent2 3 ))
          (setq Pkt1 (getpoint "Select point "     ) )
        )
        (progn
          (if (and (= (cdr (assoc 0 (entget Ent1 ))) "TEXT" ) (= (cdr (assoc 0 (entget Ent2 ))) "TEXT" ) )
            (progn ; Here can be a lot of pain, text can be 15 15.2 15,2 15Kg and so on, and the only legal type is 15.2 or 15
              (if (or (= 0.0 (atof (cdr (assoc 1 (entget Ent1 ))))) (= 0.0 (atof (cdr (assoc 1 (entget Ent2 ))))) )
                (alert "One of the text generate a 0 radius \n                     Quitting !" )
                (progn
                  (command "._circle" Pkt1 (atof (cdr (assoc 1 (entget Ent1 )))) )
                  (command "._circle" Pkt1 (atof (cdr (assoc 1 (entget Ent2 )))) )
                )
              )
            )
            (princ " wrong object type " )
          )
        )
        (princ "not enough input" )
      )
      (redraw Ent1 4 )
      (redraw Ent2 4 )
      (princ)
    )
    : ) Happy Computing !

    kennet
    Last edited by kennet.sjoberg; 2005-09-22 at 10:09 PM.

  5. #5
    Login to Give a bone
    0

    Default Re: Draw 2circles from 1 center point

    thanks kennet..it works..well done..

    thanks Rob..your dbl.lsp also works.. is it posible to Fetch value from attributes to circle command?

    xp5

  6. #6
    All AUGI, all the time CAB2k's Avatar
    Join Date
    2016-01
    Location
    Brandon, Florida
    Posts
    687
    Login to Give a bone
    0

    Default Re: Draw 2circles from 1 center point

    kennet,
    You may be better off changing this
    Code:
    (if (or (= 0.0 (atof (cdr (assoc 1 (entget Ent1 ))))) (= 0.0 (atof (cdr (assoc 1 (entget Ent2 ))))) )
    to this, as the distof is more forgiving.
    Code:
    (if (or (= 0.0 (distof (cdr (assoc 1 (entget Ent1 ))))) (= 0.0 (distof (cdr (assoc 1 (entget Ent2 ))))) )

  7. #7
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Draw 2circles from 1 center point

    Quote Originally Posted by ab2draft
    You may be better off changing ...to this, as the distof is more forgiving.
    Yes, correct ab2draft, but as a say
    Quote Originally Posted by kennet.sjoberg
    Here is something for you to start with...
    Actually I do not simply use atof or distof my self, ( I am not so forgiving )
    I use a subroutine that check the string from the first character until a space (if it exist)
    then check if that part is made of legal characters "0-9" "+" "-" "." and ","
    replace the "," with "." and then check again in different ways to see if the sting is legal.

    : ) Happy Computing !

    kennet

  8. #8
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Draw 2circles from 1 center point

    I was just thinking that we should have a function that acted like an entsel function but allowed the user to include a selection set filter like the ssget function.

    Like this

    The syntax to allow for a single selection of text is:

    (entselwithfilter '(list (cons 0 "text")) "Select text: ")

    Peter Jamtgaard P.E.

    Code:
    (defun entselWithFilter (lstOfFilters strPrompt / ssSelections)
     (vl-load-com)
     (if strPrompt
      (princ (strcat "\n" strPrompt))
     )
     (while (not (setq ssSelections (ssget ":S:E" (eval lstOfFilters))))
      (princ "\nInvalid Selection Please Select Again: ")
     )
     (list (ssname ssSelections 0) (getvar "lastpoint"))
    )
    Attached Files Attached Files
    Last edited by peter; 2005-09-26 at 11:42 AM.

Similar Threads

  1. Routine to draw annotative center marks
    By jpcadconsulting347236 in forum AutoLISP
    Replies: 1
    Last Post: 2014-04-08, 06:10 PM
  2. Draw 2 rectangle / Square from Center Point
    By Orzabal in forum AutoLISP
    Replies: 5
    Last Post: 2012-09-24, 02:01 AM
  3. Replies: 10
    Last Post: 2007-03-23, 01:50 AM
  4. Draw line from known point to unknown point
    By noadea in forum AutoLISP
    Replies: 1
    Last Post: 2007-02-09, 02:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •