Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Python script using Mash to duplicate along curve

Python script using Mash to duplicate along curve

davidm5798
Contributor Contributor
1,049 Views
1 Reply
Message 1 of 2

Python script using Mash to duplicate along curve

davidm5798
Contributor
Contributor

Hello,

I am trying to make a script that takes in an object input and curve input which then duplicates this object on the curve. I am currently having trouble with setting up a connection between the curve and the Mash curve Node. I also would appreciate if anyone could share any resources with me for scripting with mash, the docs are aren't very clear. Thanks.

import maya.cmds as cmds
import MASH.api as mapi
import flux.core as fx

def runPreset():
    # Add labels for each step of the smart preset
    steps = [
        'Step 1: Drag in your object:', 
        'Step 2: Drag in your curve to duplicate on:'
    ]
    
    fx.DropWindow.getDrop(steps, lambda data: smartPreset.send(data), title = "DuplicateAlongCurve" ) 
    
    
    node = yield
    
    nodes = node.split('\n')
    
    
    # create a new MASH network
    mashNetwork = mapi.Network()
    mashNetwork.createNetwork(name = "MASH")
    
    # get the second step drop
    node = yield
    print(node)
    #Create Curve Node with Curve
    Curvenode = mashNetwork.addNode("MASH_Curve")
    #This is where I am stuck
    cmds.connectAttr('MASH_Curve' + 'node', force=1)
    yield

#run the preset
smartPreset = runPreset()
smartPreset.next()

 

0 Likes
1,050 Views
1 Reply
Reply (1)
Message 2 of 2

davidm5798
Contributor
Contributor

I figured it out, it was basically me not understanding how to use the node editor and attribute names correctly while scripting with python. 

0 Likes