Author Topic: How to select objects at a particular point  (Read 6172 times)

0 Members and 1 Guest are viewing this topic.

subbup

  • Guest
How to select objects at a particular point
« on: May 27, 2005, 12:07:19 AM »
Hello all,

Thanks in advance
I want to select the features at a particular point.
I can do this in this way.
Zoom to that point.
select the objects with SSGET with cross option.
If I want to repeat the same thing about 10000 times means 10000 places I want to zoom and collect objects and If it is dense drawing,
It' s taking lot of time.
Is there any other way to get objects at particualr point without zooming.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
How to select objects at a particular point
« Reply #1 on: May 27, 2005, 12:12:52 AM »
Look into nentselp.

Example:

(command ".point" "_non" '(0 0 0))

(setq ename (car (nentselp '(0 0 0))))
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

daron

  • Guest
How to select objects at a particular point
« Reply #2 on: May 27, 2005, 09:30:00 AM »
I assume you want an end point, center point, mid point. Try polar and cdr assoc 10, 11 and 50.

DParcon

  • Guest
How to select objects at a particular point
« Reply #3 on: May 29, 2005, 03:07:14 PM »
Try zoom center option with magnification or height.
The center point is the centroid of object's bounding
box and the magnification/height is the diameter of
the circle circumscribing the bounding box.

Crank

  • Water Moccasin
  • Posts: 1503
Re: How to select objects at a particular point
« Reply #4 on: May 29, 2005, 03:31:47 PM »
Quote from: subbup
[...]
Zoom to that point.
select the objects with SSGET with cross option.
[...]
Is there any other way to get objects at particualr point without zooming.

Just use the point in SSGET to select:
Code: [Select]

(setq point (getpoint))
(ssget point)

Of course you must have a list of points in advance, if you don't want to zoom. ;)
Vault Professional 2023     +     AEC Collection

whdjr

  • Guest
How to select objects at a particular point
« Reply #5 on: May 29, 2005, 05:06:46 PM »
If you want to select ALLentities at ONE point you can use this:
Code: [Select]
(ssget ":S:E")

subbup

  • Guest
How to select objects at a particular point
« Reply #6 on: May 30, 2005, 06:00:03 AM »
How to supply point to this with out giving point manually
(ssget ":S:E")

whdjr

  • Guest
How to select objects at a particular point
« Reply #7 on: May 30, 2005, 10:08:21 AM »
Upon further research I realized that the :S gives you everything within your pickbox, not at a specified point.  So that being said try this:

Code: [Select]
(setq pt (getpoint))
(ssget (list (list (car pt)(cadr pt))))


This is untested as I am currently away from the office.

daron

  • Guest
How to select objects at a particular point
« Reply #8 on: May 31, 2005, 07:24:08 AM »
Sub, what point do you want? It's better if you want a specific point along an object of each item.

Amsterdammed

  • Guest
Re: How to select objects at a particular point
« Reply #9 on: May 31, 2005, 08:17:03 AM »
Quote from: subbup


I want to select the features at a particular point.


To me the real question is: Why do you need to select the objects on this particular point.

 To my experience the ssget with a point argument only works ok with
 zoom “c” and something like 200, depending how tense the drawing is. I always try to add a filter argument to make sure the entity I want is selected.

    Can’t you filter with the block name to get your ss and than calculate from the cdr 10 value for each object?

I guess if you tell us more what you want to do with the objects it will be easier to give useful advice.


 :?:

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
How to select objects at a particular point
« Reply #10 on: May 31, 2005, 09:16:58 AM »
Good strategy Amsterdammed: what's the description of the problem at a higher level?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

subbup

  • Guest
How to select objects at a particular point
« Reply #11 on: June 01, 2005, 02:39:48 AM »
I have a situation like this.
I have lwpolylines in one layer and lines in other layer.
The line end points are snapped to polylines, but there is no vertex and no break.
I want to check whether all lines are snapped to any of the polylines are not.

For this what I am doing is zoom to each and every line endpoint
ssget with "c" option I am checking is there any polyline is there or not.
My drawing has almost 10000 lines. If I do the same thing it's taking nearly 10 to 15 minutes.
I think you understand what my problem.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
How to select objects at a particular point
« Reply #12 on: June 01, 2005, 03:00:09 AM »
How many drawings do you have to do suddup. ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
How to select objects at a particular point
« Reply #13 on: June 01, 2005, 03:05:50 AM »
Quote
The line end points are snapped to polylines, but there is no vertex and no break.
I want to check whether all lines are snapped to any of the polylines are not.


Sorry, I do not understand this ??

What do you want to check ??

What do you want to do ??
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

SMadsen

  • Guest
How to select objects at a particular point
« Reply #14 on: June 01, 2005, 06:39:17 AM »
Subbup, would the following stuff do what you want? It selects (or should select) all lines that have one or both points in common with any lwpolyline in the drawing. It's based on a fuzz factor of 1E-6, which means that points should be equal down to the 6th decimal. This can be adjusted in the CHECKPOINTS routine.

It's rather basic in perfomance (sequential stuff) so I'm not sure the speed is reasonable if the drawing is heavy on lines and/or plines but tests would show that. When issuing the LINESONPLINES command (feel free to rename), it asks if you want to check against all vertices or just the "end" vertices of all plines (for closed plines that also includes the vertex that starts the closing segment).

Code: [Select]
(defun getPlinePoints (all / plsts plst ss ent entl)
  (setq i -1)
  (cond ((setq ss (ssget "X" '((0 . "LWPOLYLINE"))))
         (repeat (sslength ss)
           (setq ent  (ssname ss (setq i (1+ i)))
                 entl (entget ent)
           )
           (cond (all
                  (foreach pt entl
                    (if (= (car pt) 10)
                      (setq plst (cons (cdr pt) plst))
                    )
                  )
                 )
                 ((setq plst (append (list (cdr (assoc 10 entl))
                                           (cdr (assoc 10 (reverse entl)))
                                     )
                                     plst
                             )
                  )
                 )
           )
           (setq plsts (append plst plsts)
                 plst  nil
           )
         )
        )
  )
  plsts
)

(defun checkPoints (ppts lpts)
  (apply 'or
         (apply
           'append
           (mapcar
             (function
               (lambda (pt)
                 (mapcar (function (lambda (n) (equal pt n 1e-6))) ppts)
               )
             )
             lpts
           )
         )
  )
)

(defun divideAndConquer (all div /      cdrd   dwgDim ent    entl
                         i      osm    plinePts      ss     x
                         xIncr  xZoom  y      yIncr  yZoom  newSS
                        )
  (defun cdrd (lst)
    (reverse (cdr (reverse (cdr lst))))
  )
  (vl-cmdf "_ZOOM" "_Extents")
  (setq dwgDim (mapcar '- (getvar "EXTMAX") (getvar "EXTMIN"))
        xIncr  (/ (car dwgDim) div)
        yIncr  (/ (cadr dwgDim) div)
        x      (car (getvar "EXTMIN"))
        y      (cadr (getvar "EXTMIN"))
        osm    (getvar "OSMODE")
        newSS  (ssadd)
  )
  (setvar "OSMODE" 0)
  (setq plinePts (getPlinePoints all))
  (while (< y (cadr dwgDim))
    (setq xZoom (+ x xIncr)
          yZoom (+ y yIncr)
    )
    (cond ((setq
             ss (ssget "C"
                       (list x y)
                       (list xZoom yZoom)
                       '((0 . "LINE"))
                )
           )
           (setq i -1)
           (repeat (sslength ss)
             (setq ent  (ssname ss (setq i (1+ i)))
                   entl (entget ent)
             )
             (cond
               ((checkPoints
                  plinePts
                  (list (cdrd (assoc 10 entl)) (cdrd (assoc 11 entl)))
                )
                (ssadd ent newSS)
               )
             )
           )
          )
    )
    (cond ((>= xZoom (car dwgDim))
           (setq x (car (getvar "EXTMIN"))
                 y (+ y yIncr)
           )
          )
          ((setq x xZoom))
    )
  )
  (vl-cmdf "_ZOOM" "_Previous")
  (setvar "OSMODE" osm)
  newSS
)

(defun C:LINESONPLINES (/ sset)
  (initget "All Endpoints")
  (cond ((setq
           sset
            (divideAndConquer
              (= "All"
                 (getkword
                   "\nCheck for all or end vertices? [All/Ends] <Ends>: "
                 )
              )
              5.0
            )
         )
         (mapcar 'princ (list "\n" (sslength sset) " objects found"))
         (sssetfirst nil sset)
        )
  )
  (princ)
)