Community
PowerMill Forum
Welcome to Autodesk’s PowerMill Forums. Share your knowledge, ask questions, and explore popular PowerMill topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Macro to activate a copied toolpath

14 REPLIES 14
SOLVED
Reply
Message 1 of 15
iamcdn79
11085 Views, 14 Replies

Macro to activate a copied toolpath

Does anyone know how I can achieve this through a macro?

 

For example, I have toolpath 1 active, I want to copy that toolpath which would give me toolpath 1_1 and then activate that toolpath.

 

I would need this to work regardless of toolpath number, would need to work if I have toolpath 32_1_2_1 active then copying that toolpath which would give me toolpath 32_1_2_1_1 and activate that one


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

14 REPLIES 14
Message 2 of 15
TK.421
in reply to: iamcdn79

activate toolpath #

--------------------------------------
the numbers never lie
Message 3 of 15
iamcdn79
in reply to: TK.421

Forgot that command, thanks


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 4 of 15
Rui_Ramos
in reply to: iamcdn79

Hello,

here is my contribution , this macro will copy the toolpath, activates and opens it to edit...

 

 

have a nice day!!

Message 5 of 15
Beta_Librae
in reply to: Rui_Ramos

Hey Guys,

 

We know the semicolon represents the active entity. I've searched the Macro Programming Guide and it doesn't say what the # represents. Is it dealing with the last entity?


Kind Regards,
Not cnc, you can call me Peabrain
Message 6 of 15
TK.421
in reply to: Beta_Librae

# represents the last created entity. However, this is kind of persnickety in how it works. If you use it directly after you create an entity it'll work fine. I've noticed that after running other commands or making something else - Create Toolpath "asdfasdF" then Activate Workplane # - i've run into trouble. The best thing if you think that might be the case is to capture the name of what you're using # for in a variable.

--------------------------------------
the numbers never lie
Message 7 of 15
Beta_Librae
in reply to: TK.421

I'm using it in an NC Program creation macro as a fail-safe to the error message "no active toolpath exists" when changing the tool number. I just want to activate any toolpath in case I forget so that the macro doesn't cack on me.


Kind Regards,
Not cnc, you can call me Peabrain
Message 8 of 15
TK.421
in reply to: Beta_Librae

You could use this as a fail safe to keep macro from breaking:

 

IF NOT entity_exists ('toolpath','') {
	STRING tpName = INPUT ENTITY TOOLPATH "Select Toolpath"
	ACTIVATE TOOLPATH $tpName
}

that might be a bit more robust and help avoid any unexpected behavior from the # command

--------------------------------------
the numbers never lie
Message 9 of 15
TK.421
in reply to: Beta_Librae

Sorry, I forgot a key component to my recommendation. Now it'll work.

--------------------------------------
the numbers never lie
Message 10 of 15
Beta_Librae
in reply to: TK.421

Thanks for the code. I think that might be the way to go. I did think about the drop down and also considered trying to string the name somehow but was trying to avoid that extra click. The # seemed like it would work, but after you explained how it may not, I tested it further and did get it to fail so that's out and the dropdown is in.


Kind Regards,
Not cnc, you can call me Peabrain
Message 11 of 15
Beta_Librae
in reply to: TK.421

What was the key component?


Kind Regards,
Not cnc, you can call me Peabrain
Message 12 of 15
TK.421
in reply to: Beta_Librae

glad it'll work out. extra clicks suck, but sometimes you've got to live with them. Have a great day!

 

<><

--------------------------------------
the numbers never lie
Message 13 of 15
TK.421
in reply to: Beta_Librae

i forgot the "Select Toolpath" after INPUT ENTITY...   if you dont have that, it'll pop the drop down menu but not do anything

--------------------------------------
the numbers never lie
Message 14 of 15
Beta_Librae
in reply to: TK.421

Ok thanks,

 

Hope you enjoy the rest of your day too.


Kind Regards,
Not cnc, you can call me Peabrain
Message 15 of 15
urizenYHS3W
in reply to: Beta_Librae

The # is a shorthand for "The last name used or created of the entity type preceding it". So ACTIVATE TOOLPATH # will active the last named toolpath or last created toolpath. Whilst ACTIVATE WORKPLANE # will do the same for the WORKPLANE. It should use the last named/created WORKPLANE when the context is TOOLPATH.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report