ScriptSpot is a diverse online community of artists and developers who come together to find and share scripts that empower their creativity with 3ds Max. Our users come from all parts of the world and work in everything from visual effects to gaming, architecture, students or hobbyists.
I've one but I think it's not in the order you want this just joins arrays after each other. Quite simple but it could be of use to someone passing through.
I liked the idea so I tried it but I got an error. The object properties are not as string but still as integer so the dotNet function isn't working...
Here is the code I have:
fn combineArray arr1 arr2 =
(
testArray1 = #()for i = 1 to arr1.count do join testArray1 #(arr1[i],arr2[i])
testArray1
)
fn printer propArr varArr filename: =
(
testArray2 = combineArray propArr varArr
(dotnetclass "System.IO.File").WriteAllLines filename testArray2
)
b = createInstance Box
props = #()
vals = for p in getPropNames b collect
(
append props (p as string)
getProperty b p
)
printer props vals filename:@"c:\temp\test.txt"
b = createInstance Box
props = #()
vals = for p in getPropNames b collect
(
append props (p as string)(getProperty b p) as string
)
printer props vals filename:@"c:\temp\test.txt"
About the "j" variable, It's just easier for me to work with variable like this when I write some code, like that it's easier to modify the expression afterwards if needed, since I have a better visibility of the expression in the code :)
Then when the code is working, I try to get rid off all this kind of useless variable to optimize the code.
Comments
Thanks for the discussion guys,
I've one but I think it's not in the order you want this just joins arrays after each other. Quite simple but it could be of use to someone passing through.
Hi Barigazy I liked the idea
Hi Barigazy
I liked the idea so I tried it but I got an error. The object properties are not as string but still as integer so the dotNet function isn't working...
Here is the code I have:
And here is what I get in the listener:
By the way, my pseudo isn't SugaRi, just SugaR (it wasn't free to use for registering and I didn't changed it afterwards :)
...
You might wonder what purpose has this function.
Well.. for example we can easely print some object props to external file.
Example:
bga
#3 solution by SugaRi
bga
#1 solution
This solution represents longest and slowest version.
bga
#2 solution
Easy way
bga
...
Does anyone have 3rd solution?
bga
Not sure if it's a good or
Not sure if it's a good or fast solution but it works:
...
This solution can works but first thing first:
If you want to prevent changes of arr1 you need to use "deepcopy" fn ei.
Not need to use "j" variable here just
"insertItem" fn is slow for big arrays.
bga
Ok good thing to know about
Ok good thing to know about the copy/deepcopy
About the "j" variable, It's just easier for me to work with variable like this when I write some code, like that it's easier to modify the expression afterwards if needed, since I have a better visibility of the expression in the code :)
Then when the code is working, I try to get rid off all this kind of useless variable to optimize the code.