Jump to content

Recommended Posts

Posted (edited)

Hi,

i have multiple polylines in a series and block are placed on them. 

i want to select the polylines between two selected blocks.

image.thumb.png.36e1e7d933a368fb6471c5db3abf1945.png

sample file is attached.

Thanks,

Srikanth

select_between _two_blocks_sample.dwg

Edited by srikanth_0126
Posted (edited)

I first thought to go like this but then i saw that there are multiple polylines between the blocks.
This works only if there is only one Polyline inbetween.
 

; testing to select objects that touch each of the selected blocks
(defun c:selectTest123 (/ ss i bbx ents)
  (setq ss (ssget '((0 . "INSERT"))))
  (setq i 0)
  (while (< i (sslength ss))
    (setq bbx (LM:blockboundingbox (vlax-ename->vla-object (ssname ss i)))) ; get the blocks boundingbox
    (setq ents
      (cons
        (LM:ss->ent ; selectionset to list
          (ssget "_C" 
              (trans (car   bbx) 0 1) 
              (trans (caddr bbx) 0 1)
              '((0 . "LWPOLYLINE")); <----------- ssget filter
          )
        )
        ents
      )
    )
    (setq i (1+ i))
  )
  (setq ss (ssadd))
  (setq ents (LM:ListsIntersection ents))
  (if ents (sssetfirst nil (apply '(lambda (e) (ssadd e ss)) ents)))
)


Used many functions of Lee Mac, the ones used are in the file attached

used LM subfunctions.lsp

Edited by EnM4st3r
Posted

If  blocks are near a vertice or on a vertice helps, noticed block insertion point is not on a vertice in sample dwg. It may be feasible to get segments of a pline so between blk1 - blk2 is segments 5,6 & 7. Copy the pline you now have vertice points trim outside of the 2 block points, you now have a result a new pline, what now ?  But that's about where I stop. I worry about the inaccuracies of the blocks not being on a vertice.  Maybe provide a new sample dwg.

Posted (edited)

Hi @BIGAL, blocks are placed between two parallel lines. other line is not in given sample file. i use the selection as for input another lisp to create a length of selected polylines. it maybe possible to use bounding box overlap method. right now i'm using fastsel and chainselection by @Lee Mac. but, chainslection is selecting everything it touches and fastsel doesn't have any control. what i'm assuming  is with chainselection extending selection until it overlaps with a block. 

Edited by srikanth_0126
Posted

HI, @BIGAL i got this from this thread and its creates a new path between two and creates a new using traced polylines. i want select the traced polylines. is that possible with this code?

 

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...