Home Website Youtube GitHub

Rivet.py in rigbits folder

Hi all, I noticed there’s a “rivet.py” in rigbits folder, I assume it is for building ribbons, yes? If yes, how to use it?

The arguments says “mesh”, “edge1”, “edge2”, “parent”, and “name=None”, and I’ve tried manually input those variables, but it never worked. Is there something I’m missing here?

Please post the actual code you attempted, otherwise we can only guess!

1 Like

Ah, right. Sorry. I’m not too sure how to do this. All I did was create a simple cylinder geometry, and save 2 edge loops into 2 variables. Then I try to run the rivet script. It looks something like this:

import mgear.rigbits
import mgear.rigbits.rivet

edge1_ls = [u'pCylinder1.e[33]', u'pCylinder1.e[38]', u'pCylinder1.e[43]', u'pCylinder1.e[48]', u'pCylinder1.e[53]', u'pCylinder1.e[58]', u'pCylinder1.e[63]']
edge2_ls = [u'pCylinder1.e[32]', u'pCylinder1.e[37]', u'pCylinder1.e[42]', u'pCylinder1.e[47]', u'pCylinder1.e[52]', u'pCylinder1.e[57]', u'pCylinder1.e[62]']

mgear.rigbits.rivet.create(mesh='pyCylinder1', edge1=edge1_ls, edge2=edge2_ls, parent='null1', name='test')

and it return this:

# Error: 'module' object has no attribute 'create'
# Traceback (most recent call last):
#   File "<maya console>", line 1, in <module>
# AttributeError: 'module' object has no attribute 'create' # 

But when I look at rivet.py, this first function is like this:

    def create(self, mesh, edge1, edge2, parent, name=None):
        self.sources = {
            'oMesh': mesh,
            'edgeIndex1': edge1,
            'edgeIndex2': edge2

        if parent:
            pm.parent(self.o_node['locator'].getParent(), parent)
        if name:
            pm.rename(self.o_node['locator'].getParent(), name)

        return self.o_node['locator'].getParent()

And I thought if I can provide those arguments, I can build a ribbon with this rivet script. I also roughly went through the tutorial through this link >> http://jinglezzz.tumblr.com and I feel like, I must have missed something.


Thanks! I edited your post to include backticks ``` around your code, so it formats as code.

  1. The rivet module doesn’t have a create function. The rivet class inside the rivet module has a create method. So you could need to create an instance of mgear.rigbits.rivet.rivet().create()

  2. I don’t know, but I assume the edge arguments are supposed to be edges, not edge-loops. As in one single edge. But again, I don’t know!

  3. A lot of scripts in mGear expect PyNodes, not strings. This example below isn’t working for me, I’m still getting an error, but it would be closer to something like this:

import pymel.core as pm
import mgear.rigbits
import mgear.rigbits.rivet

myNode = pm.PyNode('pCylinder1')
myParent = pm.PyNode('null1')

edge1_ls = pCylinder.e[33]
edge2_ls = pCylinder.e[32]

mgear.rigbits.rivet.rivet().create(mesh=myNode, edge1=edge1_ls, edge2=edge2_ls, parent=myParent, name='test')

I’m still getting an error. My error is:

// Error: RuntimeError: file /Applications/Autodesk/maya2018/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.7/site-packages/pymel/internal/pmcmds.py line 134: setAttr: The type 'long' is not the name of a recognized type. //
  1. If you look in /scripts/mgear/rigbits/tweaks.py line 167, you will find an example of the rivet code in action. It might help you find the correct syntax.

The module tweaks.py is using rivet.py

the river pair is just the index number not the full object

I see. I thought it was a standalone object.

Thank you for clearing this, Miquel! Is there any plan to implement ribbons in foreseeable future?

no plans from me :sweat_smile:

1 Like