0 Members and 1 Guest are viewing this topic.
chamfer:dialog{ label="shaft / hole chamfer "; :boxed_row { label="stype"; width=5; :radio_button { label="Hole chamfer"; key="HC"; value=1; width=2; } :radio_button { label="Shaft chamfer"; key="FC"; value=0; width=2; } } :row { :edit_box { label="Distance"; key="DST"; width=9; value="5"; allow_accept=true; } :edit_box { label="Angle"; key="ANG"; width=9; value="45"; allow_accept=true; } } spacer; ok_cancel;}
What's wrong with the CHAMFER command?
Chamfer command can be run in NoTrim mode, so the internal chamfer can be done without removing the end line.Get to know your drafting package before you ask others to modify it for you.
Quote from: Kerry on April 27, 2014, 08:00:06 AMChamfer command can be run in NoTrim mode, so the internal chamfer can be done without removing the end line.Get to know your drafting package before you ask others to modify it for you.Thanks ,I think use lisp can save a little time.
Quote from: liuhaixin88 on April 27, 2014, 08:02:43 PMQuote from: Kerry on April 27, 2014, 08:00:06 AMChamfer command can be run in NoTrim mode, so the internal chamfer can be done without removing the end line.Get to know your drafting package before you ask others to modify it for you.Thanks ,I think use lisp can save a little time.It saves about 1.5 seconds This Works in World UCS
Command: doCounterBoreError: no function definition: KDUB:SGPBacktrace:[0.55] (VL-BT)[1.51] (*ERROR* "no function definition: KDUB:SGP")[2.46] (_call-err-hook #<SUBR @2a64f370 *ERROR*> "no function definition: KDUB:SGP")[3.40] (sys-error "no function definition: KDUB:SGP"):ERROR-BREAK.35 nil[4.32] (#<SUBR @0d4055b4 null-fun-hk> "Select shaft End line (nea)" nil nil)[5.26] (KDUB:SGP "Select shaft End line (nea)" nil nil)[6.19] (C:DOCOUNTERBORE)[7.15] (#<SUBR @2a64f424 -rts_top->)[8.12] (#<SUBR @0d40535c veval-str-body> "(C:DOCOUNTERBORE)" T #<FILE internal>):CALLBACK-ENTRY.6 (:CALLBACK-ENTRY):ARQ-SUBR-CALLBACK.3 (nil 0)Command:
(defun myerr(msg) (command "undo" "e") (setq *error* olderr))(defun entmu() (setq data1 (subst (cons 10 strp1)(assoc 10 data1) data1)) (setq data1 (subst (cons 11 p31)(assoc 11 data1) data1)) (setq data2 (subst (cons 10 strp2)(assoc 10 data2) data2)) (setq data2 (subst (cons 11 p32)(assoc 11 data2) data2)) (entmod data1) (entmod data2) (entupd (car line1)) (entupd (car line2)))(defun c:hsc(/ d a typ DLG_ID result line1 line2 data1 data2 selp1 selp2 end10 end11 end20 end21 strp1 strp2 endp1 endp2 ang1 ang2 angd1 angd2 p31 p32 p41 p42 p51 p52) (setq olderr *error*) (setq *error* myerr) (setvar "cmdecho" 0) (command "undo" "be") (setq d 5.0) (setq a 45.0) (setq typ "HC") (setq DLG_ID (load_dialog "hsc.dcl")) (new_dialog "chamfer" DLG_ID) (mode_tile "DST" 2) (action_tile "HC" "(setq typ $key)") (action_tile "FC" "(setq typ $key)") (action_tile "DST" "(setq d (atof $value))") (action_tile "ANG" "(setq a (atof $value))") (action_tile "accept" "(done_dialog 1)(setq result T)") (action_tile "cancel" "(done_dialog 0)") (start_dialog) (unload_dialog DLG_ID) (if result (progn (setq line1 (entsel)) (setq data1 (entget (car line1))) (setq selp1 (cadr line1)) (if (= (cdr (assoc 0 data1)) "LINE") (progn (setq end10 (cdr (assoc 10 data1))) (setq end11 (cdr (assoc 11 data1))) (if (> (distance selp1 end11)(distance selp1 end10)) (setq strp1 end11 endp1 end10 ang1 (angle end10 end11)) (setq strp1 end10 endp1 end11 ang1 (angle end11 end10)) ) ) ) (setq line2 (entsel)) (setq data2 (entget (car line2))) (setq selp2 (cadr line2)) (if (= (cdr (assoc 0 data2)) "LINE") (progn (setq end20 (cdr (assoc 10 data2))) (setq end21 (cdr (assoc 11 data2))) (if (> (distance selp2 end21)(distance selp2 end20)) (setq strp2 end21 endp2 end20 ang2 (angle end20 end21)) (setq strp2 end20 endp2 end21 ang2 (angle end21 end20)) ) ) ) (setq angd1 (angle endp1 endp2)) (setq angd2 (angle endp2 endp1)) (if (or (= (abs (fix (* (- angd1 ang1) 10000))) 15707)(= (abs (fix (* (- angd2 ang2) 10000))) 15707)) (progn (setq p31 (polar endp1 ang1 d)) (setq p32 (polar endp2 ang2 d)) (setq p41 (polar p31 (+ ang1 pi (* (/ a 180.0) pi))(/ d (cos (* (/ a 180.0) pi))))) (setq p42 (polar p32 (- ang2 pi (* (/ a 180.0) pi))(/ d (cos (* (/ a 180.0) pi))))) (setq p51 (polar p31 (- ang1 pi (* (/ a 180.0) pi))(/ d (cos (* (/ a 180.0) pi))))) (setq p52 (polar p32 (+ ang2 pi (* (/ a 180.0) pi))(/ d (cos (* (/ a 180.0) pi))))) (cond ( (and (= typ "FC") (< (distance p31 endp1)(distance strp1 endp1)) (< (distance p32 endp2)(distance strp2 endp2)) (< (/ (* d (sin (* (/ a 180.0) pi)) 2.0)(cos (* (/ a 180.0) pi)))(distance endp1 endp2)) ) (progn (entmake (list '(0 . "LINE")(cons 10 p31)(cons 11 p32))) (if (< (distance p41 p42)(distance p51 p52)) (progn (entmake (list '(0 . "LINE")(cons 10 p31)(cons 11 p41))) (entmake (list '(0 . "LINE")(cons 10 p32)(cons 11 p42))) (entmake (list '(0 . "LINE")(cons 10 p41)(cons 11 p42))) ) (progn (entmake (list '(0 . "LINE")(cons 10 p31)(cons 11 p51))) (entmake (list '(0 . "LINE")(cons 10 p32)(cons 11 p52))) (entmake (list '(0 . "LINE")(cons 10 p51)(cons 11 p52))) ) ) (entmu) ) ) ( (and (= typ "HC") (< (distance p31 endp1)(distance strp1 endp1)) (< (distance p32 endp2)(distance strp2 endp2)) ) (progn (entmake (list '(0 . "LINE")(cons 10 p31)(cons 11 p32))) (if (> (distance p41 p42)(distance p51 p52)) (progn (entmake (list '(0 . "LINE")(cons 10 p31)(cons 11 p41))) (entmake (list '(0 . "LINE")(cons 10 p32)(cons 11 p42))) ) (progn (entmake (list '(0 . "LINE")(cons 10 p31)(cons 11 p51))) (entmake (list '(0 . "LINE")(cons 10 p32)(cons 11 p52))) ) ) (entmu) ) ) ) ) ) ) ) (myerr) (princ))
I use an old dialog box routine with preset values or slider control values to set the following distances:Set Chamfer A =Set Chamfer B =