Author Topic: Passing the selected objects among different commands  (Read 296 times)

0 Members and 1 Guest are viewing this topic.

Shay Gaghe

  • Newt
  • Posts: 89
Passing the selected objects among different commands
« on: April 17, 2024, 11:28:41 AM »
I require assistance with executing a sequence of commands. Some of these commands are built-in to AutoCAD, while others are functions loaded as lisps.

As the commands I'm using tend to generate or subtract objects, I find myself needing to reselect after each command.

One approach I considered is selecting all visible objects after each command execution, but I'm having trouble making it work.

Could you provide some assistance?"
Code: [Select]
(defun c:main()
      (sssetfirst nil (ssget "_A"));; select objects
      (command "c:flatten") ; Unknown command "C:FLATTEN".  Press F1 for help.
      (sssetfirst nil (ssget "_A"));; select objects
      (command "-overkill" "d")
  )

ribarm

  • Gator
  • Posts: 3279
  • Marko Ribar, architect
Re: Passing the selected objects among different commands
« Reply #1 on: April 17, 2024, 11:38:53 AM »
If you have flatten.lsp loaded, then you invoke it with just (c:flatten) - that command is sufficient...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Shay Gaghe

  • Newt
  • Posts: 89
Re: Passing the selected objects among different commands
« Reply #2 on: April 17, 2024, 12:01:11 PM »
ok. how can i respond to parameters?

like (command "flatten" "NO" "")

JohnK

  • Administrator
  • Seagull
  • Posts: 10649
Re: Passing the selected objects among different commands
« Reply #3 on: April 17, 2024, 12:22:58 PM »
You cannot. In this case you'd build your own version which does not require interaction.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Shay Gaghe

  • Newt
  • Posts: 89
Re: Passing the selected objects among different commands
« Reply #4 on: April 17, 2024, 01:22:04 PM »
what about vlax-add-command?

personally, i coudnt make it work

JohnK

  • Administrator
  • Seagull
  • Posts: 10649
Re: Passing the selected objects among different commands
« Reply #5 on: April 17, 2024, 02:38:39 PM »
Sorry, I'm not sure what that function has to do with the issue.

https://www.theswamp.org/Sources/doc/avlisp/#vlax-add-cmd
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org