Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/13/2020 in all areas

  1. The reason my favorite math class was Geometry is that it is somewhat intuitive, and visual, whence my love of drafting. This is totally antithetical to how I feel about Trigonometry, man was I glad when that class ended. Respect for those (wannabe accountants? )who have the patience to look up all those decimal heavy sines and cosines. I'd greatly prefer the hour or two spent learning some parametric essentials!
    2 points
  2. Here's my non-VL method by pure maths: (defun c:chf ( / dis getline ins len ln1 ln2 p1 p11 p12 p2 p21 p22) (defun getline (msg / ln) (while (progn (setvar 'errno 0) (setq ln (car (entsel msg))) (cond ((= (getvar 'errno) 7) (princ "\nNothing selected")) ((null ln) nil) ((not (eq (cdr (assoc 0 (entget ln))) "LINE")) (princ "\nObject is not a line")) ) ) ) ln ) (setq ln1 (getline "\nSelect first line: ") ln2 (getline "\nSelect second line: ") dis (getdist "\nSpecify line length: ") p11 (cdr (assoc 10 (entget ln1))) p12 (cdr (assoc 11 (entget ln1))) p21 (cdr (assoc 10 (entget ln2))) p22 (cdr (assoc 11 (entget ln2))) ins (inters p11 p12 p21 p22 nil) ) (if ins (mapcar '(lambda (x y / len p1 p2) (if (and (not (equal x ins 1e-8)) (not (equal y ins 1e-8)) ) (progn (setq len (/ dis (sqrt (* 2 (- 1 (cos (JH:InnerAngle x ins y)))))) ; <-- cosine rule p1 (polar ins (angle ins x) len) p2 (polar ins (angle ins y) len) ) (entmake (list '(0 . "LINE") (cons 10 p1) (cons 11 p2))) ) ) ) (list p11 p12 p11 p12) (list p21 p22 p22 p21) ) ) (princ) ) ;; JH:InnerAngle --> Jonathan Handojo ;; Returns the smaller angle between three point p1 p2 p3 ;; with p2 as the pivot, in radians. (defun JH:InnerAngle (p1 p2 p3 / 2p ang) (setq ang (- (angle p2 p3) (angle p2 p1)) 2p (+ pi pi)) (while (not (<= 0 ang 2p)) (if (< ang 0) (setq ang (+ ang 2p)) (setq ang (- ang 2p)))) (if (> ang pi) (- 2p ang) ang) )
    1 point
  3. Bravo @steven-g, using all the tools in the quiver! So glad you did that, as I was not looking forward to revisiting this, and I erroneously thought it was impossible, whence my lack of desire to try and wrestle it into submission! Parametrics and constraints are powerful tools, which I have never taken the time to explore, live and learn!
    1 point
  4. As my LISP is so far from gurus LISP , and as I take this post to learn by myself . I try to do what I think it can be do by no VL- functions . Following the xline offset way as suggested. I'm struggled trying to make a line over the xline , so then do the offset such line and get INTERS from the offsets 'd lines to the original lines . Please see the attached dwg and my RUDE lisp. Apologize me. My English is not better than my lisp. BLOCKS CHAMFERS.dwg TRY TO DO CHAMFER.lsp
    1 point
  5. Nice jonathon using my math approach I think the code would be about a 1/4 of what you have done. Sheep you need to have a go. This is a non vl method. Pick line 1 away from intersection get start and end points use check end to work out direction of line Pick line 2 away from intersection get start and end points use check end to work out direction of line Use inters function non Vl to get intersection point Use the formula I provided to work out distance along line. Use polar from inter point along line1 for calculated distance pt1 Use polar from inter point along line2 for calculated distance pt2 Draw line pt1 pt2 here is check end (setq tp1 (entsel "\nSelect line near end : ")) (setq tpp1 (entget (car tp1))) (setq pt1 (cdr (assoc 10 tpp1))) (setq pt1 (list (car pt1) (cadr pt1) 0.0)) ;reset z to zero (setq pt2 (cdr (assoc 11 tpp1))) (setq pt2 (list (car pt2) (cadr pt2) 0.0)) ;reset z to zero (setq pt3 (cadr tp1)) (setq d1 (distance pt1 pt3)) (setq d2 (distance pt2 pt3)) (if (> d1 d2) (progn (setq temp pt1) (setq pt1 pt2) (setq pt2 temp) ) ) (setq ang (angle pt1 pt2)
    1 point
  6. Don't forget the XLINE command and it's options. (Infinite length construction lines). And the RAY command as well. Xline command reference: https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2020/ENU/AutoCAD-Core/files/GUID-40650DCE-E8CA-483C-8E25-7FA9AB6992C1-htm.html Ray command reference: https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2020/ENU/AutoCAD-Core/files/GUID-A7A32623-24A4-453C-B3DD-877A6E4D6216-htm.html For some reason Autocad tutors don't seem to teach much if any construction geometry anymore. (Maybe they were never taught it themselves?). Anyone who has drafted with a pencil and paper uses parallel, angled, offset, etc. construction lines, (XLINES, RAYS), and arcs as a matter of course. For years it was how everyone used to draft with parallel motion drawing boards, adjustable squares, and a set of compasses. Just because we now do it all on a computer screen doesn't mean that the technique is obsolete, and it can often be quicker than other methods. Just about every drawing I've ever started in Autocad the first drawing commands would be a number of Xlines, and then 'join the intersections' with the actual geometry.
    1 point
  7. Doesn't AutoCAD 2014 have constraints, with construction lines drawn at 155 and 215, then constrain the corners to those horizontal/vertical construction lines. I don't have constraints in LT but Fusion 360 made a quick job of this.
    1 point
  8. The tricky part is 2 layers & texts seperated. need 2 functions post an ACAD dwg <v2019 others may help too (as already provided link for the distancing function) ;;sub-foo renamed as (defun ++rarify (l n / i ls) ;incremental rarify - hp 14.06.2018 (cons (setq i (car l)) (progn (repeat (1- (length l)) (setq ls (cons (setq i (if (> (cadr l) (+ n i)) (cadr l) (+ n i) ) ) ls ) ) (setq l (cdr l)) ) (reverse ls) ) ) ) (defun c:TTL ( / *error* ss p ls Y ) (setq *distance* (* 1.25 (getvar 'textsize))); default (defun *error* (msg) (vl-cmdf "_UNDO" "_END")(princ msg)) (vl-cmdf "_UNDO" "_BEGIN") (initget 6) (setq *distance* (cond ((getreal (strcat "\nLines X-distancing <"(rtos *distance* 2 2)"> : ")))(*distance*))) (princ "\nSelect vertical LINES ") (and (setq ss (ssget '((0 . "LINE")))) (setq p (getpoint "\nPick crank point ")) (setq p (trans p 1 0) Y (cadr p) ls (mapcar '(lambda (en)(cons (cdr(assoc 10 (entget en))) en)) (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))) (mapcar '(lambda (en X / n l lst ) (setq en (cdr en) l (vl-sort (mapcar '(lambda (x) (cdr (assoc x (entget en)))) '(10 11)) '(lambda (a b) (> (cadr a) (cadr b))) ) n (cadadr l) lst (list (car l) (list (caar l) Y ) (list X (- Y (* (- Y n ) 0.1)) ) (list X n))) (entdel en) (entmakex (vl-list* '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(70 . 0) (cons 90 (length lst)) (mapcar '(lambda (x) (cons 10 x)) lst) ) ) ) (setq l2 (vl-sort ls '(lambda (a b) (< (caar a) (caar b))))) (++rarify (mapcar 'caar l2) *distance* ) ) ) (vl-cmdf "_UNDO" "_END") (princ) )
    1 point
×
×
  • Create New...