Move all objects to snap conformity
Move all objects to snap conformity
(OP)
I have a large diagram built by a CAD felon. He didn't use Snap. I'd like to select everything and have each item moved to the nearest snap point. Is there such a command?
_______________________________
Never confuse movement with action -- E. Hemingway
RE: Move all objects to snap conformity
But what all items would need to be moved, just line endpoints? If a block or text, the insert point? Polyline vertices?
RE: Move all objects to snap conformity
_______________________________
Never confuse movement with action -- E. Hemingway
RE: Move all objects to snap conformity
Select all text entities, extract coordinates of insert point, "round" those x & y values to the x & y snap settings, substitute the rounded values into the entity data of the text, "entmod" to update/edit the text location.
RE: Move all objects to snap conformity
_______________________________
Never confuse movement with action -- E. Hemingway
RE: Move all objects to snap conformity
In the meantime you could explode all mtext to text, and use the Express Tools "tjust" to make sure all have the same justification (if not a problem).
RE: Move all objects to snap conformity
Try pasting the following lisp code into a file, save and load. Tested briefly on text entities. Starts with "txtsnap".
==========================================
(defun c:txtsnap ()
(command "undo" "be")
(setq SnapStart (getvar "SNAPBASE"))
(setq Xstart (car SnapStart)
YStart (cadr SnapStart)
)
(setq xsnap (getreal "\nEnter x snap spacing: "))
(setq ysnap (getreal "\nEnter y snap spacing: "))
(setq txtset (ssget '((0 . "*TEXT"))))
(setq LenSet (sslength txtSet))
(setq Ecount 0)
(repeat LenSet
(setq Ename (ssname txtset Ecount))
(setq Edata (entget Ename))
(setq InsPt (cdr (assoc 10 Edata)))
(setq Xins (car InsPt)
Yins (cadr InsPt)
)
(setq Xround (roundsnap Xins xsnap xstart)
YRound (roundsnap Yins ysnap ystart)
PtRound (list Xround YRound)
)
(setq NewInsData (cons 10 PtRound))
(setq newdata (subst NewInsdata (assoc 10 Edata) Edata))
(entmod Newdata)
(setq ECount (1+ Ecount))
)
(command "undo" "e")
(princ)
)
;;--------------------------------
(defun roundsnap (val incr base)
(setq Snapdist (- val base))
(setq NewNum (/ Snapdist incr))
(setq NumSteps (atoi (rtos NewNum 2 0)))
(setq Rounded (* NumSteps incr))
(setq NewCoord (+ base rounded))
)
RE: Move all objects to snap conformity
Many thanks, Carl!
_______________________________
Never confuse movement with action -- E. Hemingway
RE: Move all objects to snap conformity