Jump to content

select objects inside circle


mauro

Recommended Posts

  • Replies 26
  • Created
  • Last Reply

Top Posters In This Topic

  • mauro

    7

  • smorales02

    5

  • fuccaro

    4

  • CALCAD

    3

You mean other than clicking on them? :huh:

Could you be a little more specific about what you're trying to do? :unsure:

Are you trying to only select specific types of objects, or do you want to select only objects that are on a certain layer or a certain color? More information would be helpful.

Link to comment
Share on other sites

that's an example, in the real case there are about 14000 entities in diferent circle areas. see the attached file, that's the real case. i need to know how many entities are in circle A; B; C; ...

Link to comment
Share on other sites

Can you do a selection window that enlcoses the circle than remove the circle from the selction and in your properties it should tell you how many entities there are....

Link to comment
Share on other sites

There are 3274 items, use a right to left crossing window to select everything in the drawing, press and hold the shift key and select the circles and text, this will deselect them, this should leave you with 3274 objects selected.

 

Hope this is of help

 

Graham

Link to comment
Share on other sites

:shock:

 

There are 3286 objects in the drawing, less 6 text objects and 6 circles, which leaves you with 3274 objects.

 

Use a right to left crossing window to select all objects in the drawing, press and hold the shift key, click on the circles and each text object, your count should equal 3274.

 

Hope this is of help

 

Regards Graham :geek:

Link to comment
Share on other sites

There are 3274 items, use a right to left crossing window to select everything in the drawing, press and hold the shift key and select the circles and text, this will deselect them, this should leave you with 3274 objects selected.

 

Hope this is of help

 

Graham

 

 

Using (LIST) command , select the object inside circle then the number of the selected object appear in the dialog

 

Haya

Link to comment
Share on other sites

It can be worked out with a Lisp routine. But first: are the small circles everytime so small? can we say that you want to count circles with diameter under 1, placed inside circles with diameter >1?

With other words: if we use a program, we must use a criteria to separe the circles to be counted and the border-circles.

Oh, and one more thing: the objects to be counted are all circles? and if a circle intersects a border, do you wish to be considered an insider object?

Link to comment
Share on other sites

Where did the point/circle data come from, and how was it entred into cad.

 

If you have it in excel or something, perhaps it could be sorted into points that are within a certian coordinate range for each circle.

 

 

Otherwise,

all I can think is to create new layers 'a', 'b', 'c', 'd', with different colours so they're easier to see, maybe even make the circles bigger, and go through selecting groups within each circle and re-layering.

 

There is probably a better way, but this will work, and I think take less than 1/2hr. You may want to check you have selected all circle correctly, by adding up the 'a's b's c's d's to make sure you have them all. if your missing a few they will be on original layer and be easy to find any re-place.

Link to comment
Share on other sites

(defun c:count( / borders objects ib io r1 c1 c2 nr)
; Counts small circles (r<1)) inside circular borders.
; Aug 2008         mfuccaro@hotmail.com
;
 (setq borders (ssget "X" (list '(0 . "CIRCLE") '(-4 . ">") (cons 40 1.0))))
 (setq objects (ssget "X" (list '(0 . "CIRCLE") '(-4 . "<") (cons 40 1.0))))
 (if (null borders) (progn (alert "No borders. Exiting") (exit)))
 (repeat (setq ib (sslength borders))
   (setq r1 (cdr (assoc 40 (entget (ssname borders (setq ib (1- ib))))))
     c1 (cdr (assoc 10 (entget (ssname borders ib))))
     nr 0)
   (princ (strcat "\nBorder " (itoa (- (sslength borders) ib)) "\tRadius=" (rtos r1)))
   (if (not (null objects))
     (repeat (setq io (sslength objects))
   (setq c2 (cdr (assoc 10 (entget (ssname objects (setq io (1- io)))))))
   (if (>= r1 (distance c1 c2)) (setq nr (1+ nr)))
   )
     )
   (princ (strcat "\tsmall circles inside=" (itoa nr)))
   )
 (textscr)
 (princ)
 )

Link to comment
Share on other sites

Mauro. Fuccaro has written an elegant program that is specific to your task. My program is not so elegant, but might be more generally applied.

 

 
;CWS.LSP - circular window selection : selects objects within existing circle (2D).
;          Selected objects are highlighted and counted.
;          Access selection with 'P' option of subsequent commands.
(defun cws_error (msg)
(setq *error* sys_error)
(setvar "OSMODE" osave)
(command "UCS" "R" "SYSUCS")
(command "UCS" "D" "SYSUCS")
(princ "\r")
(setvar "CMDECHO" 1)
(redraw)
(setq ess nil)
(princ)
)
(defun c:cws (/ cir cn cel cc crad poly egp plst pc ptlist plst ec slen ssen n)
(setvar "CMDECHO" 0)
(setq sys_error *error*)
(setq *error* cws_error)
(setq osave (getvar "OSMODE"))
(setvar "OSMODE" 0)
(command "UCS" "S" "SYSUCS")
(command "UCS" "")
(setq cir (entsel "\nPick enclosing circle"))
(setq cn (car cir))
(setq cel (entget cn))
(setq cc (cdr (assoc 10 cel)))
(setq crad (cdr (assoc 40 cel)))
(command ".POLYGON" 120 cc crad)
(setq poly (entlast))
(setq egp (entget poly))
(setq plst (- (length egp) (length (member (assoc 10 egp) egp))))
(setq ptlist nil)
(setq pc plst)
(setq plst (- (length egp) 1))
(while (< pc plst)
 (setq ec (nth pc egp))
 (setq ec (cdr ec))
 (setq ptlist (cons ec ptlist))
 (setq pc (+ pc 4))
)
(entdel (entlast))
(setq ess (ssget "WP" ptlist))
(redraw)
(setq slen (sslength ess))
(setq n 0)
(repeat slen
(setq ssen (ssname ess n))
(redraw ssen 3)
(setq n (+ n 1))
)
(setvar "OSMODE" osave)
(command "UCS" "R" "SYSUCS")
(command "UCS" "D" "SYSUCS")
(princ "\r")
(princ "\n ")(princ slen)(princ " objects selected")
(setvar "CMDECHO" 1)
(setq ess nil)
(setq *error* sys_error)
(princ)
)

Link to comment
Share on other sites

While we're on the subject... as a mental exercise I tried to write an app for this; It would work, then it wouldn't.... it returns error: bad argument type: lselsetp nil

If someone has the time/inclination could you take a look to see what the bug is?

;;--------------------------------------------------------------------
;;  get pline vertex list for LWPline only by CAB
(defun get_pline_cor (elst)
 (mapcar 'cdr
     (vl-remove-if-not '(lambda (x) (= 10 (car x))) elst)
 )
)

;;----------------------------------------------------------------------------
(defun c:CountInCircle (/          circ        pt_on
           circle_list   pt_center        circle_radius
           vertex_list
              )
 (setq old_echo (getvar "cmdecho"))
 (setvar "cmdecho" 0)


 (setq    circ          (entsel "Select a circle: ")
   pt_on          (osnap (cadr circ) "nea")
   circle_list   (entget (car circ))
   pt_center     (cdr (assoc 10 circle_list))
   circle_radius (cdr (assoc 40 circle_list))
 )
 (command "_polygon" 360 pt_center "I" circle_radius)
 (setq    elst (entget (entlast))
 )
 (entdel (entlast))

 (setq    vertex_list
    (get_pline_cor elst)
 )
 (alert (strcat "There are "
        (itoa (sslength (ssget "_WP" vertex_list '((0 . "circle")(8 . "Clientes")))))
        " objects inside the circle"
    )
 )
 (setvar "cmdecho" old_echo)
 (princ)
)

Thanks- Larry

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