Author Topic: Dynamic drawing and substitution of grread-function  (Read 26671 times)

0 Members and 1 Guest are viewing this topic.

Tharwat

  • Swamp Rat
  • Posts: 611
  • Hypersensitive
Re: Dynamic drawing and substitution of grread-function
« Reply #30 on: June 27, 2012, 06:27:43 AM »

If there is a dyndraw.arx version available for AutoCAD 2012 64-bit, then yes, I'm sure that my code could be manipulated to work in this version.

Lee

You're code worked nicely here on 2010 .

I liked the crack of grread function to have that dynamic way with osnap setting on .

But it seems that it's up to Cad 2010 from the name of file ! Am I right ?

Alexander Rivilis

  • Bull Frog
  • Posts: 213
  • Programmer from Kyiv (Ukraine)
Re: Dynamic drawing and substitution of grread-function
« Reply #31 on: June 27, 2012, 06:35:22 AM »
Change:

Code: [Select]
  (setq vers
    '((18.0 . "2010")
      (17.2 . "2009")
      (17.1 . "2008")
      (17.0 . "2007")
      (16.2 . "2006")
      (16.1 . "2005")
      (16.0 . "2004")
      (15.6 . "2002"))
  )
with:
Code: [Select]
  (setq vers
    '((19.0 . "2013")
      (18.2 . "2010")
      (18.1 . "2010")
      (18.0 . "2010")
      (17.2 . "2008")
      (17.1 . "2008")
      (17.0 . "2007")
      (16.2 . "2004")
      (16.1 . "2004")
      (16.0 . "2004")
      (15.6 . "2002"))
  )
Also change:
Code: [Select]
(if (eq "2010" v) bit "") ".arx"with:
Code: [Select]
(if (or (eq "2008" v) (eq "2010" v) (eq "2013" v)) bit "") ".arx"

Lee Mac

  • Seagull
  • Posts: 12488
  • London, England
Re: Dynamic drawing and substitution of grread-function
« Reply #32 on: June 27, 2012, 06:43:55 AM »
Thank you Alexander, and thank you also for your work on the superb dyndraw.arx utility.  :-)

Tharwat

  • Swamp Rat
  • Posts: 611
  • Hypersensitive
Re: Dynamic drawing and substitution of grread-function
« Reply #33 on: June 27, 2012, 06:54:14 AM »
A very nice work Alexander .

Thank you so much for sharing this precious work .

Alexander Rivilis

  • Bull Frog
  • Posts: 213
  • Programmer from Kyiv (Ukraine)
Re: Dynamic drawing and substitution of grread-function
« Reply #34 on: June 27, 2012, 06:57:01 AM »
Thank you Alexander, and thank you also for your work on the superb dyndraw.arx utility.  :-)
A very nice work Alexander .
Thank you so much for sharing this precious work .
Thanks!  :-)

Tharwat

  • Swamp Rat
  • Posts: 611
  • Hypersensitive
Re: Dynamic drawing and substitution of grread-function
« Reply #35 on: June 27, 2012, 02:29:45 PM »
Hi Alexander .

I could not load the arx files at home with OS 64 and windows 7 Autocad 2009 and 2012
It gives a message ' Unable to Dyn Draw ******* '

Thanks

Alexander Rivilis

  • Bull Frog
  • Posts: 213
  • Programmer from Kyiv (Ukraine)
Re: Dynamic drawing and substitution of grread-function
« Reply #36 on: June 28, 2012, 08:44:11 AM »
Hi Alexander .

I could not load the arx files at home with OS 64 and windows 7 Autocad 2009 and 2012
It gives a message ' Unable to Dyn Draw ******* '

Thanks
Sorry but I can not test DynDraw with x64 OS. Try manually load appropriate arx-file with _APPLOAD command before testing samples.

Tharwat

  • Swamp Rat
  • Posts: 611
  • Hypersensitive
Re: Dynamic drawing and substitution of grread-function
« Reply #37 on: June 28, 2012, 08:49:11 AM »
Hi .

Appload is the one that I used to load the arx files .

All loaded nicely on OS 32 at the office , but at home OS 64 without a chance to success or to pass . :-(

Any other solution please ? .

CAB

  • Global Moderator
  • Seagull
  • Posts: 10395
Re: Dynamic drawing and substitution of grread-function
« Reply #38 on: June 28, 2012, 09:03:19 AM »
Works here ACAD2006 .
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.

Alexander Rivilis

  • Bull Frog
  • Posts: 213
  • Programmer from Kyiv (Ukraine)
Re: Dynamic drawing and substitution of grread-function
« Reply #39 on: June 28, 2012, 09:22:53 AM »
Hi .

Appload is the one that I used to load the arx files .

All loaded nicely on OS 32 at the office , but at home OS 64 without a chance to success or to pass . :-(

Any other solution please ? .
I've tried load DynDraw2010x64.arx with AutoCAD 2012 x64 with Win7 x64 and it is loaded without errors and working well. Command SLAT (by Lee) with my correction above are also working if DynDraw2010x64.arx is in directories in which AutoCAD searching or loaded before.

Lee Mac

  • Seagull
  • Posts: 12488
  • London, England
Re: Dynamic drawing and substitution of grread-function
« Reply #40 on: June 28, 2012, 11:32:19 AM »
To provide another example, I have rewritten my 'hvlines' program from here to use dyndraw:


chlh_jd

  • Guest
Re: Dynamic drawing and substitution of grread-function
« Reply #41 on: July 12, 2012, 09:44:41 AM »
Thanks Alexander's Classic
My old dyn arrow-leader code can be simplified
Code: [Select]
(defun c:test (/ dyn_leader_call_back *error* p1 p2 p3 p p_base)
  ;;dyndraw arrow leader , e.g.
  ;;by GSLS(SS)
  (defun dyn_leader_call_back (p)
   (cond ((= (type p) 'STR)
  (redraw)
)
((= (type p) 'LIST)
  (if (> (distance p p_base) 1e-6)
    (progn
      (redraw)
      (if (<= (distance p1 p) (distance p p3))
(ss:grvecs:leader (list p1 p2 p3 450. 150.) nil)
(ss:grvecs:leader (list p3 p2 p1 450. 150.) nil)
      )
      (setq p_base p)
    )
  )
)
   )
   p
 )
  (setq _cm (getvar "cmdecho")
_ps (getvar "PICKSTYLE")
_oe *error*
  )
  (defun *error* (msg)
    (if (or (= msg "Function cancelled")
    (= msg "quit / exit abort")
)
      (princ msg)
      (princ (strcat "\n错误: " msg))
    )
    (vla-EndUndoMark
      (vla-get-ActiveDocument (vlax-get-acad-object))
    )
    (setvar "cmdecho" _cm)
    (setvar "PICKSTYLE" _ps)
    (vl-acad-undefun "dyn_leader_call_back")
    (setq *error* _oe)
    (princ)
  ) 
  (setvar "cmdecho" 0)
  (setvar "PICKSTYLE" 0)
  (vl-acad-defun "dyn_leader_call_back")
  (setq p1 (getpoint "\nSelect First Point of Lead Arrow :"))
  (setq p2 (getpoint p1 ">>Sencond Point :"))
  (grdraw p1 p2 3 3)
  (setq p3 (getpoint p2 ">>Third Point :"))
  (grdraw p2 p3 3 3)
  (setq p p3
p_base p
  )
  (if (and dyndraw (>= (distance p1 p2) 500.) (>= (distance p2 p3) 500.) p p_base (/= (type p) 'STR))
    (progn     
       (setq p
      (dyndraw
;; Name of callback - finction
"dyn_leader_call_back"
;; Prompt string
"\nSelect Direction of the Arrow |^|"
;; Keyword string
""
;; Input flag
8
;; Cursor type
-1
;; Base point (in UCS)
p
       )
       )       
       (redraw)
       (if (= (type p) 'LIST)
(progn
   (vla-startundomark
     (vla-get-activedocument (vlax-get-acad-object))
   )
   (if (<= (distance p1 p) (distance p p3))
     (command "_pline"  p1 "w"  0 150 (polar p1 (angle p1 p2) 450.)  "w"  0  0  p2 "_none" p3 "")
     (command "_pline" p3 "w" 0 150(polar p3 (angle p3 p2) 450.)"w" 0 0 p2 "_none"  p1   "")
   )    
   (vla-EndUndoMark
     (vla-get-ActiveDocument (vlax-get-acad-object))      
   )    
)
       ) ;_endof if progn
    )
  )
  (setvar "cmdecho" _cm)
  (setvar "PICKSTYLE" _ps)
  (vl-acad-undefun "dyn_leader_call_back")
  (setq *error* _oe)
  (princ)
)
(defun ss:grvecs:leader (l mat / p1 p2 p3 p4 p5 p6 len wid ang)
  (if (and (= (length l) 5)
   (setq p1 (car l))
   (setq p2 (cadr l))
   (setq p3 (caddr l))
   (setq len (cadddr l))
   (setq wid (last l))
   (> (distance p1 p2) len)
   (setq ang (angle p1 p2))
   (setq p4 (polar p1 ang len))
   (setq p5 (polar p4 (+ ang (/ pi 2.)) (/ wid 2.)))
   (setq p6 (polar p4 (- ang (/ pi 2.)) (/ wid 2.)))
      )
    (if (and mat
     (= (length mat) 4)
     (apply '= (cons 'list (mapcar 'type mat)))
)
      (grvecs (list 3 p1 p5 3 p1 p6 3 p5 p6 3 p4 p2 3 p2 p3) mat)
      (grvecs (list 3 p1 p5 3 p1 p6 3 p5 p6 3 p4 p2 3 p2 p3))
    )
  )
)
« Last Edit: July 12, 2012, 09:55:40 AM by chlh_jd »

kruuger

  • Swamp Rat
  • Posts: 619
Re: Dynamic drawing and substitution of grread-function
« Reply #42 on: December 17, 2013, 03:25:20 AM »
hello

i try adjust my routine to work with DynDraw. looks like all seems to be fine.
i wish to update one thing. can SPACE or ENTER run part of my code instead of EXIT ?
Code: [Select]
"\nSpecify through point: [Rotate/Angle/REset/Exit] <Rotate>: "can this be done with DynDraw ?

thanks
kruuger

kruuger

  • Swamp Rat
  • Posts: 619
Re: Dynamic drawing and substitution of grread-function
« Reply #43 on: December 17, 2013, 05:27:53 PM »
i think i got this:
Code: [Select]
    ( (eq 'STR (type *pt))
      (redraw)
      (cond
        ( (eq "Angle" *pt)
          (if (eq (type (_AngleXLine)) 'REAL)
            (setq *NewXline* res)
            T
          )
          T
        )
        ( (eq "REset" *pt)
          (setq *NewXline* (/ pi 2))
          T
        )
        ( (eq "Exit" *pt)
          *pt
        )
        ( T ; Rotate
          (setq *NewXline* (+ *NewXline* (* pi 0.5)))
          T
        )
      )
    )
attached updated code
k.

kruuger

  • Swamp Rat
  • Posts: 619
Re: Dynamic drawing and substitution of grread-function
« Reply #44 on: December 23, 2013, 04:23:20 PM »
i'm trying to finish my routine but i'm stuck:
- don't know why but i can't open command line window F2 (when i'm in loop of program). window is closed immediately when i hit F2.
- also have a problem with Undo option. when i delete the last object created in loop my command line still show Undo.
Code: [Select]
"\nSpecify through point: [Rotate/Angle/Crosshair/REset/Undo/Exit] <Rotate>: "appreciate with any help.
thanks
kruuger
« Last Edit: February 11, 2014, 05:46:29 AM by kruuger »