I think OP specifically asked for a way that did *not* involve duplicating
and scaling.
The Maya API has some options, in a nutshell:
1. Read points on original curve
2. Negate their x coordinate
3. Generate a new curve using the negated points
import cmdx
# Read original points
original = cmdx.selection()[0]
original_points = [p.read() for p in original["controlPoints"]]
# Negate an axis
negated_points = [(p[0], p[1], p[2] * -1) for p in original_points]
# Make new curve
parent = cmdx.createNode("transform", name="negated")
curve = cmdx.curve(parent, points=negated_points)
[image: image.png]
Key parts being the curve function, which is here
<https://github.com/mottosso/cmdx/blob/814c7d934b13ba8735736424b69d0b89639157fa/cmdx.py#L7231>
and iterating over the controlPoints array attribute which you can do using
cmds too.
On Mon, 26 Sept 2022 at 08:27, tomas mikulak <[email protected]> wrote:
> Hi, you can use mine,
> select good shape curve then not shaped and run script. it will mirror
> shape to another curve.
>
> ne 25. 9. 2022 o 23:19 benjamin ghys <[email protected]>
> napĂsal(a):
>
>>
>> Hello,
>>
>> Your last suggestion should perfectly work to mirror
>> On Sunday, September 25, 2022 at 9:17:06 PM UTC+2 [email protected]
>> wrote:
>>
>>> Hi every body,
>>> Can someone tell me how to mirror from +X to -X a nurbsCurve inside Maya
>>> using cmds or pymel ?
>>> I do not want to do the manual way of duplicating the curve, grouping
>>> it, fliping the group's x scale and freeze transform. I'm looking for a
>>> mathematical approach.
>>>
>>> One way I was thinking doing this is to get nurbsCurve's points and for
>>> each point multiply its X value by -1 and then reconstruct a new
>>> nurbsCurve using the new values.
>>> I'm not sure if it's an effective solution.
>>>
>>> Thanks
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/python_inside_maya/e4bd8d1b-1646-44a6-bf81-684409003346n%40googlegroups.com
>> <https://groups.google.com/d/msgid/python_inside_maya/e4bd8d1b-1646-44a6-bf81-684409003346n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/CAEUzAD2nxtCToUHO_euEf-R8bjrRPKNAWFYDQBGuhmh6UGQ-%2BA%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAEUzAD2nxtCToUHO_euEf-R8bjrRPKNAWFYDQBGuhmh6UGQ-%2BA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODzRuEs0ZTNYyV760n7As9ADZkBN-_Qj2DaVTdz9HCC1A%40mail.gmail.com.