Getpoint near selection

Getpoint near selection

C.Utzinger
Collaborator Collaborator
1,586 Views
10 Replies
Message 1 of 11

Getpoint near selection

C.Utzinger
Collaborator
Collaborator

HI

When I select object with

(setq count (ssget "I"))

i would like to get just one point near one of the selected objects.

Please need a little help.

0 Likes
Accepted solutions (1)
1,587 Views
10 Replies
Replies (10)
Message 2 of 11

Anonymous
Not applicable

@C.Utzinger Try this ?

(Setq ss (ssget '((0 . "POINT"))))
0 Likes
Message 3 of 11

cadffm
Consultant
Consultant
He need the position near to one or the middle of objects.
Stupid way if you can be sure that you have only object with gc10 is
(cdr(ssname ss 0))
But this is to simple (for solids, inserts and other objectstyps or if gc210 is not 0 0 1)

So a well working answer is a little bit longer perhaps (and i have no time).

Sebastian

Message 4 of 11

cadffm
Consultant
Consultant
Accepted solution

Sorry:

(cdr(assoc 10 (entget (ssname ss 0))))

 

But as I said, this is greatly simplified and does not work as desired in all cases.

Sebastian

Message 5 of 11

Kent1Cooper
Consultant
Consultant

@C.Utzinger wrote:

.… i would like to get just one point near one of the selected objects. ....


 

Can you illustrate what you mean with an image or sample drawing?  How is the desired point to be determined?

Kent Cooper, AIA
0 Likes
Message 6 of 11

C.Utzinger
Collaborator
Collaborator

HI

I don't know how to ilustrate it in a good way, but

(cdr(assoc 10 (entget (ssname ss 0)))), it's just what i'm looking for, but I need it also for hatches.

 

Thank you...

 

Kind regards

 

0 Likes
Message 7 of 11

Kent1Cooper
Consultant
Consultant

@C.Utzinger wrote:

 

....

(cdr(assoc 10 (entget (ssname ss 0)))), it's just what i'm looking for, but I need it also for hatches.

 

....

 

Questions still remain....  That will find a location on, not "near," many kinds of objects [but not all] -- does that matter?  And since (ssget "I") can include multiple  objects, and you want a point near one  of them, is there any criterion at all for which one?  Your code would get it from the first one in the selection, which can vary even among the same set of objects, depending on how they were selected.  Is any  one equally valid for your purpose?  If there's a Hatch pattern among the selection, but also other some other kind(s) of object(s), can it ignore the Hatch and go for one of the others?  Since the (assoc 10) value for a Hatch can be anywhere, possibly far from the drawn pattern itself, would the midpoint of its bounding box be valid?

Kent Cooper, AIA
0 Likes
Message 8 of 11

C.Utzinger
Collaborator
Collaborator

Ok the answer to your questions:

1: It does not matter if near or on the object (better on if possible).

2: It doesn't matter witch one.

3: If there is a hatch and other object, it could ignore it or get the midpoint of it.

4: If there are only hatches, getting the midpoint would be perfect.

 

For better understanding, in my drawings are Areas (closed polylines) with a scale Definition, and the Routine will get the scale propertie of this area when i select a object in it. For example the midpoint of a hatch will be in this area.

 

If someone select different objects  in- and outside of the area at the same time it doesn't matter, because in this case I will do nothing for the stupid user :)...

 

Thank you very much

 

Regards

0 Likes
Message 9 of 11

Kent1Cooper
Consultant
Consultant

@C.Utzinger wrote:

 

....

For better understanding, in my drawings are Areas (closed polylines) with a scale Definition, and the Routine will get the scale propertie of this area when i select a object in it. For example the midpoint of a hatch will be in this area.

 

....

 

I'd still like to see an illustration, showing possible object types and the kinds of locations you want to find in relation to them.  The "origin" [if that's (cdr (assoc 10 entitydatalist))] of certain other objects than Hatches can also be very far away from their drawn content, for example a Block if badly defined, or an Arc, especially of large radius that doesn't swing through very many degrees of curvature.  Should it find the middle of the bounding box of any object in the selection?  That should be close-to-reliably within the "area" of the object, whatever type it is.

Kent Cooper, AIA
Message 10 of 11

C.Utzinger
Collaborator
Collaborator

I see the Problem...

Give me please a little time (24h) and i will show you a good example, i'm a little busy.

 

Thank you very much.

 

Kind regards

 

0 Likes
Message 11 of 11

C.Utzinger
Collaborator
Collaborator

Good morning

 

Attached I send you an example. I this one there are only lines, circles and arcs.

In other routines I need it for text and hatches.

At the Moment I think I dont need it for blocks.

 

Thank you for the help.

 

Regards

0 Likes