Jump to content

Count of Polygons crossed with Polyline


Shablab

Recommended Posts

Here is a quick one .. all objects must be on screen.

(defun c:foo (/ e p s)
  (cond	((and (setq e (car (entsel "\nPick a polyline: ")))
	      (setq p (mapcar 'cdr (vl-remove-if '(lambda (x) (/= 10 (car x)))(entget e))))
	      (setq s (ssget "_F" p))
	 )
	 (print (1- (sslength s)))
	 (sssetfirst nil s)
	)
  )
  (princ)
)

 

  • Like 1
Link to comment
Share on other sites

36 minutes ago, ronjonp said:

Here is a quick one .. all objects must be on screen.


(defun c:foo (/ e p s)
  (cond	((and (setq e (car (entsel "\nPick a polyline: ")))
	      (setq p (mapcar 'cdr (vl-remove-if '(lambda (x) (/= 10 (car x)))(entget e))))
	      (setq s (ssget "_F" p))
	 )
	 (print (1- (sslength s)))
	 (sssetfirst nil s)
	)
  )
  (princ)
)

 

That works great.  Is there a way to only select crossed lines only on a selected layer?

Link to comment
Share on other sites

13 hours ago, BIGAL said:

A little bit more

 


(setq lay (cdr (assoc 8 (entget (car (entsel "pick object for layer"))))))
(setq s (ssget "_F" p (list (cons 0 "line") (cons 8 lay))))

This doesn't seem to be working properly.  It doesn't select any after "pick object for layer".

 

Edited by Shablab
Link to comment
Share on other sites

There must be some hidden characters in the ssget line, I removed the "f" p and it did not work when I pasted into cad. Re-tested and Ok Retype the line in notepad.

 

Command: (setq s (ssget "x" (list (cons 0 "Line")(cons 8 lay))))
<Selection set: 55>

(sslength s)

6

 

 

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