PDA

View Full Version : Enhanced chamfer needed



MarcoW
23rd Oct 2009, 06:49 am
Hello,
Been on the swamp but could not get any solution.
Maybe somebody over here can help me out.
This is my post:
----------------
I played with the routines in this threat:
http://www.theswamp.org/index.php?topic=17392.0
(http://www.theswamp.org/index.php?topic=17392.0)
If one of the 2 codes below (thanks to CAB and A_LOTA_NOTA) would work with chamfer and polylines it would be great.
But I have no clue why it don't work.

Maybe you guys can help me out?

In the end the result is the same as it is now but only I have polylines and the arc's can be straight lines...



(defun c:efillet (/ e1 e2 elst OldRad Entz)
(if (not (zerop (getvar "filletrad")))
(progn
(while (not e1)
(initget 1 "Radius")
(setq e1 (entsel "Select first object or [Radius]:"))
(if (or (= e1 "Radius") (= e1 "R"))
(progn
(setq OldRad (rtos (getvar "filletrad")))
(setq NewRad (getreal (strcat "\nSpecify fillet radius < " OldRad " > : ")))
(if (/= NewRad nil)
(setvar "filletrad" NewRad)
)
(setq e1 nil)
)
)
)
(setq Entz (car e1))
(redraw Entz 3)
(while (not e2)
(setq e2 (entsel "\nSelect line to keep"))
)
(setq elst (entget (car e2)))
(not (command "_fillet" e1 e2))
(equal (assoc 0 (entget (entlast))) '(0 . "ARC"))
(entmod elst)
)
(progn
(prompt "\nRadius must be > 0.")
)
)
(princ)
)


or



;; CAB 07.09.07
(defun c:efillet1 (/ e1 e2 elst rad)
(defun set_radius (/ NewRad)
(if
(and
(not (initget 6))
(setq NewRad (getdist (strcat "\nSpecify fillet radius < "
(rtos (getvar "filletrad"))
" > : ")))
)
(setvar "filletrad" NewRad)
)
nil
)

(if (zerop (getvar "filletrad"))
(set_radius)
)

(while
(progn
(initget "Radius")
(setq e1 (entsel "\nSelect line to fillet or [Radius]:"))
(if (= e1 "Radius")
(set_radius)
)
(/= (type e1) 'list)
)
)
(while (not (setq e2 (entsel "\nSelect line to keep"))))
(setq elst (entget (car e2)))
(command "_fillet" e1 e2)
(if (> (getvar "CMDACTIVE") 0)
(progn
(command)
(princ "\nCannot fillet between these two entities.")
)
(if (equal (assoc 0 (entget (entlast))) '(0 . "ARC"))
(entmod elst)
)
)
(princ)
)




AN other way to put it:
How to get 2 lines chamfered in a way that the first line selected is chamfered and the second stays unchanged.

Tnx in advance!

ollie
5th Nov 2009, 08:32 pm
Sadly don't have time to write the script just now, so here's some psuedo code to help you for now

Select ent 1 (ent1)
Select ent 2 (ent2)

Determine point of ent1 that the chamfer is going to affected (first or last point) (Pt1)

Determine point of ent2 that is closest to previously defined point (pt2)

Use (vla-appendvertex ) to append a new point to ent1 that has pt2's coordinates

Hope that helps for now

Ollie

MarcoW
6th Nov 2009, 07:22 am
I'll dig in to it whenever I have time to do so. Thank you for reply!