Jump to content

Filling in an area with a block


rcb007

Recommended Posts

I found this routine which would allow you to select a block with whatever measurements. Then pick a point and fill a closed polyline area. So far it works with the first picture below.

I was wondering how i could make it fill the whole area in a uniform grid to that of the second picture.

Thank you for any guidance on it.

 

(defun c:adray  (/ ent blk ss rowdist colmdist point0)
;;https://forums.augi.com/showthread.php?163443-Create-array-within-a-boundary
(setq rowdist (getdist "\n Y Distance of Block :"))
(setq colmdist (getdist "\n X Distance of Block :"))
    (cond
    ((and
    (setq ent (car (entsel "\nSelect the Measured Block Entity: ")))
    (eq (cdr (assoc 0 (entget ent))) "INSERT")
    (setq blk (vla-get-effectivename
    (vlax-ename->vla-object ent)))
    )))
  (setq lyr "LAYOUT")
  (command "Layer" "M" lyr "C" "green" "" "")
  (command "-Hatch" (getpoint "\nPick a point inside closed polyline: ") "P" "U" "0.0" rowdist "N" "")
  (command "Explode" (entlast))
  (setq	ss     
  (ssget "X"
    (list '(0 . "LINE")
    (cons 8 lyr)
    ) 
    ) 
    num    (sslength ss)
    i      -1
  )
  (repeat num
    (setq ent (ssname ss (setq i (1+ i))))
    (command "measure" ent "B" blk "Y" colmdist)
    (entdel ent)
  )
(princ)
)

(C:adray)

 

Capture.JPG

Link to comment
Share on other sites

I posted something like this this year or last. cant find it right now but 'll look when i get home.

basically you want to just have a grid of blocks that cover the whole polyline.

Then use ssget with "CP" and polycords to select any block that is crossing. and delete the rest.

Link to comment
Share on other sites

That sound about right, the only other thing i could think of, is to always keep the orientation left and right and create an angle from that. Again thank you!

Link to comment
Share on other sites

Did this for something else, pick say pline, then get boundingbox overfill the pline with the grid boxes using array, then do a ssget wp this gets all grids that touch and within put on dummy layer and turn off, erase grids that are on, turn back on dummy layer and change layer of grids. You need a grid starting point at say a true co-ord ie in grid spacing 10x20 do this by rounding down the lower left corner to a grid space value. This is how I remember doing this like 20 years ago not tested.

Edited by BIGAL
Link to comment
Share on other sites

I stumbled upon superhatch, which seems to give me exactly what I needed. Just wanted to let you know. Again, thanks for the help.

  • Like 1
Link to comment
Share on other sites

Sorry forgot to post this.

 

-Edit

little edit so it selects all the blocks inside and crossing polyline

;;----------------------------------------------------------------------;;
;;HIGLIGHT BLOCKS THAT CROSS POLYLINE
(defun C:PCross (/ SS SS1 SS2 coords)
  (if (setq SS (ssget "_+.:E:S" '((0 . "*POLYLINE"))))
    (progn
      (setq coords (vl-remove-if 'not (mapcar (function (lambda (p) (if (= 10 (car p)) (cdr p)))) (entget (ssname SS 0)))))
      (if (setq SS1 (ssget "_CP" coords '((0 . "INSERT"))))
        (sssetfirst nil SS1)
      )
    ) 
  )
  (princ)
)

 

 

 

 

Edited by mhupp
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...