Problem with home directory and custom menu

Problem with home directory and custom menu

Jaanyaar
Advocate Advocate
2,752 Views
13 Replies
Message 1 of 14

Problem with home directory and custom menu

Jaanyaar
Advocate
Advocate

Hi

 

I wanna create a custom menu (Adding a menu option to a toolpath entity context menu, for example). To do this:

I've defined an environment variable for PowerMill home folder as: Home=C:\Home

I've created a Toolpath.xml file in the PM home folder with the following simple content.

 

<?xml version="1.0" ?>

<menupage>

<button label="Block" command='FORM BLOCK'/>

</menupage>

 

But I don't know why I can't see any custom menu option for a toolpath entity! Am I doing anything wrong?

0 Likes
Accepted solutions (2)
2,753 Views
13 Replies
Replies (13)
Message 2 of 14

Anonymous
Not applicable

I know this is not what you exactly want, but here you have a similar solution:

http://forum.delcam.com/viewtopic.php?p=57359#p57359

 

If You would like to use this solution You have to add path to macro folder.

 

Mateusz

Message 3 of 14

rui_rita
Advocate
Advocate
Accepted solution

Hi @Jaanyaar

 

you need a subfolder, like pmill4, ( I think it could be any number, I didn't try, I use pmill4).

 

You have home = c:\home\

 

and you have the toolpath.xml in c:\home\pmill4

my toolpath.xml

 

<?xml version="1.0" ?>
<menupage>
<button
command='macro C:\dcam\config\pmill4\toolpath_menu\SetInitalPoint "%s"'
label="Define Inital Point"
multiple_selection="allowed"
/>
<spacer multiple_selection="allowed"/>
<button
command='macro C:\dcam\config\pmill4\toolpath_menu\setthickness '
label="Define Thickness"
multiple_selection="allowed"
/>
<button
command='macro C:\dcam\config\pmill4\toolpath_menu\setboththickness '
label="Define Radial/Axial Thickness"
multiple_selection="allowed"
/>
<spacer multiple_selection="allowed"/>
<button
command="EDIT PAR selected 'boundary'"
label="Define Active Boundary"
multiple_selection="allowed"
/>
<spacer multiple_selection="allowed"/>
<button
command="EDIT PAR selected 'workplane'"
label="Define Active Workplane"
multiple_selection="allowed"
/>
<spacer multiple_selection="allowed"/>
<button
command='macro C:\dcam\config\pmill4\toolpath_menu\SetBlock '
label="Define Active Block"
multiple_selection="allowed"
/>
<button
command='macro C:\dcam\config\pmill4\toolpath_menu\SetBlockModel '
label="Define Block by Model"
multiple_selection="allowed"
/>
<spacer multiple_selection="allowed"/>
<button
command='macro C:\dcam\config\pmill4\toolpath_menu\MirrorX "%s"'
label="Mirror in  X (PLANO YZ)"
multiple_selection="allowed"
/>
<button
command='macro C:\dcam\config\pmill4\toolpath_menu\MirrorY "%s"'
label="Mirror in Y (PLANO XZ)"
multiple_selection="allowed"
/>

</menupage>



Os melhores cumprimentos | Best regards
Rui Rita
________________________________
NEWCAM, Lda.
Message 4 of 14

Jaanyaar
Advocate
Advocate

@Anonymous Altough that link was not exactly related to my mentioned issue but I learned nice things there and I'm appreciated for it. 


Thanks a lot,@rui_rita. You are right, the solution is that lost subfolder. I tested different names and just pmill2 or pmill4 did work.

 

BTW, how can I change default context menu and add a command or macro to it, just the way celik has done there?  http://forum.delcam.com/viewtopic.php?p=57359#p57359

0 Likes
Message 5 of 14

kukelyk
Advisor
Advisor

Make a file named user_menu without any extension in the %home%\pmill4 folder, and link your macros to it.

See the post of Piro at the same topic in the old forum

0 Likes
Message 6 of 14

iamcdn79
Mentor
Mentor

@Jaanyaar wrote:

 

 

BTW, how can I change default context menu and add a command or macro to it, just the way celik has done there?  http://forum.delcam.com/viewtopic.php?p=57359#p57359


For Powermill 2016 go to C:\Program Files\Delcam\PowerMILL 20.0.10\sys\hci\popups

 

For Powermill 2017 go to C:\Program Files\Autodesk\PowerMill 21.0.30\sys\hci\popups

 

You have to edit the file called explorer.ppm. Make sure to make a copy of the file first


Intel Core i9 13900KF CPU
128 GB Kingston Beast DDR4 SDRAM
PNY RTX A2000 6GB Video Card
WD 1 TB SSD Hard Drive
Windows 11 Pro

Message 7 of 14

Anonymous
Not applicable

@Jaanyaar wrote:

BTW, how can I change default context menu and add a command or macro to it, just the way celik has done there?  http://forum.delcam.com/viewtopic.php?p=57359#p57359


If you would do this like you discribe you have to put the '*xml' file into folder where is 'user_menu' file, set a environment variable "HOME", value "path_of_user_menu_file". Set a path to macro folder in PowerMill to the same location (path_of_user_menu_file), and it should work. I tried it just before and it works.

 

 

Mateusz

Message 8 of 14

Jaanyaar
Advocate
Advocate

Maybe I'm not right but it seems it is different from user menu that includes your desired macros/commands and is shown by RMC in the blank space of the Explorer. Those encircled items have been added to which file and in which place?

 

0 Likes
Message 9 of 14

Anonymous
Not applicable

I hope I put all settings into one screenshot (in attach). Watch it carefully and read slowly our answers again, and you will understand what you need to do.

All screenshots are in Polish language, but i think that won't be a serious problem for You..

 

 

 

Mateusz

0 Likes
Message 10 of 14

iamcdn79
Mentor
Mentor

@Jaanyaar wrote:

Maybe I'm not right but it seems it is different from user menu that includes your desired macros/commands and is shown by RMC in the blank space of the Explorer. Those encircled items have been added to which file and in which place?

 


Do you want to edit this menu popup?

 

Capture.PNG


Intel Core i9 13900KF CPU
128 GB Kingston Beast DDR4 SDRAM
PNY RTX A2000 6GB Video Card
WD 1 TB SSD Hard Drive
Windows 11 Pro

0 Likes
Message 11 of 14

rui_rita
Advocate
Advocate

Hi,

 

there is no need to edit the explorer.ppm to add your commands, 

 

 

you can use/put this files in %home%/pmill4 

 

user_menu.xml -> when right click in the white space of the pmill explorer.

Toolpath.xml-> will add a user sub-menu when you right click on selected toolpaths in the pmill explorer 

NCProgram.xml-> will add a user sub-menu when you right click on selected NCPrograms in the pmill explorer 

and to all entities in pmill...

 

Model.xml 

Boundary.xml

Tool.xml

...

 

you can see my user menus in the screen cast http://autode.sk/2ff9vLQ

 

this way is cleaner and safe, to add your commands



Os melhores cumprimentos | Best regards
Rui Rita
________________________________
NEWCAM, Lda.
0 Likes
Message 12 of 14

rui_rita
Advocate
Advocate

PS: You can have comammand for when you have single selection or multiple selection



Os melhores cumprimentos | Best regards
Rui Rita
________________________________
NEWCAM, Lda.
0 Likes
Message 13 of 14

Jaanyaar
Advocate
Advocate

Thank you for your care and efforts, Mateusz. I don't have any problem with creating that custom menu at the buttom of the context menu. I want to embed some commands in the place like the highlighted ones below. 

Default Context Menu Change2.jpg

 

 

 

 

Yes, iamcdn. I'm just learning, for example adding block command at above of the recreate block command. I took a look at the files in the address you provided but it was somehow confusing.

0 Likes
Message 14 of 14

iamcdn79
Mentor
Mentor
Accepted solution

@Jaanyaar wrote:

 

  

Yes, iamcdn. I'm just learning, for example adding block command at above of the recreate block command. I took a look at the files in the address you provided but it was somehow confusing.

_________________________________________________________

 

 

Open the explorer.ppm file. Do a search for "Load Components" and just above that line add the circled part with the location to your macro

 

Capture.PNG

 


Intel Core i9 13900KF CPU
128 GB Kingston Beast DDR4 SDRAM
PNY RTX A2000 6GB Video Card
WD 1 TB SSD Hard Drive
Windows 11 Pro