Register Latest Topics
 
 
 


Reply
  Author   Comment  
FruehBird

First taste
Registered:
Posts: 11
Reply with quote  #1 
Can SOup allow you to create polygons, normals and UV's? I'm curious if I can build custom primitives via SOup. 
0
FruehBird

First taste
Registered:
Posts: 11
Reply with quote  #2 
Using a pyExpression I am trying to fill the attribute with the example on this page for (-type mesh) https://help.autodesk.com/cloudhelp/2016/CHS/Maya-Tech-Docs/Commands/setAttr.html

I have created a data type 'mesh' on the node using.
Code:
 cmds.addAttr( OS, longName='tempMesh', dataType='mesh' )


When trying to set the attribute I am getting an error:
Quote:
SyntaxError: non-keyword arg after keyword arg.


Any ideas how to properly input the data? My formatting is just off. 

here is the code in the pyExpression node:

 

Code:

import maya.cmds as cmds

 

#cmds.addAttr( OS, longName='tempMesh', dataType='mesh' )

 

cmds.setAttr(OS+'.tempMesh', type='mesh', { ("v" [3 ( (0, 0, 0), (0, 1, 0), (0, 0, 1) )] ),\

                                          ("vn" [3 ( (1, 0, 0), (1, 0, 0), (1, 0, 0) )] ),\

                                          ("e" [3 ((0, 1, "hard"), (1, 2, "hard"), (2, 0, "hard") )] )} )

 

0
pshipkov

SOuP Jedi
Registered:
Posts: 4,639
Reply with quote  #3 

Try this:

cmds.setAttr(OS+'.tempMesh', { ("v" [3 ( (0, 0, 0), (0, 1, 0), (0, 0, 1) )] ),\

                                          ("vn" [3 ( (1, 0, 0), (1, 0, 0), (1, 0, 0) )] ),\

                                          ("e" [3 ((0, 1, "hard"), (1, 2, "hard"), (2, 0, "hard") )] )},

                                          type='mesh' )

0
pshipkov

SOuP Jedi
Registered:
Posts: 4,639
Reply with quote  #4 
Check the pointCloudToMesh node. It can generate mesh geometry with point colors and uvs from provided point cloud. It does not provide granular control over the output.
There are plenty of other options available. The closest to what you need (or at least what i think you need) is the remesh node for example. From set of points (and normals, optional) it can generate mesh geometry in various different ways.
There are many other mesh generators too - like cocoon, copier, etc, etc. But they are focused on other tasks.

If you are more specific about your end goal - the purpose of generating geometry in the way you try, i can give you a more precise answer.

Thanks.
0
FruehBird

First taste
Registered:
Posts: 11
Reply with quote  #5 
Thanks pshipkov, 

Adding the type='Mesh' returns: 
Code:
TypeError: 'int' object is not callable


I would need full control over where the points are placed and which make up the polygons. Essentially the end goal is reading in an obj file, parsing the obj data with the incoming connections and then piping it to an empty mesh (polySurface).

I have everything good to go except the part of pushing the new mesh data to an 'out mesh' attribute. 
0
FruehBird

First taste
Registered:
Posts: 11
Reply with quote  #6 
Looking into this further it seems that just the format of the data being added through the setAttr is wrong and they type = 'mesh' has to be present since it is a non-numeric data type. 

It looks like if I can solve the formatting issue everything should work just fine.

Does anyone know how to properly format the data for a -type mesh? 
0
pshipkov

SOuP Jedi
Registered:
Posts: 4,639
Reply with quote  #7 
cmds.setAttr(OS+'.tempMesh', "v", 3, (0, 0, 0), (0, 1, 0), (0, 0, 1), "e", 3, 0, 1, "hard", 0, 2, "hard", 1, 2, "hard", type='mesh' )
0
FruehBird

First taste
Registered:
Posts: 11
Reply with quote  #8 
Thanks for looking into that pshiokov.

I want able to get that to produce any results. I did notice that 'vn' is required and so I put it back in and I get an error:
Code:
# RuntimeError: setAttr: Error reading data element number 17: #


Code:
cmds.setAttr('locator1.tempMesh', "v", 3, (0, 0, 0), (0, 1, 0), (0, 0, 1), "vn", 3, (1, 0, 0), (1, 0, 0), (1, 0, 0), "e", 3, (0, 1, "hard"), (1, 2, "hard"), (2, 0, "hard"), type="mesh" )


Looking at the 'documentation' the e values should also be wrapped by parentheses. 


0
pshipkov

SOuP Jedi
Registered:
Posts: 4,639
Reply with quote  #9 
What result do you expect to achieve ?
As far as i can tell it does the right thing.
0
FruehBird

First taste
Registered:
Posts: 11
Reply with quote  #10 
I am looking to store a temporary mesh in the attribute.

After the value is set I should be able to plug in the .tempMesh into the .inMesh of a polyshape.

It works fine if I use a polyCube and connect the .output to the .tempMesh of a locator, disconnect it(setting the attribute) and then plug that into a polySurface.
setMeshDataType.jpg 

What I want to do is manually set the mesh datatype attribute manually.

When using 
Code:
cmds.setAttr(OS+'.tempMesh', "v", 3, (0, 0, 0), (0, 1, 0), (0, 0, 1), "e", 3, 0, 1, "hard", 0, 2, "hard", 1, 2, "hard", type='mesh' )
I get no errors but also no geometry shows up and adding the 'vn' I get the error. I am thinking that There is still something goofy with the formatting that is not working.

In the end I am using a pyExpression node to read a file from a server and using the data in said file to load in a small mesh dynamically. 

0
FruehBird

First taste
Registered:
Posts: 11
Reply with quote  #11 
Running the mel version also gives no mesh.
Code:
setAttr polySurfaceShape1.inMesh -type mesh 

"v" 3 0 0 0 0 1 0 0 0 1
"vn" 3 1 0 0 1 0 0 1 0 0
"vt" 3 0 0 0 1 1 0
"e" 3 0 1 "hard" 1 2 "hard" 2 0 "hard";


However the nurbsCurve works as expected on a curve.create input
Code:
setAttr node.curveAttr -type nurbsCurve 3 1 0 no 3
6 0 0 0 1 1 1
4 -2 3 0 -2 1 0 -2 -1 0 -2 -3 0;

Maybe the mesh data type is flawed? 
0
pshipkov

SOuP Jedi
Registered:
Posts: 4,639
Reply with quote  #12 
Maybe it is flawed, or maybe there is some obscure syntax needed, i never used it that way anyway.
I always used empty mesh nodes and stored data inside them instead of creating dynamic mesh attributes.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation: