Author Topic: Dual Mode Selection for Lisp routines  (Read 1365 times)

0 Members and 1 Guest are viewing this topic.

HeavyThumper

  • Mosquito
  • Posts: 13
Dual Mode Selection for Lisp routines
« on: July 13, 2021, 02:28:39 PM »
Most of the lisp routines I've seen involve executing the command first - then selecting the entities to be operated on. But in xCAD I'm used to being able to also pre-select my targets prior to command execution - and having the command recognize which mode it's being called in.

Is there an example of such dual-mode selection available?

JohnK

  • Administrator
  • Seagull
  • Posts: 10640
Re: Dual Mode Selection for Lisp routines
« Reply #1 on: July 13, 2021, 02:39:35 PM »
Cannot you just use PSELECT to select items then execute the lisp and use the "P" (for previous)?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: Dual Mode Selection for Lisp routines
« Reply #2 on: July 13, 2021, 03:22:57 PM »
If you are using the ssget to select objects then you can try the following which will proceed with the preselected object(s) otherwise it will ask the user to select objects and of course you need the filter to target certain type of objects.

Code - Auto/Visual Lisp: [Select]
  1. (ssget "_:L-I")
  2.  

HeavyThumper

  • Mosquito
  • Posts: 13
Re: Dual Mode Selection for Lisp routines
« Reply #3 on: July 13, 2021, 03:28:32 PM »
If you are using the ssget to select objects then you can try the following which will proceed with the preselected object(s) otherwise it will ask the user to select objects and of course you need the filter to target certain type of objects.

Code - Auto/Visual Lisp: [Select]
  1. (ssget "_:L-I")
  2.  

I think...that's what I'm looking for. Is there a reason this construct is not used more often (at least, not that I've seen)?

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: Dual Mode Selection for Lisp routines
« Reply #4 on: July 13, 2021, 03:44:45 PM »
I think...that's what I'm looking for. Is there a reason this construct is not used more often (at least, not that I've seen)?
It depends on the author of the codes and not all codes you see on the web is valid to use or even to try.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Dual Mode Selection for Lisp routines
« Reply #5 on: July 14, 2021, 05:56:14 PM »
Typically ssget will accept an implied selection even without the inclusion of the "I" mode string.

BIGAL

  • Swamp Rat
  • Posts: 1414
  • 40 + years of using Autocad
Re: Dual Mode Selection for Lisp routines
« Reply #6 on: July 14, 2021, 08:55:42 PM »
Its the world of Noun - Verb, Verb - Noun. Its also relevant to your question before or after.

Some software insists you make selection 1st then command, a lot of code posted uses the ssget filters so often the filter value is not known till you pick an object to get its property value. Then select.

For me just years of command then ask for selection.
A man who never made a mistake never made anything