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

Fillet rad with auto-mend

17 REPLIES 17
SOLVED
Reply
Message 1 of 18
mid-awe
494 Views, 17 Replies

Fillet rad with auto-mend

Hi all,
I was just curious if anyone is aware of a lisp that allows you to "Fillet" "Rad" lines/arcs and then will return the second line/arc picked to it's previous length so that only the first line/arc picked is trimmed. I need to do this (what seems like a million times daily) and just believe that there has to be an easier way. I'd Like to use this as a "Fillet" "mUltiple" if possible but will settle for "Fillet" "Rad".
Thanks
17 REPLIES 17
Message 2 of 18
Anonymous
in reply to: mid-awe

Frankly, I don't understand what you are trying to do - filleting and trimming are two different things. Perhaps a better explanation would help.
Message 3 of 18
mid-awe
in reply to: mid-awe

I think that I can use the no trim option of fillet trim. Thanks anyway.
Message 4 of 18
Anonymous
in reply to: mid-awe

Try this. Just a quick one. Don't think it will work with polylines though.

Tim

(defun c:FakeFillet (/ Ent1 Ent2 NewObj tmpObj FillRad OldFillet)

(setq OldFillet (getvar "filletrad"))
(if (setq FillRad (getdist "\n Enter fillet radius: "))
(while
(and
(setq Ent1 (entsel "\n Select first object to fillet: "))
(not (redraw (car Ent1) 3))
(setq Ent2 (entsel "\n Select second object to fillet: "))
(not (redraw (car Ent1) 4))
)
(setvar "filletrad" FillRad)
(setq tmpObj (vlax-ename->vla-object (car Ent2)))
(setq NewObj (vla-Copy tmpObj))
(command "_.fillet" (car Ent1) (car Ent2))
(vla-Delete tmpObj)
)
)
(setvar "filletrad" OldFillet)
(princ)
)
Message 5 of 18
mid-awe
in reply to: mid-awe

Thanks, I see what your doing but I have trouble with this. Most of the fillets that I do are arc or circles to arc or circles. When I use the code that you posted sometimes very funny things happen like the wrong ends of the arcs filleting. I've already tried rewriting the code to use getpoint but I get errors because some how I can't get the entity name in a manor which the
[code](vlax-ename->vla-object (car Ent2))[/code]is able to use. Any suggestions?
Message 6 of 18
Anonymous
in reply to: mid-awe

See what happens when you change this line
(command "_.fillet" (car Ent1) (car Ent2))
to
(command "_.fillet" Ent1 Ent2)

Tim
Message 7 of 18
mid-awe
in reply to: mid-awe

I've said it before and I'll say it again, You amaze me 🙂
That was such a simple fix and I couldn't see it.

Thanks, it seems to be working fine now.
Message 8 of 18
Anonymous
in reply to: mid-awe

I didn't know if it would work until I tested it here real quick. I guessed it would work because how else does the fillet command know which side to fillet unless it has a point, and entsel returns a point also, so I was like might as well try.

Glad it works for you.

Tim
Message 9 of 18
mid-awe
in reply to: mid-awe

Digging this one up again because I find my self working with polylines quite often too.

 

I've tried adjusting this function to allow the second entity to be a polyline by making a copy of the segment if it is a polyline picked. then I can run everything the same as before on the temporary segment/copy. Once the routine is complete, I simply delete the copied temporary segment leaving behind the original polyline and the filleted line or arc.

 

So I guess my question is: Can anyone help make T.Willey's "c:FakeFillet" program work with polylines (for the second pick)? The first pick will always be a line, circle, or arc.

 

Thank you for any help

 

* If helpful, I can share my "GetSeg" function, but it's a messy global maker.

Message 10 of 18
Kent1Cooper
in reply to: mid-awe


@mid-awe wrote:

.... Can anyone help make T.Willey's "c:FakeFillet" program work with polylines (for the second pick)? The first pick will always be a line, circle, or arc.

....


A Circle?  I would want to see an image or sample drawing of the result you're looking for, since you can't Fillet a Circle, whatever the other object is.  It sounds like a job for a Circle command with TTR option, and some trimming.

Kent Cooper, AIA
Message 11 of 18
mid-awe
in reply to: Kent1Cooper

Yeah, I do it like that now, but the fillet version works if I explode the polyline and then run it. I just pedit join again once the fake fillet is complete.

thanks
Message 12 of 18
Kent1Cooper
in reply to: mid-awe

I'd still like to see what result you expect when the first object is a Circle....

Kent Cooper, AIA
Message 13 of 18
mid-awe
in reply to: Kent1Cooper

Just an arc tangent to the two entities picked. The arc would be at the
radius defined by the user like the filet rad prompts so there is no
difference with the flow from T.Willey's program.
Message 14 of 18
Kent1Cooper
in reply to: mid-awe


@mid-awe wrote:
Just an arc tangent to the two entities picked. The arc would be at the
radius defined by the user like the filet rad prompts so there is no
difference with the flow from T.Willey's program.

I can imagine something like that....  Maybe [like Scarlet O'Hara] I'll think about that tomorrow.  In the meantime, the concept sounded familiar, and I found the attached, from 2009.  [I think it was in response to something here, but haven't been able to find the thread.]  It has the slight disadvantage, if it is one for you, that it doesn't save the current Fillet radius and restore it, but affects it.  But it has the slight advantage, if it is one, that it doesn't require you to answer a radius prompt, but has setting the Radius as an option you can call for only if you don't want to use the current value.  And its selection prompts are a little more descriptive of what's going on.  Note the coincidental remark: line 3.

Kent Cooper, AIA
Message 15 of 18
mid-awe
in reply to: Kent1Cooper

Kent,

 

That works great for a circle. T.Willey's version works as well. Unfortunately, it still has the polyline limitation.

 

I'm thinking that my "GetSeg" function is still needed. (written a looong time ago, not so clean, not too smart, but it works. It's attached.)

Message 16 of 18
hmsilva
in reply to: mid-awe

Hi mid-awe,

perhaps something like this, quick and dirty and minimally tested...

T.Willey's FakeFillet, modified...

And "The first pick will always be a line, circle, or arc."

 

(defun c:FakeFillet (/	      BLG      ENT	ENT1	 ENT2	  ENT3
		     FILLRAD  NEWOBJ   OLDFILLET	 PAR_1	  PAR_2
		     PAR_M    PT_E     PT_M	PT_S	 PT_SEL	  TMPOBJ
		    )

  (setq OldFillet (getvar "filletrad"))
  (if (setq FillRad (getdist "\n Enter fillet radius: "))
    (while
      (and
	(setq Ent1 (entsel "\n Select first object to fillet: "))
	(not (redraw (car Ent1) 3))
	(setq Ent2 (entsel "\n Select second object to fillet: "))
	(not (redraw (car Ent1) 4))
      )

       (setq Ent (car Ent2))
       (if (= (cdr (assoc 0 (entget ent))) "LWPOLYLINE")
	 (progn
	   (setq Pt_sel	(vlax-curve-getclosestpointto Ent (cadr Ent2))
		 Par_1	(fix (vlax-curve-getparamatpoint Ent Pt_sel))
		 Par_m	(+ Par_1 0.5)
		 Par_2	(1+ Par_1)
		 Pt_s	(vlax-curve-getpointatparam Ent Par_1)
		 Pt_m	(vlax-curve-getpointatparam Ent Par_m)
		 Pt_e	(vlax-curve-getpointatparam Ent Par_2)
		 Blg	(vla-getbulge (vlax-ename->vla-object Ent) Par_1)
	   )
	   (if (not (equal Blg 0.0 1e-8))
	     (command "_.arc" "_none" Pt_s "_none" Pt_m "_none" Pt_e)
	     (command "_.line" "_none" Pt_s "_none" Pt_e "")
	   )
	   (setvar "filletrad" FillRad)
	   (setq Ent3 (list (entlast) (cadr Ent2)))
	   (command "_.fillet" Ent1 Ent3)
	   (entdel (car Ent3))
	 )
	 (progn
	   (setvar "filletrad" FillRad)
	   (setq tmpObj (vlax-ename->vla-object (car Ent2)))
	   (setq NewObj (vla-Copy TmpObj))
	   (command "_.fillet" Ent1 Ent2)
	   (vla-Delete TmpObj)
	 )
       )
    )
  )
  (setvar "filletrad" OldFillet)
  (princ)
)

 

HTH

Henrique

 

 

EESignature

Message 17 of 18
mid-awe
in reply to: hmsilva

That's awesome Henrique! =D

Thank you so much. (This will quickly save me so much time, I can't thank you enough.)
Message 18 of 18
hmsilva
in reply to: mid-awe

You're welcome, mid-awe
Glad I could help

Henrique

EESignature

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

Post to forums  

Autodesk Design & Make Report

”Boost