multiple fillet

multiple fillet

rawi88
Explorer Explorer
1,601 Views
7 Replies
Message 1 of 8

multiple fillet

rawi88
Explorer
Explorer

i have this lisp to apply multiple fillet for lines,

i need your help to mofdifiy it to apply this for polylines and and arcs 

thanks alot

 

 

 

(defun c:mfillet ( / CONT ELEM ELEM2 LISTA PTO1E1 PTO1E2 PTO2E1 PTO2E2 PTOCRUCE TIPOENT)
(setvar "qaflags" 1)
(setq lista (ssget))
(setq elem (ssname lista 0))
(setq cont 0)
(princ "\nChecking for LINES... ")
(while (< cont (sslength lista))
(setq tipoent (cdr (assoc 0 (entget elem))))
(princ "-")
(princ cont)
(if (/= tipoent "LINE")
(setq lista (ssdel elem lista))
)
(if (/= tipoent "LINE")
(setq cont (1- cont))
)
(setq cont (1+ cont))
(setq elem (ssname lista cont))
)
;Checking the instersecctions
(while (> (sslength lista) 1)
(setq elem (ssname lista 0))
(setq pto1e1 (cdr (assoc 10 (entget elem))))
(setq pto2e1 (cdr (assoc 11 (entget elem))))
(setq cont 1)
(setq elem2 (ssname lista 1))
(while (< cont (sslength lista))
(setq pto1e2 (cdr (assoc 10 (entget elem2))))
(setq pto2e2 (cdr (assoc 11 (entget elem2))))
(setq ptocruce (inters pto1e1 pto2e1 pto1e2 pto2e2))
(if (/= ptocruce nil)
(command "fillet" "R" "3" elem elem2)
)
(setq cont (1+ cont))
(princ cont)
(princ ".")
(setq elem2 (ssname lista cont))
)
(setq lista (ssdel elem lista))
)
(setvar "qaflags" 0)
(princ)
)

0 Likes
1,602 Views
7 Replies
Replies (7)
Message 2 of 8

ВeekeeCZ
Consultant
Consultant

That looks easy. Replace the word 

"LINE"

anywhere is mentioned in the code with 

"LINE,POLYLINE,ARC"

Note that there no spaces in between.

 

Message 3 of 8

rawi88
Explorer
Explorer

thanks for your replay,

i tried it but not working

0 Likes
Message 4 of 8

ВeekeeCZ
Consultant
Consultant

You're welcome! Trying to figure out what could go wrong... Please double-check whether you didn't put any spaces in between...

0 Likes
Message 5 of 8

rawi88
Explorer
Explorer

I sched it again, not working again

kindly find the attached  screenshots for the issue and the lisp

0 Likes
Message 6 of 8

Kent1Cooper
Consultant
Consultant

@rawi88 wrote:

.... i tried it but not working


This:

(if (/= tipoent "LINE")

would need to be changed more than just replacing "LINE" with "LINE,POLYLINE,ARC", i.e. something like:

(if (not (wcmatch tipoent "LINE,*POLYLINE,ARC"))

But beyond that, the whole thing later on uses (assoc 10) and (assoc 11) entries in entity data, which in this context are specific to Line entities  [their start and end points].  Far more  would need to be adjusted to make it work with Arcs, and Polyline end segments, and to account for Polylines that may have either a line or arc segment at the appropriate end.  Just for starters, the (inters) function used will not be appropriate at all for such curves.  I'm sorry to say this, but I think you need a wholesale re-write....

Kent Cooper, AIA
Message 7 of 8

ВeekeeCZ
Consultant
Consultant

Yeah, it's never that easy many might think... Kent's right, you need to re-write a whole thing.

0 Likes
Message 8 of 8

Kent1Cooper
Consultant
Consultant

@Kent1Cooper wrote:
....  I'm sorry to say this, but I think you need a wholesale re-write....

 

... which will not  be a simple thing to do, if even possible in some situations.  For example:

MFilletIssue.JPG

The cyan at the left is an Arc, the green in the middle is a Line, and the red on the right is a Polyline.

 

The way your Lines-only routine works, it steps through the Lines in the selection, in whatever order they fall in it, and for each one as "base" object, steps through the remaining Lines, comparing them with the base object, and if that intersects any, they are Filleted at a radius of 3 drawing units.  [Ignoring the fact that 3 units will not always be a valid radius for Filleting certain combinations of Lines.]

 

Now let's say in this image that the green Line is the current base object being compared to others.  If it is compared to the red Polyline before  it is compared to the cyan Arc, and the two are Filleted, the Line [and the resulting arc segment from Filleting] will become part of the red Polyline, and therefore the Line will no longer exist to have the Arc compared to it.

 

Or let's say the red Polyline becomes the base object before the others.  When it gets Filleted with the green Line, again that Line will no longer exist, but its entity name will still be in the selection set, and subsequent attempts to compare other things to it, as well as use of it as a later base object, will run into trouble.

 

Then there's the problem that you can't Fillet a Polyline and an Arc together, but would need to do something like calculate where to draw an Arc and then Trim the source objects to it.

 

And what about things that meet tangentially?  Filleting [or equivalent construction] would be meaningless [and AutoCAD already forbids Filleting collinear Lines].

 

It may  be possible to account for such difficulties, but it would not be a simple thing.

 

EDIT:  Here's another issue....  The Lines-only one Fillets by giving entity names, which is okay for Lines if you don't mind that it always keeps the longer part of each Line relative to the intersection point [not affected by pick location as with manual Filleting, since there is no pick location with entity names].  But with a Line and an Arc, you can get this kind of thing:

MFilletIssue2.JPG

Kent Cooper, AIA