jjatho Posted May 22, 2014 Share Posted May 22, 2014 I'll explain what I'm trying to achieve, in case there is an easier way to do this... I need to create a promo video for some upcoming events and I want to show a drawing coming together line by line. I'm basically taking some 3D models and using Flatshot to turn them 2D. My idea is to take this 2D drawing and delete the entire thing line by line while taking a screenshot after each deletion, then create a video playing them in reverse to make it appear like the drawing is coming together line by line. To make it a little easier, it could just be furthest (or closest) object from the origin, so that no additional human input is required. This would allow me to use AutoHotKey to automate the entire process. It'd also be nice, if possible, to be able to select based on distance in X or Y direction only, so I could make some videos where things appear to grow vertically instead of "radially" as they might if absolute distance is used for selection. Quote Link to comment Share on other sites More sharing options...
jdiala Posted May 22, 2014 Share Posted May 22, 2014 if the desired delay time was not meet. Change the minus to plus and run the command then use the undo command while recording the screen. (defun C:test (/ p ss lst) (if (and (setq p (getpoint "\nPick a point")) (setq ss (ssget "_x")) ) (foreach x (vl-sort (repeat (setq i (sslength ss)) (setq lst (cons (ssname ss (setq i (1- i))) lst)) ) (function (lambda (a b) (< ([color="red"]-[/color] (cadr p) (cadr (cdr (assoc 10 (entget a))))) ([color="red"]-[/color] (cadr p) (cadr (cdr (assoc 10 (entget b))))) ) ) ) ) (vla-erase (vlax-ename->vla-object x)) (vl-cmdf "delay" 100) ;; Change delay here ) ) ) Quote Link to comment Share on other sites More sharing options...
jjatho Posted May 22, 2014 Author Share Posted May 22, 2014 Getting this output with nothing deleted: Pick a point; error: Automation Error. Description was not provided. Command: Also, it'd be better for my purposes if the reference point was just set to (0,0) and if only one object was deleted per time it was used, with the script quitting after. Quote Link to comment Share on other sites More sharing options...
neophoible Posted May 22, 2014 Share Posted May 22, 2014 (edited) As an experiment, I tried using this code: (defun C:DELALL (/ X) (while (setq X (entlast)) (entdel X) (vl-cmdf "delay" 100) ) (princ) ) On the one drawing I tried it on, the disappearance of objects was rather choppy. But, afterward, when I entered U, then held down Enter, the rebuilding seemed rather smooth. ***WARNING: The above code will delete all objects in a drawing. If you save it that way and exit, it is gone!*** Edited May 22, 2014 by neophoible added Warning Quote Link to comment Share on other sites More sharing options...
neophoible Posted May 22, 2014 Share Posted May 22, 2014 It is also possible to create a slide of each change and build a script file that will show the "drawing" coming together. Quote Link to comment Share on other sites More sharing options...
jdiala Posted May 22, 2014 Share Posted May 22, 2014 Getting this output with nothing deleted: Pick a point; error: Automation Error. Description was not provided. Command: Also, it'd be better for my purposes if the reference point was just set to (0,0) and if only one object was deleted per time it was used, with the script quitting after. Works on my side. Try adding a filter to the ssget. (defun C:test (/ p ss lst) (if (and (setq p (getpoint "\nPick a point")) (setq ss (ssget "_x" [color="red"]'((0 . "*LINE,INSERT,*TEXT,SOLID,*LEADER,ARC,CIRCLE"))[/color])) ) (foreach x (vl-sort (repeat (setq i (sslength ss)) (setq lst (cons (ssname ss (setq i (1- i))) lst)) ) (function (lambda (a b) (< (+ (cadr p) (cadr (cdr (assoc 10 (entget a))))) (+ (cadr p) (cadr (cdr (assoc 10 (entget b))))) ) ) ) ) (vla-erase (vlax-ename->vla-object x)) (vl-cmdf "delay" 100) ;; Change delay here ) ) ) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 23, 2014 Share Posted May 23, 2014 A bit more complicated but you could record every objects id as you erase or even move writing to a file, close same dwg no save then write a script that erase the objects so no user input you will not see the screen hairs moving, as you record you can have delays between each erase use the vl delay above then like you said play it backwards. I think a move would be better than just object apears "undo erase" you could loop the move steps so move one object multiple times till off the screen get some form of smoothness. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.