Author Topic: SSGET + custom message + keywords  (Read 6423 times)

0 Members and 1 Guest are viewing this topic.

vladimirzm

  • Guest
SSGET + custom message + keywords
« on: July 12, 2012, 09:38:38 PM »
hi,

I am looking a way to do this with ssget:

Select objects to add or [option1/option2]: <option1>

will it be possible?
just with autolisp visuallisp
the search doesn't give me any answer.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: SSGET + custom message + keywords
« Reply #1 on: July 13, 2012, 02:05:16 AM »
Unfortunately ssget is one of the input functions which don't allow a custom message. Neither does it adhere to initget.

There's 3 work-arounds (in order of my preference - best to worst):
  • Have ssget return nil if nothing selected (i.e. Space or Enter pressed), then start a getkword for options and return to ssget again.
  • Do the options before ssget ... similar to what happens in the Offset command.
  • Ask for getpoint + getcorner for window/crossing selection, or a series of getpoints for fence/WPoly/CPoly, or a series of entsel's, etc. Then pass these as a selection point list to ssget.
It's not pretty, but I don't know of any other way.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: SSGET + custom message + keywords
« Reply #2 on: July 13, 2012, 02:55:25 AM »

I'd be writing a helper function that combines the prompts and selection and addition to a selection set.

Just my 2 cents.

Regards
kdub
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: SSGET + custom message + keywords
« Reply #3 on: July 13, 2012, 04:17:16 AM »
Do you mean a defun to do the getpoints and ssget (as per my option 3)? Or do you mean create a new ssget-extended in DotNet / ARX?
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: SSGET + custom message + keywords
« Reply #4 on: July 13, 2012, 04:32:32 AM »

Yes.

But it would depend on the OP's actual requirement.

I use several variants to achieve what I want personally ( collected in my library).

I prefer a routine that is explicit in it's purpose .... so it can be thoroughly tested.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: SSGET + custom message + keywords
« Reply #5 on: July 13, 2012, 08:09:17 AM »
This old function could be expanded to accommodate custom keywords:

http://www.theswamp.org/index.php?topic=34804

For a custom selection message, I use this:

Code - Auto/Visual Lisp: [Select]
  1. ;; ssget  -  Lee Mac
  2. ;; A wrapper for the ssget function to permit the use of a custom selection prompt
  3. ;;
  4. ;; Arguments:
  5. ;; msg    - selection prompt
  6. ;; params - list of ssget arguments
  7.  
  8. (defun LM:ssget ( msg params / sel )
  9.     (princ msg)
  10.     (setvar 'nomutt 1)
  11.     (setq sel (vl-catch-all-apply 'ssget params))
  12.     (setvar 'nomutt 0)
  13.     (if (and sel (not (vl-catch-all-error-p sel)))
  14.         sel
  15.     )
  16. )

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: SSGET + custom message + keywords
« Reply #6 on: July 13, 2012, 11:19:32 AM »
Slight mod  ;)
Code - Auto/Visual Lisp: [Select]
  1. ;; ssget  -  Lee Mac
  2. ;; A wrapper for the ssget function to permit the use of a custom selection prompt
  3. ;;
  4. ;; Arguments:
  5. ;; msg    - selection prompt
  6. ;; params - list of ssget arguments
  7.  
  8. (defun LM:ssget ( msg params / sel )
  9.     (princ msg)
  10.     (setvar 'nomutt 1)
  11.     (setq sel (vl-catch-all-apply 'ssget params))
  12.     (setvar 'nomutt 0)
  13.     (if (not (vl-catch-all-error-p sel))
  14.         sel
  15.     )
  16. )
If the sel variable = nil, then return it anyway. Doesn't make any difference.

Unfortunately it still doesn't allow for keywords as other get* functions do: http://docs.autodesk.com/ACD/2011/ENU/filesALR/WS1a9193826455f5ff1a32d8d10ebc6b7ccc-69da.htm

Which is what I understood from the OP's request. At least with your defun the message is displayed as if it's a custom message for ssget.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

vladimirzm

  • Guest
Re: SSGET + custom message + keywords
« Reply #7 on: July 13, 2012, 01:19:52 PM »
thank you everybody, and Lee Mac for LM:ssget

so far I'm using ENTER for nothing selected, other ways are too long for a small routine

I have been searching how autocad handles this, and i get surprise of GROUP command.
I need that power...  :x

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: SSGET + custom message + keywords
« Reply #8 on: July 13, 2012, 02:51:08 PM »
Slight mod  ;)

Thanks  :-)

Unfortunately it still doesn't allow for keywords as other get* functions do: http://docs.autodesk.com/ACD/2011/ENU/filesALR/WS1a9193826455f5ff1a32d8d10ebc6b7ccc-69da.htm

I know - hence the first suggestion in my post, however the function I linked to would still require rather a lot of modification.  :|

VovKa

  • Water Moccasin
  • Posts: 1629
  • Ukraine
Re: SSGET + custom message + keywords
« Reply #9 on: July 14, 2012, 01:53:46 PM »
http://www.theswamp.org/index.php?topic=19881.msg246261#msg246261
SelAtts can be modified to work not only with attributes but with any entity type