BIGAL Posted August 4, 2022 Posted August 4, 2022 It is a know fact that sometimes a lisp will fail due to scale of current view, has been for years a problem. My suggestion would be look at (setvar 'osmode 0) in your code, even osmode 1 "endpoint" is enough to snap to wrong points, you can reset osmode as often as you need in your code. 0 works for me 16384 is all off. Quote
Jamescalabut Posted August 4, 2022 Posted August 4, 2022 @BIGAL, I see osmde 16384 is like selecting nothing and also clicking F3 (object Reference OFF), which avoids those silly fails in lisp programs. I've been using "osmode" 0 due to my lack of knowledge, but your idea is far better. Thanks, Quote
mhupp Posted August 4, 2022 Posted August 4, 2022 (edited) Here is my attempt. only need the two points and width. then use boundary to create the "rectangle". Should work 100% of the time unless the side entity's are two short or something is in between them. --edit or if you pick points are not close to the side entity's so that the mpt isn't in between them. (defun C:FOO (/ ss dist pt1 pt2 mpt vec line) (setq ss (ssadd)) (setq dist (/ (getreal "\nWidth: ") 2.0) pt1 (getpoint "\nSelect First Point:") pt2 (getpoint pt1 "\nSelect Scond Point:") MPT (mapcar '/ (mapcar '+ pt1 pt2) '(2 2 2)) vec (mapcar '/ (mapcar '- pt2 pt1) (list (distance pt1 pt2) (distance pt1 pt2) (distance pt1 pt2))) ) (entmake (list '(0 . "XLINE") '(100 . "AcDbEntity") '(100 . "AcDbXline") (cons 10 pt1) (cons 11 vec))) (setq line (vlax-ename->vla-object (entlast))) (vla-offset line dist) (ssadd (entlast) ss) (vla-offset line (- dist)) (ssadd (entlast) ss) (vla-delete line) (vl-cmdf "_.-Boundary" "_non" MPT "") (vl-cmdf "_.Erase" SS "") ) Edited August 4, 2022 by mhupp Quote
BIGAL Posted August 4, 2022 Posted August 4, 2022 Nice idea making a bpoy etc, so much easier than calcs of intersectwith, if want to keep the base line add (command "OOPS") after creating boundary and it will reappear. Quote
Abrasive Posted August 5, 2022 Author Posted August 5, 2022 I like it! The XLINES don't erase when I run it though? maybe a setting I need to change? Thanks 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.