Jump to content

selecting lines or plines that intersect and then blocks that intersect with those


hetauma

Recommended Posts

Hi I need to make a lisp that will do the following and need some guidance to what I should do.

 

I want the user to select one or multiple lines or polylines.

Then the lisp should select all the intersecting lines or plines down to 3-4 levels (imagine there is a grid with many branches).

Then show the user the result (and maybe add some more branches and run again)

And finally select all the intersecting blocks of a specific type and display the number of blocks and make a sum of specific attribute of these blocks.

 

p.s. Is it possible to add some tolerance to these procedures in the case that the blocks don't intersect with the line but they are within 1m of the line for example?

Link to comment
Share on other sites

Starting simply when selecting objects one option is FENCE "F" try Move F draws a temporary pline touching objects. You can use a existing pline as the fence pts using the co-ords of the pline. So using ssget but with "F" option. Look at last line of code.

 

;An example with two pts 
(setq ss (ssget "F" (list pt1 pt2))).

 

; pline co-ords example
; By Alan H
(defun getcoords (ent)
 (vlax-safearray->list
   (vlax-variant-value
     (vlax-get-property
   (vlax-ename->vla-object ent)
   "Coordinates"
     )
   )
 )
)

(defun co-ords2xy ()
; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z
(setq len (length co-ords))
(setq numb (/ len 2)) ; even and odd check required
(setq I 0)
(repeat numb
(setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) ))
; odd (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords)(nth (+ I 2) co-ords) ))
(setq co-ordsxy (cons xy co-ordsxy))
(setq I (+ I 2))
)
)
; program starts here
(setq co-ords (getcoords (car (entsel "\nplease pick pline"))))
(co-ords2xy) ; list of 2d points making pline
; try this
(setq ss (ssget "F" co-ordsxy))

Edited by BIGAL
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...