COFFEE does not recognize my element id

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 28/07/2007 at 12:56, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R10 
Platform:      
Language(s) :   C.O.F.F.E.E  ;  C++  ;

---------
Hi,
I have a string element in my SDK ObjectData plugin which I set with:

  
data->SetString(AIMAP_STRING, "string data");  

but my coffee script does not recognize AIMAP_STRING:

  
var str = obj#AIMAP_STRING;  

Is it possible to access this element with coffee?
what do I need to do?

thanks

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 28/07/2007 at 14:33, xxxxxxxx wrote:

Maybe try:

var data = obj->GetData();
var str = data->GetString(AIMAP_STRING); //(or maybe obj#AIMAP_STRING).

I don't use COFFEE often enough to give a definitive answer on that part.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 28/07/2007 at 15:07, xxxxxxxx wrote:

this should work.

main(doc, op)
{
doc = GetActiveDocument();
op = doc->FindObject("MyObject");

var str = op#AIMAP_STRING;
println(str);
}

hope I did not make a typo!

frank

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 28/07/2007 at 19:30, xxxxxxxx wrote:

no luck both cause an exception.
on this code as early as var data = cobj->GetData();
😞

  
try{  
          var data = cobj->GetData();  
          if(data) {  
               println("data ok");  
          }  
          var str = data->GetString(AIMAP_STRING);  
          if(str) {  
               file->WriteString(str);  
          } else {  
               println("empty string");  
          }  
          println("aimap data found");  
     }  
       
  
     catch(ExLastException){  
          println("aimap data not found");  
     }  

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 29/07/2007 at 10:07, xxxxxxxx wrote:

This worked well 🙂

  
var AIMAP_STRING = 10001; // container id in SDK  
var bc = cobj->GetContainer();  
var str = bc->GetData(AIMAP_STRING);  

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 29/07/2007 at 11:48, xxxxxxxx wrote:

I think the problem is that your plugin ids are private - not general resources from c4d_symbols.h - which is how it's suppose to be. But that means that a COFFEE script won't have any idea what your plugin id enums are. So you'll probably have to do what you did or #include the resource header in the COFFEE script.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 30/07/2007 at 05:12, xxxxxxxx wrote:

It seems there is a problem with the COFFEE symbol cache. What happens if you delete the "coffeesymbolchache" from the prefs folder? It should read your custom ID names then.

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 31/07/2007 at 09:02, xxxxxxxx wrote:

thanks so much both solutions worked, just that the header file solution needs modification e.g remove C++ compiler directives which coffee does not understand.

but the real solution was to clear the coffeesymbolchache. 🙂
coffeesymbolchache does not seem to be present on R9 so in that case the header should work.