Trim around text

Discussion in 'AutoCAD' started by Big 'D', May 5, 2004.

  1. Big 'D'

    Big 'D' Guest

    I am just learning lisp and having some difficulty dedicating the time I need to. In the mean time I have these great ideas and do not know how to implement them. Can someone give me some assistance with a routine to trim a line that runs through a selected piece (or pieces) of text? I would like to have the ability to select multiple text in the line and I need to be able to set the trim distance .12 at top and bottom of text (text height is .06). I am frazzled because I cannot figure this out.
    Thanks
     
    Big 'D', May 5, 2004
    #1
  2. Big 'D'

    Walt Engle Guest

    Why not just use Textmask and set the tframe distance?
     
    Walt Engle, May 5, 2004
    #2
  3. Big 'D'

    Big 'D' Guest

    AutoCAD2002 tells me this uses WIPEOUT.ARX, a Bonus Tool needed for this application. Should I retrieve it from previous AutoCAD and load it with 2002?
     
    Big 'D', May 5, 2004
    #3
  4. Big 'D'

    Big 'D' Guest

    I copied the arc file to AutoCAD support directory and got the same response. I am not familiar with tframe. Could you please explain? This is the kind of infomation I am wanting to learn. Thank you so much!
     
    Big 'D', May 5, 2004
    #4
  5. Big 'D'

    Walt Engle Guest

    You should copy ALL of the express from R2000 to R2002 in a new Express folder. Make sure you have your new folder in the File Search Path. Then type MENULOAD at the command line and browse, going to the Express
    folder that you just created. Highlight ACETMAIN.MNU and load it. Then you should have the Express as a pull-down and you will find Textmask under Modify.
     
    Walt Engle, May 5, 2004
    #5
  6. Big 'D'

    Big 'D' Guest

    Walt,
    I appreciate your help. I loaded the Express menu and added it to my path. Most of the Express commands are working. Unfortunately, wipeout is not one of them and textmask does not show up on the pulldown. I will continue to stumble my way through this. If you have any additional comments or suggestions, let me know.
    Thanks again,
    D
     
    Big 'D', May 5, 2004
    #6
  7. Bid D,

    This routine isn't perfect, but see if you can modify it if it doesn't work
    correctly. This is an old R12 routine, so I'm sure there are some cleaner
    ways of doing this, but it might help you.


    (defun C:TEXTTRIM (/ count sstextt textent tb ll ur ul lr tf)
    (setvar "osmode" 0)
    (setq CURRENTLAYER (getvar "CLAYER"))
    (command "_.undo" "Begin")
    (setq SSTEXTT (ssget '((0 . "TEXT"))))
    (setq COUNT 0)
    (if SSTEXTT
    (while (< COUNT (sslength SSTEXTT))
    (setq textent (cdr (car (entget (ssname SSTEXTT COUNT)))))
    (command "_.ucs" "Object" textent)
    (setq tb (textbox (list (cons -1 textent)))
    ll (car tb)
    ur (cadr tb)
    tf (/ (- (cadr ur) (cadr ll)) 6)
    ul (list (- (car ll) tf) (+ (cadr ur) tf))
    lr (list (+ (car ur) tf) (- (cadr ll) tf))
    ll (list (- (car ll) tf) (- (cadr ll) tf))
    ur (list (+ (car ur) tf) (+ (cadr ur) tf))
    )
    (command "_.pline" ll lr ur ul "c")
    (setq TOFFSET (* (distance ll ur) 0.20))
    (command "_.trim"
    (setq THETRIMLINE (entlast))
    ""
    "f"
    ll
    ur
    ""
    ""
    )
    (command "_.erase" THETRIMLINE "")
    (command "_.ucs" "p")
    (setq COUNT (1+ COUNT))
    )
    )
    (command "_.undo" "End")
    (setvar "CLAYER" CURRENTLAYER)
    (princ)
    )

    Bruce

    need to. In the mean time I have these great ideas and do not know how to
    implement them. Can someone give me some assistance with a routine to trim a
    line that runs through a selected piece (or pieces) of text? I would like to
    have the ability to select multiple text in the line and I need to be able
    to set the trim distance .12 at top and bottom of text (text height is .06).
    I am frazzled because I cannot figure this out.
     
    Bruce Sheldon, May 5, 2004
    #7
  8. Big 'D'

    Jürg Menzi Guest

    Big 'D'

    My suggestion:
    - Don't break/trim objects (think on later editing of dwg)...
    - Draw a 3dface at text position -> get 'textbox' -> calculate points ->
    draw '3dface' with invisible edges on extra layer
    - use 'hide' to visualize
    - Sysvar 'SPLFRAME' controls the visibility of the edges
    - Don't forget to set sysvar 'HIDETEXT' to 0 (> A2ki)

    Code samples:
    ;
    ; == Function GetTextBox
    ; Returns the boundingbox information of text.
    ; Arguments [Type]:
    ; Obj = Text object [VLA-OBJECT]
    ; Return [Type]:
    ; > Point list

    • ; Notes:
      ; None
      ;
      (defun GetTextBox (Obj / CosRot GapFac InsAng InsPnt LltPnt SinRot TxtEnt
      UrtPnt)
      (setq TxtEnt (entget (vlax-vla-object->ename Obj))
      InsPnt (vlax-get Obj "InsertionPoint")
      InsAng (vla-get-Rotation Obj)
      GapFac (* (vla-get-Height Obj) 0.3) ;0.3 = Offset factor!!!
      GapFac (sqrt (* (* GapFac GapFac) 2.0))
      SinRot (sin InsAng)
      CosRot (cos InsAng)
      LltPnt (car (textbox TxtEnt))
      UrtPnt (cadr (textbox TxtEnt))
      )
      (list
      (polar
      (list
      (+ (car InsPnt) (- (* (car LltPnt) CosRot) (* (cadr LltPnt) SinRot)))
      (+ (cadr InsPnt) (+ (* (car LltPnt) SinRot) (* (cadr LltPnt) CosRot)))
      1.0
      )
      (+ InsAng (* 1.25 pi))
      GapFac
      )
      (polar
      (list
      (+ (car InsPnt) (- (* (car UrtPnt) CosRot) (* (cadr LltPnt) SinRot)))
      (+ (cadr InsPnt) (+ (* (car UrtPnt) SinRot) (* (cadr LltPnt) CosRot)))
      1.0
      )
      (+ InsAng (* 1.75 pi))
      GapFac
      )
      (polar
      (list
      (+ (car InsPnt) (- (* (car UrtPnt) CosRot) (* (cadr UrtPnt) SinRot)))
      (+ (cadr InsPnt) (+ (* (car UrtPnt) SinRot) (* (cadr UrtPnt) CosRot)))
      1.0
      )
      (+ InsAng (* 0.25 pi))
      GapFac
      )
      (polar
      (list
      (+ (car InsPnt) (- (* (car LltPnt) CosRot) (* (cadr UrtPnt) SinRot)))
      (+ (cadr InsPnt) (+ (* (car LltPnt) SinRot) (* (cadr UrtPnt) CosRot)))
      1.0
      )
      (+ InsAng (* 0.75 pi))
      GapFac
      )
      )
      )
      ;
      ; == Function Draw3DFace
      ; Draws 3DFaces to hide objects behind text.
      ; Arguments [Type]:
      ; Obj = Text object [VLA_OBJECT]
      ; Return [Type]:
      ; > Null
      ; Notes:
      ; None
      ;
      (defun Draw3DFace (Obj / PntLst TmpObj)
      (setq PntLst (GetTextBox Obj)
      TmpObj (vla-Add3DFace
      (vla-get-ModelSpace
      (vla-get-ActiveDocument
      (vlax-get-acad-object)
      )
      )
      (vlax-3d-point (nth 0 PntLst))
      (vlax-3d-point (nth 1 PntLst))
      (vlax-3d-point (nth 2 PntLst))
      (vlax-3d-point (nth 3 PntLst))
      )
      )
      (vla-put-Layer TmpObj "My3dfaceLayer")
      (vla-put-VisibilityEdge1 TmpObj :vlax-false)
      (vla-put-VisibilityEdge2 TmpObj :vlax-false)
      (vla-put-VisibilityEdge3 TmpObj :vlax-false)
      (vla-put-VisibilityEdge4 TmpObj :vlax-false)
      (princ)
      )

      Cheers
     
    Jürg Menzi, May 6, 2004
    #8
  9. Big 'D'

    Steve Doman Guest

    Jürg,

    As a side note, I really like formatting style. Are you using Vlide to
    automatically format code or are you formatting manually? If you are
    using Vlide can you please show what your format settings are.

    Thanks.

    Regards,
    Steve Doman
     
    Steve Doman, May 6, 2004
    #9
  10. Big 'D'

    jberry50 Guest

    This is one that I have been using for sometime.

    (defun C:CISTEXT ( / ss e ent bound bbox outerbox _ptl i n)
    (setvar "OSMODE" 0)
    (setvar "CMDECHO" 0)
    (setvar "UCSFOLLOW" 0)
    (setvar "BLIPMODE" 0)
    (if (not clntol)(setq clntol 0.1))
    (prompt"\nVyber cistene texty:")
    (setq ss (ssget '((0 . "TEXT")))) ;filtruj TEXTy (ne ATTRIB)
    (setq i 0)
    (command "_undo" "_g")
    (if ss
    (while (< i (sslength ss))
    (setq ent (entget (setq e (ssname ss i))))
    (setq bound (textbox ent))
    (setq _ptl
    (list (car bound) (list (caar bound)(cadadr bound)) (cadr bound) (list (caadr bound)(cadar bound)))
    )
    (command "_UCS" "_E" e)
    (command "_PLINE")
    (foreach n _ptl (command n))
    (command "_C")
    (setq bbox (entlast))
    ; (command "_OFFSET" clntol (car bound) "999999,999999" "")
    (command "_OFFSET" clntol (cons bbox (list(car bound))) "999999,999999" "")
    (entdel bbox)
    (setq outerbox (entlast))
    (command "_TRIM" outerbox "" "_fence")
    (foreach n _ptl (command n))
    (command "" "")
    (entdel outerbox)
    (command "_UCS" "_P")
    (setq i (1+ i))
    );endwhile
    );endif
    (command "_undo" "_e")
    (princ)
    )
     
    jberry50, May 6, 2004
    #10
  11. Big 'D'

    Steve Doman Guest

    Danke! Ich genieße, Ihre Programme zu lesen.
    Steve
     
    Steve Doman, May 7, 2004
    #11
  12. Big 'D'

    Jürg Menzi Guest

    Welcome...
    I think my english sounds like your german...<G>

    Cheers
     
    Jürg Menzi, May 7, 2004
    #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.