Author Topic: How can I save SS and use in Lisp(ssget)?  (Read 1413 times)

0 Members and 1 Guest are viewing this topic.

xinxirong

  • Mosquito
  • Posts: 13
How can I save SS and use in Lisp(ssget)?
« on: January 17, 2016, 03:42:36 am »
I have a ADS function work pretty well in command mode:
command 'SAVSS can save current selection set,and when you want to use it ,for example copy,move ... etc
you can enter 'P1( or 'P2 or 'P3 or 'P4 )to get the selection set.
But ,int Lisp,for example:
(setq b (ssget)),It Prompt "cannot reenter Lisp".How can I save SS and use in Lisp(ssget)?

Code: [Select]
   static int ads_p1(void)
        {
                long len;
                int ret=acedSSLength(DocVars.docData().myss1,&len);
                if(ret!=RTNORM)                return RTERROR;
                if (len==0)        return RTERROR;
                ret=acedRetName(DocVars.docData().myss1,RTPICKS);
                if (ret==RTNORM)
                {
                        acutPrintf(_T("<P1 Selection set>"));
                }
                return (RSRSLT) ;
        }

ACED_ADSCOMMAND_ENTRY_AUTO(CBYApp, p1, true)


This is another example in vb
Code: [Select]
Dim ed As Editor =     Application.DocumentManager.MdiActiveDocument.Editor
Dim Opts As New PromptSelectionOptions()
Opts.Keywords.Add("myFence")
Opts.Keywords.Add("myWindow")
Opts.Keywords.Add("myWpoly")
Opts.Keywords.Add("myLastSel"
Opts.Keywords.Add("myPrevSel")
AddHandler Opts.KeywordInput, AddressOf handle_KeywordInput

.....

If e.Input.CompareTo("myPrevSel") = 0 Then  
  Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor  
  Dim res As PromptSelectionResult = ed.SelectPrevious()  
  If res.Status = PromptStatus.Error Then    
    Return  
  End If  
  Dim SS As Autodesk.AutoCAD.EditorInput.SelectionSet = res.Value  
  Dim idarray As ObjectId() = SS.GetObjectIds()  
  e.AddObjects(idarray)
End If

BlackBox

  • King Gator
  • Posts: 3742
Re: How can I save SS and use in Lisp(ssget)?
« Reply #1 on: January 17, 2016, 03:44:34 pm »
Why not just call acedSSSetFirst() on your ARX SelectionSet, followed by (ssget) within your LISP to acquire the implied selection?

http://adndevblog.typepad.com/autocad/2012/05/adding-and-removing-the-entities-from-pick-first-selection-set-using-objectarx.html

Cheers
"Potential has a shelf life." - Margaret Atwood

xinxirong

  • Mosquito
  • Posts: 13
Re: How can I save SS and use in Lisp(ssget)cannot reenter Lisp?
« Reply #2 on: January 17, 2016, 07:46:54 pm »
(ssget) still prompt
"cannot reenter Lisp"

MP

  • Seagull
  • Posts: 17012
  • brevity != aggression
Re: How can I save SS and use in Lisp(ssget)?
« Reply #3 on: January 17, 2016, 08:40:23 pm »
For a selection set named ss type !ss in response to the select objects prompt.
\|// Set goal. Experiment tirelessly until
|oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox | About