Jump to content

How to detect menu items of a command when executing it?


vanowm

Recommended Posts

There are some commands that show different menus depending on the previous input. How do we handle such situations?

 

A simple example, when joining lines and arcs with PEDIT this command works:

(command "_pedit" "_m" (ssget) "" "_y" "_j" 0 "")

 

However, this same command fails when only polylines are selected (no lines and arcs) because it doesn't expect "_y" input:

(command "_pedit" "_m" (ssget) "" "_j" 0 "")

 

So, is there a way detect what does the command expects to be input at any given step?

 

Thank you!

 

P.S.

Just to get this out of the way, as a work around in this particular case I could detect what objects are selected and go with appropriate command sequence. That's not what I'm trying to learn here.

Edited by vanowm
Link to comment
Share on other sites

I tend to take the easy way out and your PS, an if or cond depending on the selection and the command - sometimes simple is quicker to program and can be as quick or a bit quicker in its execution (though for most speed gains or losses it is never enough to grab a drink).

 

I'd be interested too to see what everyone else does.

 

(As a side comment, I tend to submit 'simple' on the forum here, easier to follow and understand but there are usually more complex ways.... which is what you are asking)

  • Agree 1
Link to comment
Share on other sites

9 hours ago, lido said:

In order to avoid "_y", set the variable "PEDITACCEPT" to 1. The value is saved in registry. 

 

Remember if you change registry or other settings then record what they were before and change them back again as soon as possible so that any routine returns the users system to the state it was before

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...