
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all, I've been dealing with this frustrating issue for a while now, and cannot for the life of me figure it out. At my company, we have two simple scripts that move a selected entity up or down 3600 inches. Here's the code for "Move Down" and "Move Up" respectively:
(defun c:md (/ ss) (setq ss nil) ;Set ss to nil (setq ss (ssget)) ;Grab the user selection (command "move" ss "" "" "0,-3600.0" ) ;Move the selection by 3600 (sssetfirst nil ss) ;Retain the user selection. (Enables successive "mu" or "md") (princ) );defun
(defun c:mu (/ ss) (setq ss nil) (setq ss (ssget)) (command "move" ss "" "" "0,3600.0" ) (sssetfirst nil ss) (princ) );defun
Seems pretty simple, right? The problem is, sometimes, this command will move the entity not quite 3600 inches. Say, sometimes 3595.5347 inches. Sometimes it will move the object 4.4653 inches. Sometimes more or less, those numbers change between drawings (and sometimes in the same drawing).
As well, it seems to be dependent on the user's zoom level. It doesn't seem to happen at all when the user is zoomed in on the entity. It only happens when the user is zoomed out on the drawing. It doesn't happen if you manually move the entity 3600 inches either, so it must be a Lisp thing.
I've attached a drawing where I'm seeing this behavior. The horizontal lines are all offset exactly 3600" from each other. If I have my zoom level so the boxes fills most of my screen, the commands move the boxes exactly 3600". If I zoom out so I can see all the horizontal lines, the command will move the boxes not quite 3600" and there'll be a slight error between the position of the boxes and the horizontal lines.
I've also noticed the same issue using the "copy" command in this way.
Any insight into this would be greatly appreciated. Is there something wrong with my code, or maybe some autocad setting somewhere? I feel like it's probably something blatantly obvious, but nothing I've tried has worked.
Maybe the vla-move command wouldn't have this error?
Solved! Go to Solution.