+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 18 of 18
  1. #11
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    1,057

    Default

    Registered forum members do not see this ad.

    ok then, because its weekend some more lunch fun :


    routine allows user to continuously copy string from one object to another. Program uses grread so during execution no transparent commands can be used. To make up for this , you can use Z key for zoom , E key for zoom extents , + and - key for zooming in or out. Space , enter of Esc cancels the loop.

    Code:
    ; rlx 19-3-2018 : text-copy-in-a-loopy , copy text string from one object to another
    (defun c:t2 ( / e1 e2 osm)
      (setq osm (getvar "snapmode"))(setvar "snapmode" 0)
      (princ "\nEsc, enter, Rmouse to cancel, zoom with E(extend), Z(oom) or + / -\nSelect object with string :")
      (while (setq e1 (RlxSel "\nSource text : "))
        (if (setq e2 (RlxSel "\nTarget text : "))(progn (update_txt e1 e2 )(redraw e1 4)(redraw e2 4))))
      (setvar "snapmode" osm)
      (princ)
    )
    (defun update_txt (%source %target)
      (if (vlax-property-available-p (vlax-ename->vla-object %target) 'textstring t)
        (vla-put-textstring (vlax-ename->vla-object %target) (vla-get-textstring (vlax-ename->vla-object %source)))))
    
    (defun has_string (e) (vlax-property-available-p (vlax-ename->vla-object e) 'textstring))
     
    (defun RlxSel ( $msg / done-selecting inp i p2 result e ent)
      (princ $msg)
      (setq done-selecting nil)
      (while (not done-selecting)
        (setq inp (vl-catch-all-apply 'grread (list nil 4 2)))
        (if (vl-catch-all-error-p inp)
          (setq done-selecting t result nil)
          (cond
     ; if point selected
     ((= (car inp) 3)
      ; if point has object under it
      (if (setq ent (nentselp (cadr inp))) (setq e (car ent)))
      (cond
        ; if we have object and object is the right type we have a winner
        ((and e (has_string e)) (redraw e 3)(setq done-selecting t result e))
        ; maybe its the parent - this happens when type is dimension and you select dimensions text
        ((and (caddr ent) (setq ent (last (last ent)))(has_string ent))
         (redraw ent 3)(setq done-selecting t result ent))
        ; sorry object is not the right stuf
        ((and e (not (has_string e))) (princ "\rThis entity contains no text string"))
        ; missed , no object found under selected point ... try crossing selection
        (t (if (and (setq i 0 p2 (getcorner (cadr inp) "\rOther corner : ")) (setq ss (ssget "c" (cadr inp) p2)))
      (while (and (not done-selecting) (setq e (ssname ss i)))
        (if (has_string e)(progn (redraw e 3) (setq result e done-selecting t))) (setq i (1+ i))))
        );end t
      ); end cond
            ); end (= (car inp) 3)
     
     ; user pressed E of e
     ((member inp '((2 69)(2 101))) (command "zoom" "e"))
     ; user clicked R-mouse button, pressed enter or space (done selecting)
     ((or (equal (car inp) 25)(member inp '((2 13)(2 32))))
      (setq done-selecting t result nil))
     ; user pressed +
     ((equal inp '(2 43)) (command "zoom" "2x"))
     ; user pressed -
     ((equal inp '(2 45)) (command "zoom" ".5x"))
     ; user pressed z or Z
     ((member inp '((2 122)(2 90))) (command "'zoom" ""))
          )
        )
      )
      result
    )
    gr.Rlx
    Last edited by rlx; 19th Mar 2018 at 11:12 am.

  2. #12
    Quantum Mechanic BIGAL's Avatar
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,702

    Default

    rlx the reason I thought use ssget as you can pick 1 or pick multiple by not putting any filter about selecting, just have the filter *text,dimension, then if you had random rows of *text you could accept join in say there y value order. I just picked a column of individual text {window} + 1 mtext {pick} so would be in draw order by doing as single picks {window} sort on Y + single pick + {window} sort on Y and so on

    Code:
    (setq ss (ssget (list (cons 0 "*text"))))
    A man who never made mistakes never made anything

  3. #13
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    1,057

    Default

    Quote Originally Posted by BIGAL View Post
    rlx the reason I thought use ssget as you can pick 1 or pick multiple by not putting any filter about selecting, just have the filter *text,dimension, then if you had random rows of *text you could accept join in say there y value order. I just picked a column of individual text {window} + 1 mtext {pick} so would be in draw order by doing as single picks {window} sort on Y + single pick + {window} sort on Y and so on

    Code:
    (setq ss (ssget (list (cons 0 "*text"))))
    Just cut copy paste (and lunched) something together. Not claiming it's better. Just wanted routine that allows single pick , autoswitch to window (crossing actually) if needed , and can also find strings in nested entities etc. It workes just fine for me in a couple of routines I use daily but if you have something better , please do post because what I like most about your codes is your no-nonsense approach and I often think , how did I not see that... I usually try to make code that I can use in more applications, even if it means some parts can be shorter. But that's an old discussion , what's better , faster code of less development time by beeing able to quickly paste something together... I'm clearly fan of the latter. When programs are getting bigger , your have to pay more attention to a good structure , at least , thats my personal experience.



    gr. Rlx

  4. #14
    Quantum Mechanic BIGAL's Avatar
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,702

    Default

    Give the task to 4 people and you will get 4 different answers to the final solution. I think its time to wait for itacad before any more changes.
    A man who never made mistakes never made anything

  5. #15
    Full Member
    Discipline
    Electrical
    Using
    AutoCAD 2018
    Join Date
    Jan 2018
    Posts
    39

    Default

    here I am! sorry for the delay of the reply!
    I try the rlx's lisp and it works how I need!
    Thank you very much!

  6. #16
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    1,057

    Default

    Quote Originally Posted by itacad View Post
    here I am! sorry for the delay of the reply!
    I try the rlx's lisp and it works how I need!
    Thank you very much!
    nos problemos , you're welcome



    gr.Rlx

  7. #17
    Full Member
    Discipline
    Electrical
    Using
    AutoCAD 2018
    Join Date
    Jan 2018
    Posts
    39

    Default

    Hello! another topic found in the forum that fix the problem!
    http://www.cadtutor.net/forum/showth...tch-properties

  8. #18
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    1,057

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by itacad View Post
    Hello! another topic found in the forum that fix the problem!
    http://www.cadtutor.net/forum/showth...tch-properties
    doesn't appear to be entirely stable but nevertheless it has some interesting lines of code so thanx for the link

    gr. Rlx

Similar Threads

  1. Replies: 7
    Last Post: 13th Jan 2016, 06:23 am
  2. LISP to copy Polylines with certain points fixed (kind of strech-copy)
    By heschr in forum AutoLISP, Visual LISP & DCL
    Replies: 0
    Last Post: 29th Jan 2014, 03:51 pm
  3. Dynamic Block Variations!!!!!?
    By KnoJa31 in forum AutoCAD Drawing Management & Output
    Replies: 3
    Last Post: 30th Sep 2008, 05:02 pm
  4. Variations of AutoCAD
    By kezflake in forum AutoCAD General
    Replies: 10
    Last Post: 28th Jun 2008, 12:36 pm
  5. Lisp to copy/change text
    By Absntmind in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 5th Oct 2007, 12:29 am

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