dR_symmetrize not available in mayabatch?

dR_symmetrize not available in mayabatch?

sribetZJ8ZK
Observer Observer
1,193 Views
4 Replies
Message 1 of 5

dR_symmetrize not available in mayabatch?

sribetZJ8ZK
Observer
Observer

Hi, 

 

I want to programmatically symmetrize a mesh. I figured out how to execute that in mel/Python, but it seems it does not work when in mayabatch.

Manually, I would select whatever I need to be symmetrized (vertices), go to the menu 'Edit mesh | Symmetrize', select a mesh edge for symmetry, and that would be it. What I am doing to programmatically automate this is:

from maya import mel
mel_symmetrization_cmd_str = 'activateTopoSymmetry(<0>, <1>, <2>, "vertex", "cmds.dR_symmetrize", 1);'
mel.eval(mel_symmetrization_cmd_str)

with <0>, <1> and <2> being the data I need (ie. <0>: mesh edge for symmetry; <1>: vertices that I want to symmetrize; <2>: node name).

 

It works great when executing this inside a scene in script editor, but fails when in mayabatch: 

STDOUT: Error: line 0: Cannot find procedure "dR_symmetrize".
WARNING: Error: line 0: RuntimeError: file python_module.py line 72: Error occurred during execution of MEL script

 

I tried adding source to drInit.mel, and also made sure the modelingToolkit was loaded, but it didn't help.

 

Is there something specific to do/call/add? Where does the function 'dR_symmetrize' come from? Can it be used in mayabatch? If not, is there another way to automate a mesh symmetrization? 

 

Thanks for your help!


PS: I am using Maya2020.3.

 

1,194 Views
4 Replies
Replies (4)
Message 2 of 5

brentmc
Autodesk
Autodesk

Hi,

 

dR_symmetrize is part of the modeling toolkit and it is not available in batch mode so I'll log an issue for that.

 

I think your only option is to use regular maya with the -script option instead of maya batch.

 

Note: There is no way to replicate symmetrize in the API or scripting and the only way to query symmetry is using the filterExpand command (-symPositive/Negative/Seam) which can classify components into three buckets but will not give you the symmetry correspondence between components.

--

Brent

Brent McPherson
Principle Software Developer
Message 3 of 5

sribetZJ8ZK
Observer
Observer

Edit:
I meant 'dR_symmetrize'  in the code snippet, not 'cmds.dR_symmetrize' 😇

0 Likes
Message 4 of 5

sribetZJ8ZK
Observer
Observer

Hi, 

Thank you for your answer.

All right. I will look into what you said.
Thank you for logging this issue!

0 Likes
Message 5 of 5

brentmc
Autodesk
Autodesk

No problem.

 

Cheers!

--

Brent

Brent McPherson
Principle Software Developer