Jump to content

ssget or equivalent help


cagorskij

Recommended Posts

Hi there, hope you had a happy holiday season :)

I have made a function that can rotate bearings one by one, and would like to upgrade it.
I used nentsel which seemed to work somewhat as expected. it returns a list, i can use lisp functions to inspect or modify the list, etc.

Now the upgrade I would like involves using ssget, so that a user may select multiple bearings at once using ctrl+click or select all similar or click drag, you get the idea.
ssget works differently as I've learned; it returns a selection set instead of what I expected to be a list of lists.

I am wondering how I might disambiguate a selection set into a list of lists or a lisp-appropriate data structure that is manipulable.

I'm also curious about how I might identify the contents of an entity, if there's any reading material anyone could point me to.
Specifically I'd like to be able to uniquely identify, get the contents of (these first two i can glean from existing code, but , and get the x/y coords of text entities.

I can see something simple like the code below would do this, but I was wondering if there was a more specific function available. maybe like (type)?
 

  (repeat (length entl)
    (print (nth ct entl))
    (setq ct (1+ ct))
  )


thanks to everyone for their help thus far again. ive made a few forum posts now and im super appreciative that this place exists. i am trying and giving these problems a go before i ask questions, and having some guidance when i get stuck is great, because this problem solving approach to drafting really helps me enjoy it, so thanks ^_^

Link to comment
Share on other sites

Ssget can be 1 or multiple or even ALL objects, which can be filtered also, by say type of object, layer, color to mention a couple.

 

You can get each object in the selection set using ssname. (ssname ss x) where x is the item number.  Once you have an item you can use VL to look at properties or Entget to get at properties.

 

(if (= ss nil)
(alert "no objects selected ")
(repeat (setq x (sslength ss))
(setq ent (ssname ss (setq x (1- x))))
; do something here
)
) ; if

 

It would be best to describe what objects your looking at for more helpful code.

  • Like 1
Link to comment
Share on other sites

On 1/12/2024 at 3:46 PM, BIGAL said:

It would be best to describe what objects your looking at for more helpful code.

On 1/12/2024 at 2:47 PM, cagorskij said:

Specifically I'd like to be able to uniquely identify, get the contents of (these first two i can glean from existing code), and get the x/y coords of text entities.

apologies if im misunderstanding what you mean by 'object', but is this not a sufficient description?
the contents would refer to the bearing value itself, unique id is ename i guess, and the x/y coords are so i can print the rotated bearing underneath each text entity.

also what is meant by VL? i've figured it's a big library of functions, but I generally dont know what they do... should I just read through the manual for each one?

thank you for the help by the way. I'll try see if i can get my code working with ssname! :)

Link to comment
Share on other sites

Post a dwg please, I think there is some confusion with the English wording, "bearing" should be "rotation" as its known in CAD. Bearing is a term used in land surveying.

Link to comment
Share on other sites

I was able to solve my problem with ssname :) cheers
 

55 minutes ago, BIGAL said:

Post a dwg please, I think there is some confusion with the English wording, "bearing" should be "rotation" as its known in CAD. Bearing is a term used in land surveying.


Oh I meant it in land surveying terms, not the rotation of the entity itself, my bad. My tool just changes the text without spinning anything around ^^;

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