# Put referenced node into a group in .ma file code

**URL:** https://forum.highend3d.com/t/put-referenced-node-into-a-group-in-ma-file-code/629
**Category:** Maya
**Tags:** mel
**Created:** [November 3, 2010, 1:08pm UTC](https://forum.highend3d.com/t/put-referenced-node-into-a-group-in-ma-file-code/629 "2010-11-03T13:08:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![highend3djojan-](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/h/c68b51/32.png) [@highend3djojan-](https://forum.highend3d.com/u/highend3djojan-)
#### Post date: [November 3, 2010, 1:08pm UTC](https://forum.highend3d.com/t/put-referenced-node-into-a-group-in-ma-file-code/629/1 "2010-11-03T13:08:00Z")

</div>

How can v put a referenced node into a new group in a .ma file?  
For e.g; see my .ma file:

//Maya ASCII 2009 scene  
file -r -ns "sfr" -dr 1 -rfn "sfrRN" "\\ibm-118/Work Area/char/sfr.ma";  
requires maya "2009";  
select -ado;  
group -n "CHARACTERS"; xform -os -piv 0 0 0;

sfr.ma contains just a sphere, say sfr1.  
I need to put it inside a group named "CHARACTERS".  
I am not running this by opening the scene in Maya - I need to write it in that .ma file itself.  
But the above code wont work.  
Any way to do this..? Plz help.

---

<div class="post-metadata">

### Author: ![joojaa](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@joojaa](https://forum.highend3d.com/u/joojaa)
#### Post date: [November 3, 2010, 7:04pm UTC](https://forum.highend3d.com/t/put-referenced-node-into-a-group-in-ma-file-code/629/2 "2010-11-03T19:04:25Z")

</div>

maya ascii files are NOT MEL theres no such thing as group and xform in a maya ascii file. You must contend yourself with using following subset of commands:

file  
requires  
currentUnit   
fileInfo  
createNode  
setAttr  
select  
connectAttr   
lockNode

which is basically all you will ever need. Since a group is just basically the same thing as:

createNode transform -n "CHARACTERS";

you should use that. But your file is actually far more complicated than that. your file would look something like (didnt test very thoroughly):

```auto
//Maya ASCII 2009 scene
//Codeset: 1252
file -rdi 1 -ns "sfr" -rfn "sfrRN" "//ibm-118/Work Area/char/sfr.ma";
file -r -ns "sfr" -dr 1 -rfn "sfrRN" "//ibm-118/Work Area/char/sfr.ma";
requires maya "2009";
currentUnit -l centimeter -a degree -t pal;
fileInfo "application" "maya";
 
createNode transform -n "CHARACTERS" ;
createNode reference -n "sfrRN";
  lockNode -l 1 ;
connectAttr "sfrRN.msg" "CHARACTERS.ihi";
```

Tough you may want to actiually ad the default cameras or your order will be wonky So your scene should look like:

```auto
//Maya ASCII 2009 scene
//Codeset: 1252
file -rdi 1 -ns "sfr" -rfn "sfrRN" "//ibm-118/Work Area/char/sfr.ma";
file -r -ns "sfr" -dr 1 -rfn "sfrRN" "//ibm-118/Work Area/char/sfr.ma";
requires maya "2009";
currentUnit -l centimeter -a degree -t pal;
fileInfo "application" "maya";
createNode transform -s -n "persp";
	setAttr ".v" no;
	setAttr ".t" -type "double3" 28 21 28 ;
	setAttr ".r" -type "double3" -27.938352729602379 44.999999999999972 -5.172681101354183e-014 ;
createNode camera -s -n "perspShape" -p "persp";
	setAttr -k off ".v" no;
	setAttr ".fl" 34.999999999999993;
	setAttr ".coi" 44.82186966202994;
	setAttr ".imn" -type "string" "persp";
	setAttr ".den" -type "string" "persp_depth";
	setAttr ".man" -type "string" "persp_mask";
	setAttr ".hc" -type "string" "viewSet -p %camera";
createNode transform -s -n "top";
	setAttr ".v" no;
	setAttr ".t" -type "double3" 0 100.1 0 ;
	setAttr ".r" -type "double3" -89.999999999999986 0 0 ;
createNode camera -s -n "topShape" -p "top";
	setAttr -k off ".v" no;
	setAttr ".rnd" no;
	setAttr ".coi" 100.1;
	setAttr ".ow" 30;
	setAttr ".imn" -type "string" "top";
	setAttr ".den" -type "string" "top_depth";
	setAttr ".man" -type "string" "top_mask";
	setAttr ".hc" -type "string" "viewSet -t %camera";
	setAttr ".o" yes;
createNode transform -s -n "front";
	setAttr ".v" no;
	setAttr ".t" -type "double3" 0 0 100.1 ;
createNode camera -s -n "frontShape" -p "front";
	setAttr -k off ".v" no;
	setAttr ".rnd" no;
	setAttr ".coi" 100.1;
	setAttr ".ow" 30;
	setAttr ".imn" -type "string" "front";
	setAttr ".den" -type "string" "front_depth";
	setAttr ".man" -type "string" "front_mask";
	setAttr ".hc" -type "string" "viewSet -f %camera";
	setAttr ".o" yes;
createNode transform -s -n "side";
	setAttr ".v" no;
	setAttr ".t" -type "double3" 100.1 0 0 ;
	setAttr ".r" -type "double3" 0 89.999999999999986 0 ;
createNode camera -s -n "sideShape" -p "side";
	setAttr -k off ".v" no;
	setAttr ".rnd" no;
	setAttr ".coi" 100.1;
	setAttr ".ow" 30;
	setAttr ".imn" -type "string" "side";
	setAttr ".den" -type "string" "side_depth";
	setAttr ".man" -type "string" "side_mask";
	setAttr ".hc" -type "string" "viewSet -s %camera";
	setAttr ".o" yes;
createNode transform -n "CHARACTERS" ;
createNode reference -n "sfrRN";
  lockNode -l 1 ;
connectAttr "sfrRN.msg" "CHARACTERS.ihi";
```

PS: make sure your application actually writes foles in windows-1252 format

---

<div class="post-metadata">

### Author: ![highend3djojan-](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/h/c68b51/32.png) [@highend3djojan-](https://forum.highend3d.com/u/highend3djojan-)
#### Post date: [November 10, 2010, 1:36pm UTC](https://forum.highend3d.com/t/put-referenced-node-into-a-group-in-ma-file-code/629/3 "2010-11-10T13:36:11Z")

</div>

Thanks Jooja. But one pbm now: What if there are multiple references needs to be grouped under one? For e.g;

//Maya ASCII 2009 scene  
file -r -ns "sfr" -dr 1 -rfn "sfrRN" "//ibm-118/Work Area/char/sfr.ma";  
file -r -ns "box" -dr 1 -rfn "boxRN" "//ibm-118/Work Area/char/box.ma";  
requires maya "2009";

createNode transform -n "CHARACTERS" ;  
createNode reference -n "sfrRN";  
lockNode -l 1 ;  
connectAttr "sfrRN.msg" "CHARACTERS.ihi";  
createNode reference -n "boxRN";  
lockNode -l 1 ;  
connectAttr "boxRN.msg" "CHARACTERS.ihi";

.... This is not a valid .ma file.  
The error shown while open in Maya is:  
'CHARACTERS.isHistoricallyInteresting' already has an incoming connection from 'sfrRN.message'

... ihi attribute is already connected.  
Is there any way to group multiple references under one group?

Thanks.
