hosyn Posted July 25, 2014 Share Posted July 25, 2014 Hi guys I have a routine with name "fl" for modify pline in my drawing and it operate for any pline one by one via selecting user ,,i wanna write a loop for do this routine for all pline in my selection set that automatically select pline and do "fl" until the end .something like this: (foreach pline in selection set do "fl") (repeat) Appreciate for any idea and helping best regard Quote Link to comment Share on other sites More sharing options...
Snownut Posted July 25, 2014 Share Posted July 25, 2014 How do you propose to build your selection set of pline's. Would you be individually selecting plines to build the set or do you want to apply to all plines in the drawing ? You also need to post the "fi" code, it is likely that will need some modification as there is likely a "get..." function in there that will not be needed, and the function definition would need to be modified like; defun c:fi ( x / .........) You hit it on the head though with the foreach function; (foreach x plinelist (fi x) ) Where plinelist is your selection set list of pline's, no need for the repeat as the foreach function is essentially doing that. Quote Link to comment Share on other sites More sharing options...
hosyn Posted July 25, 2014 Author Share Posted July 25, 2014 This is my routine: (DEFUN C:fl () (COMMAND "_FILLET" "p" "7" )) and i wanna this repeat for all pline in selection set (ssget) thanxxx Quote Link to comment Share on other sites More sharing options...
Snownut Posted July 25, 2014 Share Posted July 25, 2014 After a little searching I found this code from Tharwat, (although it looks like the header info was previously removed, the poster did give credit to Tharwat though) on another site. (defun c:Test (/ ss fr) (if (setq ss (ssget "_:L" '((0 . "LWPOLYLINE")))) (progn (setq fr (getvar 'FILLETRAD)) (setvar 'FILLETRAD 0) ;CHANGE THIS VALUE TO WHATEVER RADIUS YOU DESIRE ((lambda (i / sn) (while (setq sn (ssname ss (setq i (1+ i)))) (vl-cmdf "_.fillet" "_Polyline" sn) ) ) -1 ) (setvar 'FILLETRAD fr) ) ) (princ) ) This runs fine, just select all your plines at once when prompted. Quote Link to comment Share on other sites More sharing options...
hosyn Posted July 26, 2014 Author Share Posted July 26, 2014 (edited) Appreciateeeeeeeeeeee so much mate and is there a way for modify it for adjust linweight and line type of plines and color??? (for example lineweight 0.2 and continues and blue) Edited July 26, 2014 by hosyn Quote Link to comment Share on other sites More sharing options...
Snownut Posted July 26, 2014 Share Posted July 26, 2014 Try this; (defun c:Test (/ ss fr) (if (setq ss (ssget "_:L" '((0 . "LWPOLYLINE")))) (progn (setq fr (getvar 'FILLETRAD)) (setvar 'FILLETRAD 0) ;CHANGE THIS VALUE TO WHATEVER RADIUS YOU DESIRE ((lambda (i / sn) (while (setq sn (ssname ss (setq i (1+ i)))) (vl-cmdf "_.fillet" "_Polyline" sn "_.change" sn "" "Properties" "Color" "Blue" "LWeight" "0.2" "LType" "continuous" "" ) ) ) -1 ) (setvar 'FILLETRAD fr) ) ) (princ) ) Have fun. Quote Link to comment Share on other sites More sharing options...
hosyn Posted July 29, 2014 Author Share Posted July 29, 2014 Soooo thanxxxxxxx Mr Snownut Quote Link to comment Share on other sites More sharing options...
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.