Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > CopperCube Open discussion
Need Urgent Help

Zoo
Guest
Quote
2017-11-27 15:39:02

I have a cube mesh which is 10,10,10.

I need to change the height dynamically with the Javascript API for a Business Intelligence solution .

It is a default Cube primitive from coppercube editor

I tried this code but it makes the object vanish

var s = ccbGetSceneNodeFromName("TowerL40");
ccbSetSceneNodeProperty(s, "Scale", 20, 90,10);

@Niko


techno-valley
Registered User
Quote
2017-11-27 16:15:50

Hello Zoo,

I think your code is correct however you need to verify the object name
Please note that you have to use the same name exactly as in the editor tree (case sensitive)

Also, make sure that there is no value is 0 only (typo mistake)


var s = ccbGetSceneNodeFromName("TowerL40");
ccbSetSceneNodeProperty(s, "Scale", 20, 90,10);



Zoo
Guest
Quote
2017-11-27 16:24:18

Worked thank you techno


techno-valley
Registered User
Quote
2017-11-27 21:28:35

always welcome


Zoo
Guest
Quote
2017-11-27 23:27:38

So I have managed to get the application working...

Now I just need to know how the screenshots work on exe target, apparently you can create a screenshot folder?

@techno-valley


techno-valley
Registered User
Quote
2017-11-28 06:58:40

hello,

to save a screenshot from within the exe target, you'll have to use the javascript command ccbSaveScreenshot(filename) while using Execute JavaScript Action


It saves the current content of the screen to a image file on the disk.

Example (1) : Simple File Save
Let's save a screenshot file named sshot.jpg
so you will have to save as follow



ccbSaveScreenshot ("sshot.jpg");


This will save the screenshot in the same folder as the exe target.

Example (2) : Save to folder C:\path\to\folder on your hard disk

otherwise if you want to save to the target folder /path/to/folder so it will be as follow



ccbSaveScreenshot ("C://path//to//folder//sshot.jpg");


Note that you have to change every slash " / " in the path with a double slash "//"

Example (3) : Save to a folder in the same location as the EXE target and this folder is named Screenshots


ccbSaveScreenshot (".//Screenshots//sshot.jpg");


Where .// indicates the current folder/directory


Zoo
Guest
Quote
2017-11-28 12:50:31

Perfect...

Now I have a new problem...

I have tried \r\n to create a carriage return in the 2D overlay....but it does not work.

It did work before, but I can't remember how I got it working...

I have a wall of data that I need to be fed line by line.

@techno-valley


techno-valley
Registered User
Quote
2017-11-28 13:39:20

can you please specify what is the 2D overlay text source ?
is it extracted from a variable ?


Zoo
Guest
Quote
2017-11-28 13:44:06

yes.

I am pulling data from a database using http object and assigning it to a variable.

I then set the text with change 2d overlay text action which is run ever 500 ms...

The data comes out but all on one line


Zoo
Guest
Quote
2017-11-28 13:45:46

My code

function finishedRequest(dataReceived)
{
//print("finished request! Data size:" + dataReceived);
// var res= new Array();

var str1 = dataReceived;
var res1 = str1.split("---");
var length = res1.length;
//print(length);
var i;
var FinalString = [];
var s = 0;
for(i = 0 ; i < length - 1; i++)
{
//data format from php
//Westgate---L10---0---NA<br>Westgate
var j = i;
var mall = res1[j];
var j = j + 1;
var shop = res1[j];
var j = j + 1;
var TurnoverDensity = res1[j];
var j = j + 1;
var TurnOverDensityGroup = res1[j];
var i = j;
var j = 0 ;

FinalString[s] = mall + " - " + shop + " - " + TurnoverDensity + " - " + TurnOverDensityGroup;
//split next string
//var res2 = TurnOverDensityGroup.split("***");
//var TurnOverDensityGroupFinal = res2[0];
s++;
//print(mall);
//print(shop);
//print(TurnoverDensity);
//print(TurnOverDensityGroup);
//print(TurnOverDensityGroupFinal);
}
m = s - 1;
print(s);
print(m);
var counter = 0;
var Together = "/r/n";
do{

Together = Together + "/r/n" + FinalString[counter];
counter++;

}while(counter < m);

ccbSetCopperCubeVariable("AllData", Together);
//print(Together);

}

ccbDoHTTPRequest("pathtophpserverdata", finishedRequest);


techno-valley
Registered User
Quote
2017-11-28 14:15:51

Did you try to replace /r/n to \r\n ?
lines: 49 and 52


Zoo
Guest
Quote
2017-11-28 14:17:49

Hi there @techno-valley...

Thanks for all your help. I managed to resolve this on my own.

Instead of using the Coppercube behavior to update the text from a variable.

I added this line of code to the bottom of my script and it worked perfectly

var s = ccbGetSceneNodeFromName('Leaderboard');
ccbSetSceneNodeProperty(this.LastOverlayObject, 'Draw Text', true);
ccbSetSceneNodeProperty(s, 'Text', OrderedScore);


@Niko should consider updating the behaviour so that it works without having to write code.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Int?rnational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact