Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/31/2026 in all areas

  1. It's taken you 6 years to realise I cheat!! Good point, add (vl-load-com) in just before or after the (defun c ... line (edited above)
    1 point
  2. If @Steven P is going to cheat an use Lee Mac Functions! might want to add (vl-load-com) to avoid errors if they don't have it loaded since it using vlax fuctions.
    1 point
  3. A slight variation on MHUPPS (vl-load-com) (defun c:ADIM (/ pt1 pt2 MyLine MySS acount MyIntersect MyDistance MyDistances pta ptb) (defun LM:intersections ( ob1 ob2 mod / lst rtn ) ;; See Lee Mac website. Get intersection list (if (and (vlax-method-applicable-p ob1 'intersectwith) (vlax-method-applicable-p ob2 'intersectwith) (setq lst (vlax-invoke ob1 'intersectwith ob2 mod)) ) (repeat (/ (length lst) 3) (setq rtn (cons (list (car lst) (cadr lst) (caddr lst)) rtn) lst (cdddr lst) ) ) ) (reverse rtn) ) (command "line" (setq pt1 (getpoint)) pause "") ; Draw reference line. Mod to polyline possible (setq MyLine (entlast)) ; Reference line entity name (setq pt2 (getvar 'lastpoint)) ; pt2 of reference line (setq MySS (ssget "_f" (list pt1 pt2) '( (-4 . "<NOT")(0 . "*DIM*") (-4 . "NOT>") ;Not Dims (-4 . "<NOT")(0 . "*TEXT*")(-4 . "NOT>") ;Not Text ))) ; Selection set crossing reference line (fence). Add filters (setq acount 0) ; a counter (while (< acount (sslength MySS)) ; Loop through selection set (if (setq MyIntersect (LM:intersections (vlax-ename->vla-object MyLine)(vlax-ename->vla-object (ssname MySS acount)) acextendnone )) ; get the intersection points, reference line, selection set items (progn (foreach n MyIntersect (setq MyDistance (distance pt1 n)) ; get the distance SS item, start reference line (setq MyDistances (cons (cons MyDistance (list n)) MyDistances)) ;; add the intersection & point to a list ) ; end foreach ) ; end progn ) ; end if intersections (setq acount (+ acount 1)) ; increase counter ) ; end while ; end loop (command "erase" MyLine "") ; erase reference line (setq MyDistances (vl-sort MyDistances (function (lambda (pta ptb) (< (car pta)(car ptB) ))) )) ; sort by distance (setq acount 0) (while (< (+ acount 1) (length MyDistances)) (setq p1 (car (cdr (nth acount MyDistances)))) (setq p2 (car (cdr (nth (+ acount 1) MyDistances)))) (setq mid (mapcar '/ (mapcar '+ p1 p2) '(2 2 2))) ; ripped of MHUPP (setq p3 (mapcar '+ mid '(0.0 2.0 0.0))) ;adj 2.0 for offset. ; ripped of MUPP (command "_.DIMLINEAR" p1 p2 p3) ; Ripped of MHUPP (setq acount (+ acount 1)) ) ; end while (princ) ) Edit: Corrected for polylines crossing reference line more than once
    1 point
  4. Here is something simple I threw together a while ago. Not everything you want, but should help. I started a more extreme version with more options back when people were posting they couldn't get TotalBoundary and SuperBoundary any longer. I'll try to get back on it this week, in the mean time, if you could post a drawing with some before and after it would help. I have no idea what all TotalBoundary and SuperBoundary does, it may help to explain exactly how you need to select and exactly what should be a boundary in your drawing it might might it easier. Hopefully a better LISPer will jump in. ;;; Select objects that define outlines. Works on LINE/ARC/CIRCLE/SPLINE/LWPOLYLINE. ;;; ;;; https://www.cadtutor.net/forum/topic/99063-need-a-tool-for-creating-2d-outlines-for-complex-2d-drawings/#findComment-678789 ;;; ;;; By SLW210 (a.k.a. Steve Wilson) ;;; ;;; MakeOut.lsp (defun c:MakeOut (/ ss i ent lst pts plines regions pp) (vl-load-com) (if (setq ss (ssget '((0 . "LINE,ARC,CIRCLE,SPLINE,LWPOLYLINE")))) (progn (setq i 0) (while (< i (sslength ss)) (setq ent (ssname ss i)) (setq i (1+ i)) ) (command "_.-boundary" ss "") (command "_.pedit" ss "" "J" "" "Y") (setq i 0) (while (< i (sslength ss)) (setq ent (ssname ss i)) (if (= (cdr (assoc 0 (entget ent))) "LWPOLYLINE") (progn (command "_.pedit" ent "" "S" "0.01" "") (command "_.pedit" ent "" "C" "") ) ) (setq i (1+ i)) ) (princ "\nOutline created.") ) (princ "\nNo valid entities selected.") ) (princ) )
    1 point
  5. A lot shorter then i thought. will only work on horizontal polyline. adj p3 list to affect the offset. ;;----------------------------------------------------------------------;; ;; Poly DIM acts like QDIM but allows user to select horizontal points. ;; https://www.cadtutor.net/forum/topic/99059-auto-dimension-lisp/ (defun c:PLDIM (/ ent pts p1 p2 p3 ang) (vl-load-com) (command "_.pline") (while (= 1 (getvar "cmdactive")) (command pause) ) (setq ent (entlast)) (setq pts (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget ent)))) (while (cadr pts) (setq p1 (car pts) p2 (cadr pts) mid (mapcar '/ (mapcar '+ p1 p2) '(2 2 2)) p3 (mapcar '+ mid '(0.0 2.0 0.0)) ;adj 2.0 for offset. ) (command "_.DIMLINEAR" p1 p2 p3) (setq pts (cdr pts)) ) (entdel ent) (princ) )
    1 point
×
×
  • Create New...