@marko can you please post a video?
Ok now it works. I try if I can modify it to see the objects during the drag (even without the attributes). Thank you so much for your time. :-)@marko can you please post a video?
You have to test it and see if that's what you're looking for...
Code slightly changed...
Regards, M.R.
BTW. Now it doesn't matter how do you pick window... It is assumed that you work with WCS...
; (ALE_Edit_StretchAttribLayer "*")
;
(defun ALE_Edit_StretchAttribLayer (LyrNms / Pnt001 Pnt002 Ss_Str EntNam Countr)
(if
(and
(setq Pnt001 (getpoint "\nSpecify first corner of Crossing Window: "))
(not (initget 32))
(setq Pnt002 (getcorner Pnt001 "\nSpecify opposite corner: "))
)
(progn
(if (setq Ss_Str (ssget "_C" Pnt001 Pnt002 (list (cons 8 LyrNms))))
(progn
(princ "\nBase point: " ) (vl-cmdf "_.STRETCH" Ss_Str "" "\\") (setq Pnt001 (getvar "LASTPOINT"))
(princ "\nSecond point: " ) (vl-cmdf "\\" ) (setq Pnt002 (getvar "LASTPOINT"))
(repeat (setq Countr (sslength Ss_Str))
(and
(= (cdr (assoc 0 (entget (setq EntNam (ssname Ss_Str (setq Countr (1- Countr))))))) "INSERT")
(mapcar
(function
(lambda (a)
(vla-move a (vlax-3d-point (trans Pnt001 1 0)) (vlax-3d-point (trans Pnt002 1 0)))
)
)
(vlax-invoke (vlax-ename->vla-object EntNam) 'getattributes)
)
)
)
)
(princ "\nNo Objects to Stretch found in Crossing Window.")
)
)
)
(princ)
)
What if not all attribute references are inside the CW?
I actually have, but I see you have revised it. Your previous code did have this problem.What if not all attribute references are inside the CW?
You should have tested my code...
What if not all attribute references are inside the CW?Was this question also for me?
; (ALE_Edit_StretchAttribsByLayer "*")
;
; LyrNms: Layer names - Wcmatch string > "Layer1,Layer2*" or "*" for all
;
(defun ALE_Edit_StretchAttribsByLayer (LyrNms / PntCr1 PntCr2 PntSt1 PntSt2 Ss_Str Ss_Blk EntNam EntDat Countr)
; Marc'Antonio Alessi - Rel. 1.01
(if
(and
(setq PntCr1 (getpoint "\nSpecify first corner of Crossing Window: "))
(not (initget 32))
(setq PntCr2 (getcorner PntCr1 "\nSpecify opposite corner: "))
)
(progn
(if (setq Ss_Str (ssget "_C" PntCr1 PntCr2 (list (cons 8 LyrNms))))
(progn
(setq Ss_Blk (ssadd))
(repeat (setq Countr (sslength Ss_Str))
(and
(= (DXF 0 (setq EntDat (entget (setq EntNam (ssname Ss_Str (setq Countr (1- Countr))))))) "INSERT")
(not (ALE_Math_InWindowP (DXF 10 EntDat) (list PntCr1 PntCr2)))
(setq Ss_Str (ssdel Entnam Ss_Str) Ss_Blk (ssadd Entnam Ss_Blk))
)
)
(princ "\nBase point: " ) (vl-cmdf "_.STRETCH" Ss_Str "" "\\") (setq PntSt1 (getvar "LASTPOINT"))
(princ "\nSecond point: " ) (vl-cmdf "\\" ) (setq PntSt2 (getvar "LASTPOINT"))
(repeat (setq Countr (sslength Ss_Blk))
(setq EntNam (ssname Ss_Blk (setq Countr (1- Countr))))
(mapcar
(function
(lambda (a)
(and
(ALE_Math_InWindowP (vlax-get a 'InsertionPoint) (list PntCr1 PntCr2))
(vla-move a (vlax-3d-point (trans PntSt1 1 0)) (vlax-3d-point (trans PntSt2 1 0)))
)
)
)
(vlax-invoke (vlax-ename->vla-object EntNam) 'getattributes)
)
)
)
(princ "\nNo Objects to Stretch found in Crossing Window.")
)
)
)
(princ)
)
(defun ALE_Math_InWindowP (TstPnt PntLst / LowLft UppRgt)
(setq
PntLst (mapcar '(lambda (x) (apply 'mapcar (cons x PntLst))) '(min max))
LowLft (car PntLst)
UppRgt (cadr PntLst)
)
(and
(< (car LowLft) (car TstPnt) (car UppRgt))
(< (cadr LowLft) (cadr TstPnt) (cadr UppRgt))
)
)
(defun Dxf (DxfCod EntDat) (cdr (assoc DxfCod EntDat)))