# Get Indices From Rampattribute

**URL:** https://forum.highend3d.com/t/get-indices-from-rampattribute/1819
**Category:** Maya
**Tags:** mel
**Created:** [December 5, 2007, 10:22am UTC](https://forum.highend3d.com/t/get-indices-from-rampattribute/1819 "2007-12-05T10:22:49Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![flaiver](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/f/eb9ed0/32.png) [@flaiver](https://forum.highend3d.com/u/flaiver)
#### Post date: [December 5, 2007, 10:22am UTC](https://forum.highend3d.com/t/get-indices-from-rampattribute/1819/1 "2007-12-05T10:22:49Z")

</div>

Hello

I've a basic question, but unfortunately I can't find any help in the docs or in the web, probably I use the wrong key words. I've a rampAttribute, which has 5 indices (0,1,2,3,4). Then I delete manualy the indices (0,2,3), so that only the indices 1 and 4 left.

Now, I'm looking for a mel command, which returns theses indices (1 and 4). In the APi this would be getExistingArrayAttributeIndices but of course I prefere a Mel solution.

Thanks in advance

flaiver

---

<div class="post-metadata">

### Author: ![tjgalda](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/t/ecd19e/32.png) [@tjgalda](https://forum.highend3d.com/u/tjgalda)
#### Post date: [January 5, 2008, 12:44am UTC](https://forum.highend3d.com/t/get-indices-from-rampattribute/1819/2 "2008-01-05T00:44:03Z")

</div>

Hey,

Here you go:

string $tj\_rampNode = "myRampName";  
int $entries = `getAttr -size ($tj\_rampNode+".colorEntryList")`;

By the way, there are a few tutorials I've posted regarding using ramps for various things. Hope they help. ![]()

---

<div class="post-metadata">

### Author: ![tjgalda](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/t/ecd19e/32.png) [@tjgalda](https://forum.highend3d.com/u/tjgalda)
#### Post date: [January 5, 2008, 12:48am UTC](https://forum.highend3d.com/t/get-indices-from-rampattribute/1819/3 "2008-01-05T00:48:44Z")

</div>

oops, missed the line you actually wanted!

listAttr -m ($tj\_rampNode+".colorEntryList");

That will return a list back with the information you need. The $entries (below) will tell you how many you have.

QUOTE(tjgalda @ 01/04/08, 04:44 PM) [snapback]279206[/snapback]  
Hey,

Here you go:

string $tj\_rampNode = "myRampName";  
int $entries = `getAttr -size ($tj\_rampNode+".colorEntryList")`;  
By the way, there are a few tutorials I've posted regarding using ramps for various things. Hope they help. ![]()
