samifox Posted January 14, 2019 Posted January 14, 2019 hi I usually insert a scanned pdf to the drawing, and calculating what is the scale factor so the image will fit as close as possible to the geometry (which are the same), using the Align command is almost perfect for this but it doesn't scale . is there any lisp anywhere that I can use, make it act exactly like the "align" command but with a scale calculation. meaning select the image lunch the command select first point in the image select the second point in the image in the geometry, select a corresponding first point in the geometry, select a corresponding second point calculate location, rotation, scale thanks shay Quote
ronjonp Posted January 14, 2019 Posted January 14, 2019 (edited) Why not combine the align command with scale reference? Here is a simple example with little error checking: (defun c:foo (/ e p1 p2 p3 p4) (cond ((and (setq e (entsel "\nPick object to scale/align/rotate: ")) (setq p1 (getpoint "\nPick base point: ")) (setq p2 (getpoint "\nPick second point: ")) (setq p3 (getpoint "\nPick first reference point: ")) (setq p4 (getpoint "\nPick second reference point: ")) ) (setq e (vlax-ename->vla-object (car e))) (vlax-invoke e 'scaleentity p1 (/ (distance p3 p4) (distance p1 p2))) (vlax-invoke e 'rotate p1 (- (angle p3 p4) (angle p1 p2))) (vlax-invoke e 'move p1 p3) ) ) (princ) ) (vl-load-com) Edited January 14, 2019 by ronjonp 2 Quote
eldon Posted January 14, 2019 Posted January 14, 2019 (edited) 3 hours ago, samifox said: ....using the Align command is almost perfect for this but it doesn't scale ....... When I use the Align command, it always scales when I tell it to. Perhaps you are not using it correctly, or is it only with PDFs that it doesn't? Edited January 14, 2019 by eldon Quote
samifox Posted January 14, 2019 Author Posted January 14, 2019 2 hours ago, eldon said: When I use the Align command, it always scales when I tell it to. Perhaps you are not using it correctly, or is it only with PDFs that it doesn't? in the knowledge base, it says that the command move, rotate and tilt, not scaling. how come your command also scaling? Quote
samifox Posted January 14, 2019 Author Posted January 14, 2019 3 hours ago, ronjonp said: Why not combine the align command with scale reference? Here is a simple example with little error checking: (defun c:foo (/ e p1 p2 p3 p4) (cond ((and (setq e (entsel "\nPick object to scale/align/rotate: ")) (setq p1 (getpoint "\nPick base point: ")) (setq p2 (getpoint "\nPick second point: ")) (setq p3 (getpoint "\nPick first reference point: ")) (setq p4 (getpoint "\nPick second reference point: ")) ) (setq e (vlax-ename->vla-object (car e))) (vlax-invoke e 'scaleentity p1 (/ (distance p3 p4) (distance p1 p2))) (vlax-invoke e 'rotate p1 (- (angle p3 p4) (angle p1 p2))) (vlax-invoke e 'move p1 p3) ) ) (princ) ) (vl-load-com) ill give it a try thanks Quote
steven-g Posted January 14, 2019 Posted January 14, 2019 (edited) It scales and rotates for me!!! pick first source point pick first destination point pick second source point pick second destination point ....from there you can choose third points or press enter and it then prompts "Scale objects based on alignment points? [Yes/No] <N>:" choosing yes scales and rotates the PDF (same for images and other geometry) Edited January 14, 2019 by steven-g Quote
eldon Posted January 15, 2019 Posted January 15, 2019 14 hours ago, samifox said: in the knowledge base, it says that the command move, rotate and tilt, not scaling. how come your command also scaling? I read the command line. Perhaps the knowledge base does not tell everything. The default is for no scaling, but if you choose the Yes option at the appropriate time, it will scale for you. Quote
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.