Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/19/2022 in all areas

  1. You should post a drawing of what you're working with. If there are no curves in your linework then use INTERS as @mhupp suggested. Here's a quick example. It does not draw a line 'yet' but identifies both straight segments of intersections. Does not see self intersections. (defun c:foo (/ _f _foo a j pts r s z) (defun _f (p) (list (car p) (cadr p))) (defun _foo (o / p r) (setq p (vlax-get o 'coordinates)) (if (= "AcDbPolyline" (vla-get-objectname o)) (while p (setq r (cons (mapcar '+ p '(0 0)) r)) (setq p (cddr p))) (while p (setq r (cons (mapcar '+ p '(0 0 0)) r)) (setq p (cdddr p))) ) (reverse r) ) (if (setq s (ssget '((0 . "*POLYLINE")))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (setq z (_foo (vlax-ename->vla-object e))) (setq pts (cons (mapcar '(lambda (r j) (list r j)) z (cdr z)) pts)) ) ) (while (cadr pts) (setq a (car pts)) (setq pts (cdr pts)) (foreach p a (foreach p2 (apply 'append pts) (and (inters (_f (car p)) (_f (cadr p)) (_f (car p2)) (_f (cadr p2))) (progn (grdraw (car p) (cadr p) 1) (grdraw (car p2) (cadr p2) 1)) ) ) ) ) (princ) )
    2 points
  2. @mdchuyen Give this a try .. it checks for areas within a given range. (defun c:foo (/ c mn mx s) (cond ((and (or (setq mn (getdist "\nEnter minimum area value to check:<0> ")) (setq mn 0)) (or (setq mx (getdist "\nEnter maximum area value to check:<500> ")) (setq mx 500)) (setq c (acad_truecolordlg 1)) (setq s (ssget '((0 . "LWPOLYLINE")))) ) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (if (<= mn (vlax-curve-getarea e) mx) (entmod (append (entget e) c)) (ssdel e s) ) ) (sssetfirst nil s) ) ) (princ) )
    2 points
  3. Give this a try: (defun c:foo (/ a i ll n s ur) (cond ((and (or (setq n (getdist "\nEnter area value to check:<300> ")) (setq n 300)) ;; (setq c (acad_truecolordlg 1)) (setq s (ssget '((0 . "LWPOLYLINE") (8 . "living")))) (setq i 0) ) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (if (>= (setq a (vlax-curve-getarea e)) n) (progn (entmake (append (entget e) '((8 . "LIVING-AREA") (62 . 1)))) (vla-getboundingbox (vlax-ename->vla-object e) 'll 'ur) (setq ll (vlax-safearray->list ll)) (setq ur (vlax-safearray->list ur)) (setq ll (mapcar '/ (mapcar '+ ll ur) '(2 2 2))) (setq i (+ i a)) (entmake (list '(0 . "TEXT") '(100 . "AcDbEntity") '(67 . 0) '(8 . "LIVING-AREA") '(62 . 1) '(100 . "AcDbText") (cons 10 ll) '(40 . 1.5) (cons 1 (vl-princ-to-string a)) '(50 . 0.0) '(41 . 1.0) '(51 . 0.0) '(71 . 0) '(72 . 1) (cons 11 ll) '(100 . "AcDbText") '(73 . 2) ) ) ) ;; (ssdel e s) ) ) ;; Print total to command line (print i) ;; (sssetfirst nil s) ) ) (princ) )
    1 point
  4. Only way to pick a block and change it color with object properties is setting the properties of block objects to Layer 0 and color to ByBlock instead of ByLayer. The link above describes it as well as I've seen anywhere.
    1 point
  5. You can edit the block with the REFEDIT command or The BEDIT command. From there you can make changes to the block, then save and exit the editor to update the changes to the block.
    1 point
  6. Insert the block, explode the block, use CHPROP to change the color of the object in question, redefine the block and select the objects that made up the original block.
    1 point
×
×
  • Create New...