Author Topic: Examples of usage GRREAD - let's share  (Read 199122 times)

0 Members and 3 Guests are viewing this topic.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Examples of usage GRREAD - let's share
« Reply #150 on: April 26, 2011, 09:47:42 AM »
 :lol:

Code: [Select]
(defun c:Test (/ e g l c)
  (if (and (setq e (car (entsel "\nSelect text object: ")))
           (member (cdr (assoc 0 (entget e))) '("MTEXT" "TEXT"))
      )
    (while (eq 5 (car (setq g (grread T 15 0))))
      (cond ((not l) (setq l (cons (cadadr g) l)))
            ((apply 'equal (setq c (list (car (setq l (cons (cadadr g) l))) (cadr l)))))
            ((apply '> c)
             (entmod (list (cons 1 (rtos (1+ (distof (cdr (assoc 1 (entget e))))))) (cons -1 e)))
            )
            ((apply '< c)
             (entmod (list (cons 1 (rtos (1- (distof (cdr (assoc 1 (entget e))))))) (cons -1 e)))
            )
      )
    )
  )
  (princ)
)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Examples of usage GRREAD - let's share
« Reply #151 on: April 26, 2011, 09:50:11 AM »
Nice idea Alan :-)

This was my take:

Code: [Select]
(defun c:test ( / c e f i l s ss )
  (if
    (and (setq ss (ssget "_:L" '((0 . "TEXT"))))
      (progn
        (repeat (setq i (sslength ss))
          (setq e (ssname ss (setq i (1- i)))
                s (cdr (assoc 1 (entget e)))
          )                 
          (if (equal (atoi s) (read s)) (setq l (cons e l)) l)
        )
      )
      (princ "\nPress [+/-] to Increment/Decrement text...")
    )
    (while (member (setq c (cadr (grread nil 14 1))) '(43 45 61 95))
      (setq f (if (member c '(45 95)) 1- 1+))

      (foreach e l
        (setq e (entget e))
        (entmod (subst (cons 1 (itoa (f (atoi (cdr (assoc 1 e)))))) (assoc 1 e) e))
      )
    )
  )
  (princ)
)

« Last Edit: April 26, 2011, 10:05:58 AM by Lee Mac »

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Examples of usage GRREAD - let's share
« Reply #152 on: April 26, 2011, 09:55:07 AM »
Nice idea Alan :-)

This was my take:
Thanks and nice one to you too. :)
Mine isn't practical, but I suppose it shows using the mouse position to edit objects in an unconventional way.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

chlh_jd

  • Guest
Re: Examples of usage GRREAD - let's share
« Reply #153 on: April 26, 2011, 10:00:33 AM »
Nice Idea Alan , how to Against mousewheel zoom .
Lee Mac Nice too  .
Thank you a lot .
Code: [Select]
(entmod (list (cons 1 (rtos (1+ (distof (cdr (assoc 1 (entget e))))))) (cons -1 e)))Nice mothod !!!
« Last Edit: April 26, 2011, 11:11:50 AM by chlh_jd »

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Examples of usage GRREAD - let's share
« Reply #154 on: April 26, 2011, 10:06:57 AM »
Nice Idea Alan , how to Against mousewheel zoom .
Lee Mac Nice too  .
Thank you a lot .
Beats me dude. I did mine the way I did because of your inquiries into the mouse wheel.

BTW, if you do figure out how to access the state of the wheel, you'll need to disable the wheel acting as a zoom in/out ability.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Examples of usage GRREAD - let's share
« Reply #155 on: April 26, 2011, 10:08:02 AM »
You can't detect mouse-wheel scroll using GrRead and I don't think there is an acet-sys-* function for it  :-(

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Examples of usage GRREAD - let's share
« Reply #156 on: April 26, 2011, 10:09:00 AM »
You can't detect mouse-wheel scroll using GrRead and I don't think there is an acet-sys-* function for it  :-(
Probably has to do with GRREAD being created before the mouse had a wheel. :-P
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Examples of usage GRREAD - let's share
« Reply #157 on: April 26, 2011, 10:10:24 AM »
You can't detect mouse-wheel scroll using GrRead and I don't think there is an acet-sys-* function for it  :-(
Probably has to do with GRREAD being created before the mouse had a wheel. :-P

 :-D

chlh_jd

  • Guest
Re: Examples of usage GRREAD - let's share
« Reply #158 on: April 26, 2011, 10:15:07 AM »
Thanks Alan , Thanks Lee   :angel:
« Last Edit: April 26, 2011, 11:07:04 AM by chlh_jd »

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Examples of usage GRREAD - let's share
« Reply #159 on: April 26, 2011, 10:19:27 AM »
Thank Alan , Thank Lee   :angel:
Thank you Lee.  :lol:


Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

chlh_jd

  • Guest
Re: Examples of usage GRREAD - let's share
« Reply #160 on: April 26, 2011, 11:08:17 AM »
use type "a s A S" or "d f D F"
Code: [Select]
(defun c:test (/ en ent str pt)
  (if (and (setq en (car (entsel "Select Integer Number Text :")))
   (setq ent (entget en))
   (setq str (cdr (assoc 1 ent)))
   (numberp (eval (read str)))
   (equal (atoi str) (atof str))    
      )
    (while (and (setq pt (grread  t 15 0))
  (not (and (= 2 (car pt))
    (or (= 13 (cadr pt)) (= 32 (cadr pt)))
       )
  ) ;_Enter Space
(not (or (= (car pt) 11) (= (car pt) 25)));_Right button
     )     
(cond ((and (= (car pt) 2) (member (cadr pt) (list 65 83 97 115)));_type "a s A S"
       (setq str (rtos (1+ (atoi str)) 2 0))
       (setq ent (subst (cons 1 str) (assoc 1 ent) ent))
       (entmod ent)
       )
      ((and (= (car pt) 2) (member (cadr pt) (list 68 70 100 102)))        
       (setq str (rtos (1- (atoi str)) 2 0))
       (setq ent (subst (cons 1 str) (assoc 1 ent) ent))
       (entmod ent)
       )      
      )     
    )
    (princ)
  )
  (princ)
)

chlh_jd

  • Guest
Re: Examples of usage GRREAD - let's share
« Reply #161 on: April 26, 2011, 11:36:43 AM »
Add viesize control .
Code: [Select]
;;;use Alan method
;;;to easy to control add method devided by viewsize .
(defun c:test (/ en ent str ds pto pt)
  (if (and (setq en (car (entsel "Select Integer Number Text :")))
   (setq ent (entget en))
   (setq str (cdr (assoc 1 ent)))
   (numberp (eval (read str)))
   (equal (atoi str) (atof str))
   (setq ds (/ (getvar "viewsize") 100.));_here can be changed cond to your need
   (setq pto (grread t 15 0))
      )
    (while (and (setq pt (grread pto))
(not (and (= 2 (car pt))
  (or (= 13 (cadr pt)) (= 32 (cadr pt)))
     )
) ;_Enter Space
(not (or (= (car pt) 11) (= (car pt) 25))) ;_Right button
   )
      (if (and (= (car pt) 5)
       (> (abs (- (cadadr pt) (cadadr pto))) ds)        
  )
(cond
  ((> (- (cadadr pt) (cadadr pto)) 0);_Y+ move   
   (setq str (rtos (1+ (atoi str)) 2 0))
   (entmod (list (cons 1 str) (cons -1 en)))    
   (setq pto pt)
  )
  ((< (- (cadadr pt) (cadadr pto)) 0);_Y- move
   (setq str (rtos (1- (atoi str)) 2 0))
   (entmod (list (cons 1 str) (cons -1 en)))
   (setq pto pt)
  )
)
(princ)
      )
    )
    (princ)
  )
  (princ)
)
« Last Edit: April 26, 2011, 11:40:32 AM by chlh_jd »

m4rdy

  • Newt
  • Posts: 62
Re: Examples of usage GRREAD - let's share
« Reply #162 on: April 26, 2011, 11:43:20 AM »
use type "a s A S" or "d f D F"
Code: [Select]
(defun c:test (/ en ent str pt)
  (if (and (setq en (car (entsel "Select Integer Number Text :")))
   (setq ent (entget en))
   (setq str (cdr (assoc 1 ent)))
   (numberp (eval (read str)))
   (equal (atoi str) (atof str))    
      )
    (while (and (setq pt (grread  t 15 0))
  (not (and (= 2 (car pt))
    (or (= 13 (cadr pt)) (= 32 (cadr pt)))
       )
  ) ;_Enter Space
(not (or (= (car pt) 11) (= (car pt) 25)));_Right button
     )     
(cond ((and (= (car pt) 2) (member (cadr pt) (list 65 83 97 115)));_type "a s A S"
       (setq str (rtos (1+ (atoi str)) 2 0))
       (setq ent (subst (cons 1 str) (assoc 1 ent) ent))
       (entmod ent)
       )
      ((and (= (car pt) 2) (member (cadr pt) (list 68 70 100 102)))        
       (setq str (rtos (1- (atoi str)) 2 0))
       (setq ent (subst (cons 1 str) (assoc 1 ent) ent))
       (entmod ent)
       )      
      )     
    )
    (princ)
  )
  (princ)
)

Nothing happened.

m4rdy
Autocad 2007, Windows XP

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Examples of usage GRREAD - let's share
« Reply #163 on: April 26, 2011, 12:59:40 PM »
Keep in mind that I didn't do any checks (as Lee did) because it was a crappy example and I just didn't really care.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Examples of usage GRREAD - let's share
« Reply #164 on: May 28, 2011, 11:01:58 AM »
Updated some old code :-)

Program will now work in all UCS/Views  :-)