Jump to content

Any help to make lisp file?


hosyn

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This is my routine:

(DEFUN C:fl   () (COMMAND "_FILLET" "p" "7" ))

and i wanna this repeat for all pline in selection set (ssget)

thanxxx

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by hosyn
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...