Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

fillet certain vertices of a polyline

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
Anonymous
1748 Views, 6 Replies

fillet certain vertices of a polyline

I would like to fillet certain vertices of a polyline by selecting them.

 

not the whole polyline.

 

the radius would be set as part of the lisp.

 

I have seen several examples, but they are old and replaced by the default fillet command with the p variable.

 

Thanks,

6 REPLIES 6
Message 2 of 7
Kent1Cooper
in reply to: Anonymous


@Anonymous wrote:

I would like to fillet certain vertices of a polyline by selecting them.

 

not the whole polyline.

 

the radius would be set as part of the lisp.

....


Assuming that you mean to select once at a vertex, in simplest terms and lightly tested, try this:

(vl-load-com)
(defun C:FPSV (/ ver pl par); = Fillet Polyline at Selected Vertices
  (setvar 'osmode 1); ENDpoint only
  (command "_.fillet" "_radius" pause)
  (while
    (and
      (setq ver (getpoint "\nPolyline Vertex to Fillet: "))
      (wcmatch (cdr (assoc 0 (entget (setq pl (ssname (ssget ver) 0))))) "*POLYLINE")
    ); and
    (setq par (vlax-curve-getParamAtPoint pl ver))
    (command
      "_.fillet"
      (vlax-curve-getPointAtParam pl
        (-
          (if (= par 0) (vlax-curve-getEndParam pl) par)
          0.25
        ); -
      ); ...getPoint
      (vlax-curve-getPointAtParam pl
        (+
          (if (= par (vlax-curve-getEndParam pl)) 0 par)
          0.25
        ); +
      ); ...getPoint
    ); command
  ); while
  (princ)
)

 

HOWEVER, be aware that so far it doesn't account for certain possibilities:

 

1)  It will fail if you pick at a vertex that has an arc segment on either side [it could be made to notify the User and continue, rather than end, but it would add considerable complexity].  Consequently, it won't re-Fillet an already-Filleted corner at a different radius, the way regular Fillet can do in a Polyline, but requires that a "sharp" corner be selected;

 

2)  It doesn't disallow Polylines on locked Layers;

 

3)  It would allow selection on a 3D Polyline, which can't be Filleted;

 

4)  It could fail or have unintended results if there are other things in the area that the Fillet command might "see" at the places where it picks on the Polyline segments.  [Unfortunately, unlike with the Break command, which you can give an entity name and then the Break points, you can't give Fillet an entity name and then the pick points, to ensure its not seeing some other object(s).]

 

And it doesn't save the current OSMODE or FILLETRAD settings and reset them when done, nor have error handling or command-echo suppression or Undo begin-end wrapping, or other bells and whistles, but those can be added if it otherwise does what you're after.

Kent Cooper, AIA
Message 3 of 7
john.uhden
in reply to: Kent1Cooper

In 2002, I was able to refillet a polyline corner with a different radius using the original two pickpoints.

It appears that the command wants just pickpoints, excluding the ENAME.  Since what you say about possibly picking some other nearby object is true, then I would recommend using (vlax-curve-getclosestpointtoprojection) to ensure that the points selected are dead on the polyline.

Of course one should also make sure that both picks have adjacent, but not equal (fix param) values.

 

Or, do the whole thing mathematically, without the fillet command via (vlax-put Object 'Coordinates ...) and (vla-setbulge).

John F. Uhden

Message 4 of 7
john.uhden
in reply to: Kent1Cooper

My apologies, Kent.

 

You used getpointatparam, which of course gets a point dead on the target.

I do think it could be improved by allowing the selected point to be near the midpoint of an already filleted corner, then adjusting the params to be 1- and 1+ the selected param to supply the new radius.  Of course if the selected param is 0.5, then back up the first param to be the endparam + 0.5±.

 

BTW, what's that "spoiler" thingy I see all the time?  How do you do that?

John F. Uhden

Message 5 of 7
Kent1Cooper
in reply to: john.uhden


@john.uhden wrote:

....

I do think it could be improved by allowing the selected point to be near the midpoint of an already filleted corner, then adjusting the params to be 1- and 1+ the selected param to supply the new radius. ....

 

BTW, what's that "spoiler" thingy I see all the time?  How do you do that?


Yes, I was thinking along the same lines, allowing MIDpoint as well as ENDpoint Osnap, and determining for a x.5 Parameter value [a midpoint] whether it's the midpoint of an arc segment with something like an Osnap-CENter test, if a way can be found to prevent it from snapping to some other object with a center that might be in the vicinity.

 

The spoiler pulldowns you see have, unfortunately, recently become something you can't do any more.  They don't explain what the "moderation reasons" are.

Kent Cooper, AIA
Message 6 of 7
john.uhden
in reply to: Kent1Cooper

I know you like the (osnap) function.  I would probably use the getbulge method based on starting with entsel to get both the entity name and approximate pick point followed by getclosestpointto.  No snap worries.

.

Thanks for informing me about the spoiler.

John F. Uhden

Message 7 of 7
Kent1Cooper
in reply to: Anonymous

I've been fiddling with this off and on for a while, and it seems to be in a condition to Post here.  The attached overcomes some of the shortcomings mentioned, and incorporates some of the possibilities [such as picking at a midpoint rather than at a vertex, and having it Fillet the adjacent segments, to re-Fillet a corner at a different radius with one pick].  See the comments at the top of and within the file.

Kent Cooper, AIA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report