How to rotate a CAD model in PowerMill using PowerMill API?

Anonymous

How to rotate a CAD model in PowerMill using PowerMill API?

Anonymous
Not applicable

Dear Sirs, 

 

Good morning. 

 

I want to rotate a CAD model in PowerMill along the Z-axis. Normally we will click on Model->Transform->Rotate Z ->90. And this is the result I got:

 

rotateZ2.jpg

 

Normally, after we click the 'Rotate Z' button, a pop out window will appear and ask for angle input:

angleInput.jpg

 

And this is the macro to do this rotation operation:

sampleMacro.jpg

 

When I run this macro file using the 'Run' button in PowerMill, this operation finished automatically without the need to input "90" in the pop out window. 

button.jpg

 

However, when I tried to use PowerMill API (in C#) to execute this macro file, the pop out window appeared and asking me to input the angle. In the PowerMill API, I used the RunMacro method and specify the macro file path as an input. 

 

Here is my question. How can we rotate a CAD model using PowerMill API RunMacro method, and make sure that the pop out window will not come out, and execute the macro just like normal, without the need to enter angle into that pop out window?

 

Thanks.

 

Regards,

 

Maan Tarng

0 Likes
Reply
Accepted solutions (1)
768 Views
3 Replies
Replies (3)

Sean570
Advocate
Advocate
Accepted solution

You just need to make a custom macro and run that. 
DIALOGS MESSAGE OFF

TRANSFORM RESET TRANSFORM TYPE ROTATEZ TRANSFORM ANGLE "90"
TRANSFORM MODEL ALL
DIALOGS MESSAGE ON

You could enter whatever number you want in the macro, but doing it this way keeps it from raising the form. 

EDIT: I did this in powermill 2015, so hopefully the command still works, but the logic should be the same with any new commands.

0 Likes

Sean570
Advocate
Advocate

Just to clarify, are you trying to run this command entirely from the API? I would just make the API call the macro to run if that is not the case. But if you want to run it without any macro, try and see if keeping the "90" on the same line as the command helps keep it from raising the dialog. 

0 Likes

Anonymous
Not applicable

Dear Sean570,

 

Thanks for your help!

 

Regards,

 

Maan Tarng

0 Likes