Author Topic: Is it possible to rotate block for preview prior pick point to insert block  (Read 8681 times)

0 Members and 1 Guest are viewing this topic.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
A hack, but all I could think of to still enable the block preview and allow OSnaps:

:kewl:
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

ronjonp

  • Needs a day job
  • Posts: 7529
Cool stuff Lee  :-D

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Cheers guys  8-)

jaydee

  • Guest
Thankyou Lee.
That was a good get around, not sure about using the esc key to rotate as it will force user to insert the block.

Appriciated.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
You're welcome  :-)

not sure about using the esc key to rotate as it will force user to insert the block.

Maybe you can think of a better solution which offers the block preview and OSnaps :-)


CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Code - Auto/Visual Lisp: [Select]
  1. ;;  This is a kludge of a routine that will allow rotation via the L fo CCW and R for CW
  2. ;;  rotation while moving the block. If you are through rotating and want the osnap to
  3. ;;  work press I  otherwise just click a point.
  4. ;;  No error checking and lots of room for improvement.
  5.  
  6.   (defun c:test ( / bname key grr ip lastpt ent)
  7.    (setvar "cmdecho" 0)
  8.    (while
  9.        (not
  10.            (or
  11.                (eq "" (setq bname (getstring t "\nBlock to Insert: ")))
  12.                (tblsearch "BLOCK" bname)
  13.            )
  14.        )
  15.        (princ "\nBlock not found.")
  16.    )
  17.     (while ;  exit on ENTER or picked point
  18.       (cond
  19.         ;;=====================================================
  20.         ((eq 2 (car (setq grr (grread t 7 0)))) ; keyboard input
  21.          (setq key (cadr grr))
  22.          (cond
  23.  
  24.            ;;-------------------------------------------
  25.            ((= key 13) ; ENTER- where done here
  26.             (and ent (entdel ent))
  27.             (princ "\nUser Quit.")
  28.             nil ; exit loop
  29.            )
  30.  
  31.            ;;-------------------------------------------
  32.            ((member (chr key) '("H" "h")) ; Word entry  'Help'
  33.             ;(Display_Help) ; your alert box routine
  34.              t ; stay in loop
  35.            )
  36.            ((member (chr key) '("I" "i")) ; Insert with OSNAP
  37.              (vl-cmdf "_.move" ent "" "_non" lastpt)
  38.              (while (= (logand (getvar "cmdactive") 1) 1)
  39.                (command pause)
  40.              )
  41.              nil ; stay in loop
  42.            )
  43.            ((member (chr key) '("L" "l")) ; Left or CCW
  44.              (vl-cmdf "_.rotate" ent "" "_non" ip 90.0)
  45.              t ; stay in loop
  46.            )
  47.            ((member (chr key) '("R" "r")) ; Right or CW
  48.              (vl-cmdf "_.rotate" ent "" "_non" ip -90.0)
  49.              t ; stay in loop
  50.            )
  51.            ;;-------------------------------------------
  52.            ((princ "\nInvalid Keypress.") (princ (strcat msg str)))
  53.          ) ; end cond
  54.         )
  55.         ;;=====================================================
  56.         ((eq 3 (car grr)) ; point picked, make final star
  57.          (setq ip (cadr grr))
  58.  
  59.          nil ; exit
  60.         )
  61.         ;;=====================================================
  62.         ((eq 5 (car grr)) ; point from mouse, update object
  63.          (setq ip (cadr grr))
  64.          (if (null lastpt) ; first time through
  65.            (progn
  66.              (setq lastpt ip)
  67.              (vl-cmdf "_.-insert" bname "_S" 1.0 "_R" 0.0 "_non" ip)
  68.              (setq ent (entlast))
  69.            )
  70.          )
  71.          (if (> (distance ip lastpt) 0.00001)
  72.            (vl-cmdf "_.move" ent "" "_non" lastpt "_non" ip)
  73.          )
  74.          (setq lastpt ip)
  75.         )
  76.       )   ; end cond
  77.         ;;=====================================================
  78.     )     ; while
  79.     (redraw)
  80.     (princ)
  81.   )
  82.  
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Hugo

  • Bull Frog
  • Posts: 431
@ CAB

I can also use super
Thank you

Super kann ich auch gebrauchen
Danke

amc.dicsac

  • Newt
  • Posts: 109
  • Autocad 2008
Hello:

I am new to the forum, the program is magnificent but I have two check quisera know if you could add the option of previewing the block can pick the base point before inserting and other serious and activate the object snap when I use the grrear function I'll be grateful to their answers

Thank you
<a href="http:/http://axprogramlisp.blogspot.pe" class="bbc_link" target="_blank">By Alexander Castro</a>