save selection set in drawing

save selection set in drawing

andkal
Collaborator Collaborator
477 Views
5 Replies
Message 1 of 6

save selection set in drawing

andkal
Collaborator
Collaborator

Hello
Im trying to save a selection set in drawing with this code

(setq Saved_SS_Gvar (ssget))
(vlax-ldata-put "SETS1" "selsets" Saved_SS_Gvar)

but I get this error:
error: Visual LISP: Input/output objects between document illegally <Selection set: 5f>

I guess I cannot save a selection set with this method. Is there another way?


• www.autolisps.blogspot.com - Productivity plugins for Autocad and Autocad MEP
• Autodesk AppStore
0 Likes
Accepted solutions (2)
478 Views
5 Replies
Replies (5)
Message 2 of 6

Kent1Cooper
Consultant
Consultant

You could put them into a GROUP, which if you prefer you can give a name for easy recall.

Kent Cooper, AIA
0 Likes
Message 3 of 6

Sea-Haven
Mentor
Mentor

Another could save the handle of each item. The obvious is of course what happens when a object is erased.

0 Likes
Message 4 of 6

andkal
Collaborator
Collaborator
Accepted solution

Hello
I noticed now that when I converted the selection set into a list, the code works.
It solves the problem


• www.autolisps.blogspot.com - Productivity plugins for Autocad and Autocad MEP
• Autodesk AppStore
0 Likes
Message 5 of 6

devitg
Advisor
Advisor

@andkal As I see you work vl functions 

 

after 

 

 

(setq Saved_SS_Gvar (ssget))
(setq obj-ss (VLA-GET-ACTIVESELECTIONSET adoc))
Then you can handle it by 
(vlax-for obj obj-ss
Do your stuff
)
No need to cont , change ent to obj, and so on 

Also yo can get the OBJ by 
(setq OBJ(VLA-Item obj-ss 0)) ; being 0 the  obj index 


 

  

 

 

 

0 Likes
Message 6 of 6

Sea-Haven
Mentor
Mentor
Accepted solution

Are you planning on closing the dwg and reopening ? The selection set may not match the objects unless you use the handle so just save the handles in a list. The entity names can change when close and reopen Google for more info.

0 Likes