Add command to Right Click Surface Menu

Add command to Right Click Surface Menu

RDunkley
Advocate Advocate
3,818 Views
15 Replies
Message 1 of 16

Add command to Right Click Surface Menu

RDunkley
Advocate
Advocate

I can't seem to find where the Commands that show up when Right-Clicking are located in the CUI Editor.

In this case I have some commands that I would like to add when I have a surface selected and then Right-Click...

Any help would be appreciated.

Regards.

RDunkley_0-1667516294829.png

 

Currently using Civil 3D 2024 & AutoCAD 2025
0 Likes
Accepted solutions (1)
3,819 Views
15 Replies
Replies (15)
Message 2 of 16

kblakely
Contributor
Contributor

Screenshot 2022-11-04 072954.jpg

Message 3 of 16

kblakely
Contributor
Contributor

Highlighted the wrong one. I modified the "Context menu for edit mode" and the modification appears when a surface is selected and I right-click.

0 Likes
Message 4 of 16

RDunkley
Advocate
Advocate

Hi, What command did you add..? I’m struggling to understand how Civil 3D knows that the context is for a surface. For example, if I create a new command that I want to use for surfaces do I need to use the Alias to tell it that it is for a surface? If so, do you know what a Alias applies to Aecc Surfaces?

Currently using Civil 3D 2024 & AutoCAD 2025
0 Likes
Message 5 of 16

kblakely
Contributor
Contributor

I added a command that I created for editing a CogoPoint (nothing to do with a surface) but still shows in the menu when a surface is selected and I right-click. I haven't created any code for a surface. I'm not sure if I really understand your question but I don't believe an Alias comes into play, although I am no expert. Can someone else please help?

0 Likes
Message 6 of 16

Norman_Yuan
Mentor
Mentor

So, you want a context menu item available when a specific type of entity is selected (surface, in your case), or even only a particular entity is selected (i.e. only certain surface is selected). 

 

With CUI, as @kblakely shows, you can only create generic context menu item for "edit" mode. That is, the context menu would be available when any type of entity is selected.

 

If you do .NET API programming, this can be easily achieved: you can have extra context menu item showing up in the context menu when specific type of entity is selected. You can even fine-tune the extra context menu item to target only certain entity in that entity type (that is, in your case, the context menu item will show up when any surface entity is selected, but the menu item can be enabled/disabled depending on if the selected surface is the one in interest.

 

Since you did not mention whether .NET programming would be your expected solution, I am not going into details on how to do it in .NET code. I should also say that this applies to all AutoCAD/AutoCAD verticals.

 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 7 of 16

RDunkley
Advocate
Advocate
Thankyou. I thought this might be the case... I’ve not used the .net API before. If you could assist me it would be very much appreciated but I understand if you think it may be too complex for a newbie..! Regards.
Currently using Civil 3D 2024 & AutoCAD 2025
0 Likes
Message 8 of 16

Norman_Yuan
Mentor
Mentor

Yes, it is a bit advanced topic in AutoCAD .NET API programming. You can read this as starting point and decide how you can pursue it:

 

https://www.keanw.com/2007/05/adding_a_contex.html 

 

Norman Yuan

Drive CAD With Code

EESignature

Message 9 of 16

Jeff_M
Consultant
Consultant

@RDunkley check your messages.

Jeff_M, also a frequent Swamper
EESignature
Message 10 of 16

andrewpuller3811
Advisor
Advisor
Accepted solution

Adding Right Click menus for Cogo Points, Surfaces etc. does not necessarily need to be done though the API.

 

It you want to add a menu for Tin Surfaces only, you can do it in the CUI editor by -

Expand the Shortcuts Menus node

Right Click on the Shortcuts Menus node and choose New Shortcut Menu

Name it Tin Surfaces (or something useful)

Click on the new Shortcut Menu

On the right hand side, click in the Aliases box

Click the Ellipsis button on the right hand side (box with 3 dots)

Enter OBJECT_AECC_TIN_SURFACE on a new line and click the OK button

Add your commands to the new shortcuts menu as you like and click ok to get out of the CUI Editor

 

When you select a tin surface in civil 3d, it uses the above created shortcuts menu and adds them to the generic shortcuts menus - see the attached screen shots.

 

The name you use in the alias box is the name of objects that are matched against by civil 3d when you select something and right click. You can get the names to use for other objects by selecting one of them and typing list on the command line. For tin surfaces you will see AECC_TIN_SURFACE. Add OBJECT_ to the front of that and it will work. Cogo points show AECC_COGO_POINT in the list command so you would use OBJECT_AECC_COGO_POINT for the shortcut menu alias.

 

Attached are screen shots of the Tin Surface shortcut menu in the cui editor and the menu as it shows in model space.

 



If a post provides a fix for your issue, click on "Accept as Solution" to help other users find solutions to problems they might have that are similar to yours.

Andrew Puller
Maitland, NSW, Australia
Windows 11
Intel core i7 11800 @ 2.30 GHz with 32GB Ram
Civil 3d 2023
Message 11 of 16

andrewpuller3811
Advisor
Advisor

Just found the list of objects and CUI Alias names that I pulled together from various location a few years back.



If a post provides a fix for your issue, click on "Accept as Solution" to help other users find solutions to problems they might have that are similar to yours.

Andrew Puller
Maitland, NSW, Australia
Windows 11
Intel core i7 11800 @ 2.30 GHz with 32GB Ram
Civil 3d 2023
Message 12 of 16

RDunkley
Advocate
Advocate
Thankyou. I’ll give this a try when I get a chance. Regards.
Currently using Civil 3D 2024 & AutoCAD 2025
0 Likes
Message 13 of 16

cneely
Collaborator
Collaborator

I came across this thread searching for a way to do the same thing! I created a workaround but it would be nice if it were easy to edit the object context area. Added screenshots showing my workaround

 

CUI_RC.pngSurfRightClick.png

AEC Collection 2022
WIN 10 PRO
Dell 3650, Intel i9-11900k @ 3.50GHz, 64 GB
NVIDIA QUADRO RTX 4000
http://www.cobbfendley.com
Message 14 of 16

RDunkley
Advocate
Advocate

Thanks @andrewpuller3811,

This is exactly what I was looking for..!

Currently using Civil 3D 2024 & AutoCAD 2025
0 Likes
Message 15 of 16

andrewpuller3811
Advisor
Advisor

Just to add to this, once you have it sorted, you can drag them from one cuix to another using the transfer tab of the cui editor. Useful to build up your cuix for the next release.



If a post provides a fix for your issue, click on "Accept as Solution" to help other users find solutions to problems they might have that are similar to yours.

Andrew Puller
Maitland, NSW, Australia
Windows 11
Intel core i7 11800 @ 2.30 GHz with 32GB Ram
Civil 3d 2023
0 Likes
Message 16 of 16

ceethreedee.com
Collaborator
Collaborator

This does work. but there is a few gotchas.. leaving this here for other people who find it.. 

It will only work in the "Main" cui it does not work in "Partial" cui's. So if you are creating a .bundle.. (packagecontents.xml etc. etc.) and you include a "Right click" shortcut menu customisation for OBJECT_AECC_TIN_SURFACE it WILL NOT LOAD

The other gotcha is to remember to keep the "POP" no when customising the shortcut menu. If you remove this and hit save next time you load this menu just disappears..

ceethreedeecom_0-1768651213213.png

 



Civil 3D 2025 / Infraworks 2025
Win 10 -DELL Precision Notebook 7680

Want FREE TOOLS! Come get my free productivity tools for civil 3d from the appstore here Ceethreedee tools
Or from my website below!
https://ceethreedee.com/ceethreedee-tools
0 Likes