How to add a new command to a context menu

I am trying to add a command to the shift+right-click menu alongside the entity snaps to emulate the "From" command in Autocad. The command runs a Lisp file (Reference.lsp from the Icad help).The command appears in the context menu when I shift+right-click while not in a command, but if I do it during a command such as drawing a line, it will not appear.I have tried all the options in Tools>Customize>Menu>Options but nothing will get it to appear during a command. Can anyone tell me what I'm doing wrong?

Comments

  • Have you looked at the "Options" window which is available during menu item modification? (in the middle near the bottom).

  • Yes, I tried "Context Menu Exclusive" and "Temporary Popup" and the entity options - in fact in desperation I tried all of the other options too - but none of them, nor any combination of them, would work. I'm stumped.

  • To use Reference.lsp to emulate the "From" command in Autoacad do the following:1. Edit icad.lsp, which sits in the Bricscad installation folder, e.g. C:\Program Files\BricsCad\BricsCad) and add the following line:(load "reference.lsp")2. Launch Bricscad.3. In the TOOLS menu choose CUSTOMIZE 4. Click the KEYBOARD tab5. Click the NEW button6. Press the desired key-combination, e.g. Ctrl+Alt+R7. In the COMMAND field type: (ref)8. Click the CLOSE button.When in a DRAW command, e.g. LINE, press Ctrl+Alt+R to define the distance "from" the reference pojnt.

  • Thanks Louis. I tried that and it works, but I would really like to have it in the right-click menu, it's much easier to use there when drawing a line.

  • Got it!The problem was that under Tools>Customize>Menus>Settings>Entity Snap there are two copies of the Snap commands. I was trying to add the command to the first copy, but I just discovered the second copy and the command works in there. It looks like the first copy is for the regular context menu and the second one for the context menu used while a command is active.Here's how to do it.I forget where I found Reference.lsp but here it is:(defun REF ( )(setvar "LASTPOINT" (getpoint "\nReference point: "))(getpoint "\nNext point: " (getvar "LASTPOINT")))Save it to the main BricsCad program folder or anywhere in the programs path.Edit icad.lsp as Louis has detailed above.Go to Tools>Customize and click on the Menus tab.Under Settings>Entity Snap look for Entit&y Snap Settings... It should be at the top. Scroll down further until you see a second entry named Entit&y Snap Settings...Decide where under that entry you want to add the new command. Click on an existing command then click on the Insert button and select Context Menu Item. The new command will be inserted above the command you first selected. If it's in the wrong place you can drag it to where you want it.I named the command &From for compatibility with Autocad.Type (REF) in the command text box.Click on the Options button and select 'Temporary Popup' then click 'OK'. This makes it only appear during a command.Click Close and it should now work.If you want this command to appear while a command is not active, repeat the above but put it under the first Entity Snap Settings entry, and don't select 'Temporary Popup' in Options.

This discussion has been closed.