text inside of a circle

Discussion in 'AutoCAD' started by FELIPE, Jan 12, 2005.

  1. FELIPE

    FELIPE Guest

    Does anyone out there have a routine that centers selected text to the center of a circle.
     
    FELIPE, Jan 12, 2005
    #1
  2. FELIPE

    Walt Engle Guest

    Why not justify to center and use center of circle?
     
    Walt Engle, Jan 12, 2005
    #2
  3. FELIPE

    T.Willey Guest

    Just make your text justified to middle, then move it from the insertion point to the center point. If you want to make it faster, only turn on those two options of the running osnaps.

    Tim
     
    T.Willey, Jan 12, 2005
    #3
  4. FELIPE

    ECCAD Guest

    Here is a quick one.
    ;; Center Text to Circle
    ;; CT.lsp
    (defun C:CT ( / ent cent ss txt )
    (prompt "\nPick Circle:")
    (setq ss (ssget))
    (if ss
    (progn
    (setq ent (entget (ssname ss 0))); get Circle entity
    (setq cent (cdr (assoc 10 ent))); get Center point
    (prompt "\nPick a Single Line of Text")
    (setq ss nil)
    (setq ss (ssget))
    (if ss
    (progn
    (setq ent (entget (ssname ss 0))); get the Text Entity
    (setq txt (cdr (assoc 1 ent))); get the Value of the Text
    (if txt
    (progn
    (command "_erase" ss ""); remove old text
    (command "_text" "m" cent "" "" txt); insert new text
    ); progn
    ); if
    ); progn
    ); if
    ); progn
    ); if
    (princ)
    ); function
     
    ECCAD, Jan 12, 2005
    #4
  5. FELIPE

    Tom Smith Guest

    I tend toward the simple approach, middle justify the text and snap to
    center of circle.

    If this happens frequently, I'd make the circle and text an attributed
    block. Place the block and edit the attribute.
     
    Tom Smith, Jan 12, 2005
    #5
  6. FELIPE

    FELIPE Guest

    Sorry Bob,
    I guess I don't know how to use this routine.
    I tried to select the circle and the text, and then the text string again and the text disappeared.
     
    FELIPE, Jan 12, 2005
    #6
  7. Try it.
    Move text polygon...
    Justify text to Middle Center and move to centroid of polygon.
    (circle, rectangle).

    []s,

    Rogério

    ;;;MIDDLECENTER JUSTIFY AND MOVE TEXT TO CENTROID - BEGIN

    (defun C:MTP (/ ENT ELST PTS SS1 OLDOSM INS TXT EI p1 p2 p3 p4)
    (setvar "cmdecho" 0)
    (command "STYLE" "STANDARD" "verdana" "0" "1" "0" "N" "N");;optional
    (setq OLDOSM (getvar "osmode"))
    (SETQ TXT (ENTSEL "\n Pick only text to move to center to Polygon:"));LOCALIZAÇÃO DE INSERÇÃO DE TEXTO SELECIONADO
    ;(SETQ INS (OSNAP (CADR TXT) "INSERT"));PONTO DE INSERÇÃO
    (setq ET (cdr(assoc 0(entget(car TXT)))));;TYPE: TEXT
    (SETQ EL (cdr(assoc 8(entget(car TXT)))));;LAYER
    (SETQ EI (cdr(assoc 10(entget(car TXT)))));;PONTO DE INSERÇÃO
    (SETQ EH (cdr(assoc 40(entget(car TXT)))));;ALTURA
    (SETQ EA (cdr(assoc 50(entget(car TXT)))));;ÂNGULO DO TEXTO?
    (SETQ TS (cdr(assoc 1(entget(car TXT)))));;TEXT STRING
    (setvar "clayer" EL)
    (COMMAND "ERASE" "SI" TXT)
    (COMMAND "TEXT" "MC" EI EH EA TS)
    (COMMAND "MOVE" (ENTLAST) "" (CDR (ASSOC 10 (ENTGET (ENTLAST)))) EI )
    (COMMAND "CHANGE" "last" "" "P" "C" "1" "" )
    (setvar "osmode" 0)
    ;================================================
    (princ "\n Get Centroid...")
    (if (setq Curent (car (entsel "\n Select a closed Polyline (Polygon): ")))
    (progn
    (setq OldCmd (getvar "CMDECHO"))
    (setvar "CMDECHO" 0)
    (command "_.COPY" CurEnt "" '(0 0 0) '(0 0 0)
    "_.REGION" (entlast) ""
    )
    (setq RegObj (vlax-ename->vla-object (entlast)))
    (vla-GetBoundingBox RegObj 'MinPnt 'MaxPnt)
    (setq MinPnt (vlax-safearray->list MinPnt)
    OriCen (vlax-safearray->list
    (vlax-variant-value
    (vla-get-Centroid RegObj)
    )
    )
    CurCen (mapcar '- OriCen MinPnt)
    )
    (vla-Erase RegObj)
    (mapcar 'princ (list "\n Relative centroid: " CurCen))
    (mapcar 'princ (list "\n Absolute centroid: " OriCen))
    (setvar "CMDECHO" OldCmd)
    )
    )
    (COMMAND "CHANGE" "last" "" "P" "C" "bylayer" "" )
    (command "change" (ENTLAST) "" "" OriCen "" "" "" "")
    (setvar "osmode" OLDOSM)
    (princ "\n Done!")
    (princ)
    )
    ;;;MIDDLECENTER JUSTIFY AND MOVE TEXT TO CENTROID - BEGIN
     
    Rogerio_Brazil, Jan 12, 2005
    #7
  8. To set text height and don´t modify your text style:

    (command "STYLE" "STANDARD" "" "0" "1" "0" "N" "N")
     
    Rogerio_Brazil, Jan 12, 2005
    #8
  9. FELIPE

    ECCAD Guest

    Just pick the Circle (only), hit Enter Key, then, pick the text
    when prompted.
    Bob
     
    ECCAD, Jan 12, 2005
    #9
  10. Felipe,

    I wrote something about centering a letter/s in a circle. Like change letter balloons. This file was in CADalyst.

    Look in autodesk.autocad.customer-files. centerit.lsp Hope it works the way you want. It changes the justification to center, and
    then moves it to the center of the circle. One click.

    W. Kirk Crawford
    Rochester Hills, Michigan
     
    W. Kirk Crawford, Jan 12, 2005
    #10
  11. Tom,

    Your way is, I believe, The Proper Way.

    But where I work, just get it done.

    W. Kirk Crawford
    Rochester Hills, Michigan
     
    W. Kirk Crawford, Jan 12, 2005
    #11
  12. FELIPE

    Tom Smith Guest

    Kirk, he didn't explain the application, but I was thinking of something
    like a column grid bubble. Just takes a sec to define an attributed block,
    then forever after it's faster to place than drawing individual circles and
    placing text inside. If it's anything like that, I'd prefer to have the
    thing as a single entity anyway, rather than two.
     
    Tom Smith, Jan 13, 2005
    #12
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.