Difference between pages "Color to RGB" and "ConvertStrToVector MEL"

From scripting
(Difference between pages)
Jump to: navigation, search
(Created page with " Function Color_to_RGB(Color As Long) As Variant Dim CurRGB() As Integer ReDim CurRGB(2) CurRGB(0) = Color Mod 256 CurRGB(1) = (Color \ 256) Mod 256 CurRGB(2) = (Co...")
 
(Created page with " global proc vector ConvertStrToVector(string $CurStr) { //0001D LLC 2015 Nick Pisca //string $CurStr = "234.32,332.043"; string $DestUVs[]; $numTokens = `tokenize $Cu...")
 
Line 1: Line 1:
  Function Color_to_RGB(Color As Long) As Variant
+
  global proc vector ConvertStrToVector(string $CurStr) {
Dim CurRGB() As Integer
+
//0001D LLC 2015 Nick Pisca
ReDim CurRGB(2)
+
//string $CurStr = "234.32,332.043";
  CurRGB(0) = Color Mod 256
+
string $DestUVs[];
  CurRGB(1) = (Color \ 256) Mod 256
+
$numTokens = `tokenize $CurStr "," $DestUVs`;
  CurRGB(2) = (Color \ 256 \ 256) Mod 256
+
vector $TempVec = <<float($DestUVs[0]),float($DestUVs[1]),0.0>>;
Color_to_RGB = CurRGB
+
return $TempVec;
  End Function
+
  }
  
  
  
[[Category:CATIA DP VB]]
+
''More information on vectors and arrays, read pages 12-16 in [http://stores.lulu.com/nickpisca YSYT]. 
 +
[[Category:MEL]]

Latest revision as of 05:16, 22 April 2017

global proc vector ConvertStrToVector(string $CurStr) {
	//0001D LLC 2015 Nick Pisca
	//string $CurStr = "234.32,332.043";
	string $DestUVs[];
	$numTokens = `tokenize $CurStr "," $DestUVs`;
	vector $TempVec = <<float($DestUVs[0]),float($DestUVs[1]),0.0>>;
	return $TempVec;
}


More information on vectors and arrays, read pages 12-16 in YSYT.