+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 16
  1. #1
    Full Member
    Computer Details
    notredave's Computer Details
    Operating System:
    Vista :(
    Computer:
    HP
    Monitor:
    Dual HP 23"
    Discipline
    Electrical
    notredave's Discipline Details
    Discipline
    Electrical
    Details
    E&I Designer
    Using
    AutoCAD 2009
    Join Date
    Jan 2012
    Location
    Louisiana
    Posts
    36

    Default **Lisp routine to move text or mtext to midpoint of 2 points**

    Registered forum members do not see this ad.

    Good morning all,

    Does anyone have a iisp routine that they can share that will first make mtext or text insertion point as MC for moving purposes and then be able move it to "mid between 2 points"? The text or mtext does not need to keep MC insertion point after moving it. I sure would appreciate it. I need to move alot of text on a nameplate schedule and want it to look professional. Cab wrote one years ago that works great if you have a rectangle but I need it to work for mid between 2 points.

    Link to Cab's post:
    https://forums.autodesk.com/t5/visua...e/td-p/2632882


    Thank you for reading,
    Dave

  2. #2
    Super Member
    Computer Details
    ronjonp's Computer Details
    Operating System:
    Windows 10
    Using
    AutoCAD 2018
    Join Date
    Apr 2009
    Location
    Colorado
    Posts
    802

    Default

    Post a sample drawing.

  3. #3
    Senior Member
    Computer Details
    StevJ's Computer Details
    Operating System:
    Xp Pro
    Using
    AutoCAD 2014
    Join Date
    Sep 2008
    Location
    Bremerton, Wa
    Posts
    140

    Default

    For text justification, see post 3 in http://www.cadtutor.net/forum/showth...ification-Lisp

    For centering text between two points, find your solution in http://www.cadtutor.net/forum/showthread.php?90741


    Steve

  4. #4
    Full Member
    Computer Details
    notredave's Computer Details
    Operating System:
    Vista :(
    Computer:
    HP
    Monitor:
    Dual HP 23"
    Discipline
    Electrical
    notredave's Discipline Details
    Discipline
    Electrical
    Details
    E&I Designer
    Using
    AutoCAD 2009
    Join Date
    Jan 2012
    Location
    Louisiana
    Posts
    36

    Default

    ronjonp, attached is part of an example drawing
    Attached Files

  5. #5
    Super Member
    Computer Details
    ronjonp's Computer Details
    Operating System:
    Windows 10
    Using
    AutoCAD 2018
    Join Date
    Apr 2009
    Location
    Colorado
    Posts
    802

    Default

    You move each one of these texts one at a time ? Do you have code that generates the table?

  6. #6
    Full Member
    Computer Details
    notredave's Computer Details
    Operating System:
    Vista :(
    Computer:
    HP
    Monitor:
    Dual HP 23"
    Discipline
    Electrical
    notredave's Discipline Details
    Discipline
    Electrical
    Details
    E&I Designer
    Using
    AutoCAD 2009
    Join Date
    Jan 2012
    Location
    Louisiana
    Posts
    36

    Default

    I don't mind moving one at a time. The table is generated manually. I just would like something to pick the text from middle center and picking 2 endpoints to center text. Did you happen to see Cab's lisp? It works but only if the second point is a rectangle. I would like to choose 2 points.

  7. #7
    Super Member
    Computer Details
    ronjonp's Computer Details
    Operating System:
    Windows 10
    Using
    AutoCAD 2018
    Join Date
    Apr 2009
    Location
    Colorado
    Posts
    802

    Default

    IMO .. the first thing that should be done is figure out how to generate the table automatically. Then you can format to whatever needed.

  8. #8
    Full Member
    Computer Details
    notredave's Computer Details
    Operating System:
    Vista :(
    Computer:
    HP
    Monitor:
    Dual HP 23"
    Discipline
    Electrical
    notredave's Discipline Details
    Discipline
    Electrical
    Details
    E&I Designer
    Using
    AutoCAD 2009
    Join Date
    Jan 2012
    Location
    Louisiana
    Posts
    36

    Default

    I have other type of drawings that use different size tables/schedules

  9. #9
    Super Member
    Computer Details
    ronjonp's Computer Details
    Operating System:
    Windows 10
    Using
    AutoCAD 2018
    Join Date
    Apr 2009
    Location
    Colorado
    Posts
    802

    Default

    Quote Originally Posted by notredave View Post
    I have other type of drawings that use different size tables/schedules
    This is still a task to be automated...

    Here's some quick code to help you with your manual process.
    Code:
    (defun c:foo (/ _mid e p p1 p2)
      (defun _mid (p1 p2) (polar p1 (angle p1 p2) (/ (distance p1 p2) 2.)))
      ;; RJP - 03.22.2018
      (if (and (setq p1 (getpoint "\nSpecify first corner point: "))
    	   (setq p2 (getcorner p1 "\nSpecify other corner point: "))
    	   (setq e (ssget "_C" p1 p2 '((0 . "*text"))))
    	   (setq e (vlax-ename->vla-object (ssname e 0)))
    	   (vlax-write-enabled-p e)
          )
        (progn (vla-getboundingbox e 'll 'ur)
    	   (setq p (mapcar 'vlax-safearray->list (list ll ur)))
    	   (vlax-invoke e 'move (_mid (car p) (cadr p)) (_mid p1 p2))
        )
      )
      (princ)
    )
    (vl-load-com)

  10. #10
    Full Member
    Computer Details
    notredave's Computer Details
    Operating System:
    Vista :(
    Computer:
    HP
    Monitor:
    Dual HP 23"
    Discipline
    Electrical
    notredave's Discipline Details
    Discipline
    Electrical
    Details
    E&I Designer
    Using
    AutoCAD 2009
    Join Date
    Jan 2012
    Location
    Louisiana
    Posts
    36

    Default

    Registered forum members do not see this ad.

    I will try that and let you know. Thank you very much ronjonp!

Similar Threads

  1. Auto lisp routine to bisect a line and draw a line perpendicular from midpoint
    By rvalusa22 in forum AutoLISP, Visual LISP & DCL
    Replies: 7
    Last Post: 24th Oct 2016, 08:28 pm
  2. lisp to place "points" at midpoint of pipe fittings
    By pipefitter72 in forum AutoLISP, Visual LISP & DCL
    Replies: 18
    Last Post: 31st Oct 2014, 02:33 am
  3. [LISP] First time writing LISP routine... trying to rotate, move and scale
    By chiimayred in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 18th Jul 2013, 06:02 pm
  4. Replies: 9
    Last Post: 3rd Jul 2012, 09:16 pm
  5. Lisp routine to convert objects into Text or Mtext
    By bsimpson in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 2nd Feb 2009, 01:31 pm

Bookmarks

Posting Permissions

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