TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: velasquez on February 03, 2016, 05:48:48 AM

Title: Dragging block with DynDraw
Post by: velasquez on February 03, 2016, 05:48:48 AM
Code: [Select]
(defun c:DynDrawTest (/ step blk Obj point)
  (setq step 1e-6)
  (setq blk (car (entsel "\nSelect a block: "))
;;; pt     (dxf 10 (entget blk)) ;_ fim de dxf
;;; LastPt pt
Obj (vlax-ename->vla-object blk)
  ) ;_ fim de setq
  (defun JoyCallBackTest (point /)
    (setvar "nomutt" 1) ;_ suppresses the "regen ..." prompt
    (cond
      ((= (type point) 'STR)
       (vla-update Obj)
      )
      ((vl-consp point)
       (or prev (setq prev point))
       (if (< step (distance prev point))
(progn
   (setq prev point)
   (vla-put-InsertionPoint Obj (vlax-3D-point point))
   (vla-update Obj)
) ;_ fim de progn
       ) ;_ fim de if
      )
    ) ;_ fim de cond
    (setvar "nomutt" 0)
    point
  ) ;_ fim de defun
;;;
;;;Define a funcao p/ DynDraw.arx
  (vl-acad-defun 'JoyCallBackTest)
  (setq
    point
     (dyndraw "JoyCallBackTest"
      "\nSpecify insertion point: [Enter Exit]: "
      "" ;_ Keyword string
      (+ 2 128 2048)
      -1
      nil
     ) ;_ fim de dyndraw
  ) ;_ fim de setq
;;;
  (if (vl-consp point)
    (progn
      (vla-put-InsertionPoint Obj (vlax-3D-point point))
      (vla-update Obj)
    ) ;_ fim de progn
  ) ;_ fim de if
;;;
  (vl-acad-undefun 'JoyCallBackTest)
  (princ)
)

The above code works well with DynDraw 2010 x64.arx in AutoCAD 2010.
But with higher versions the object is not shown during the drag.
Can anyone tell me why?



Title: Re: Dragging block with DynDraw
Post by: velasquez on February 11, 2016, 02:14:51 PM
Can someone please test the code I posted in a later version to AutoCAD 2010?
Any feedback would be helpful.
Title: Re: Dragging block with DynDraw
Post by: DW on February 15, 2016, 06:45:02 PM
It displays and drags without issues in 2016.  I've noticed some display problems with complex blocks in earlier versions of AutoCAD > 2009 but later versions seem to be ok.
Title: Re: Dragging block with DynDraw
Post by: Hugo on February 16, 2016, 01:32:36 AM
I can in 2016 not test because I can not load the DynDraw.arx.   :oops:

Ich kann das in 2016 nicht Testen da ich die DynDraw.arx nicht laden kann.
Title: Re: Dragging block with DynDraw
Post by: velasquez on February 16, 2016, 05:30:32 AM
Thanks for the answers.
I noticed the biggest problem in AutoCAD 2012.
Title: Re: Dragging block with DynDraw
Post by: Alexander Rivilis on April 21, 2016, 01:50:22 AM
Try to change Visual Style to other than 2D: https://knowledge.autodesk.com/community/screencast/8382346d-ba03-4591-9af2-5f4eae862467