Jump to content

Create a set from a list of points


dilan

Recommended Posts

Hello to all.

I have a list of points:

((76712.0 53577.0 749.001) (76666.0 53517.8 746.341) (76612.1 53448.2 744.644) (76590.7 53336.1 752.25) (76534.9 53273.7 750.654))

Is it possible to add it to the <Selection set> ? As if I selected these points as a function ssget.

I know about the function ssadd, but I do not understand how to apply it...

Trying to do something like this:

(setq ptlist ((76712.0 53577.0 749.001) (76666.0 53517.8 746.341) (76612.1 53448.2 744.644) (76590.7 53336.1 752.25) (76534.9 53273.7 750.654)))
(foreach item  ptlist
 (setq set_sa (ssadd item))
)

And I get nil

I'm doing something wrong. Help me please...
thank

Link to comment
Share on other sites

Another way

These points are in my layer "Points"

 

I'm trying to add them to the set:

 (ssget "_I" '((0 . "POINT") (8 . "Points")))

but i get nil

Link to comment
Share on other sites

1st up a selection set is objects and a point is a property of an object.

 

If you want objects at a point you can do it (ssget pt) using a point is valid. Then you can use ssadd. But point must be on object. You will need to repeat for every point in your list.

Edited by BIGAL
Link to comment
Share on other sites

I went the other way, I added my points to the set like this:

(setq set_sa (ssget "_X" '((0 . "POINT") (8 . "POINTS"))))

I have points in the drawing, I received a list of their coordinates and thought how to add these points to the set programmatically, without a choice in the drawing.

 

The way I wrote above seems to work for me.

I do not need to create a list of coordinates of points, I just select them as a filter.

Link to comment
Share on other sites

You still have a selection set of "OBJECTS" which just happen to be Autocad "Points" and again a property is the layer dxf 8 the co-ords are dxf 10.

 

You can have multiple filters.

eg Text Layer Color Textheight.

 

Like wise (setq set_sa (ssget "_X" '((8 . "POINTS")))) would work if "points" were the only thing on layer "Points"

Edited by BIGAL
Link to comment
Share on other sites

Try this code

(defun c:test()
  (setq ptlist '((76712.0 53577.0 749.001) (76666.0 53517.8 746.341) (76612.1 53448.2 744.644) (76590.7 53336.1 752.25) (76534.9 53273.7 750.654)))
  
 (foreach x  ptlist
     (setq e (entmakex (list '(0 . "POINT")
   		             '(100 . "AcDbEntity")
		             '(410 . "Model")
                             '(100 . "AcDbPoint")
		             '(210 0.0 0.0 1.0)
                             '(50 . 0.0)
                              (cons 10 x)
		       )
             )
     )
    (setq set_sa (ssadd e))
  )
) 

 

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