Thanks for your observation but the script help says:
*Note: The variable passed as a parameter must be in quotations. See the example below.
Example: $x = GetArraySize($myArray)
@WBS00001 this is great help! I just spent so much time wrenching my brain on how to get this going, seeing your code just explains why I could not get it done!
Thanks for helping me with all the coding, I would be stuck instantly and the whole project would be on a dead stop!
Did you see that @Anthony from XLRobots.com just posted a thread where he is modeling a virtual robot in 3ds max...it would be kind of cool to integrate this into our project since he is using the same platform for modeling and rigging!
@ptp Hey I just read your explanation on the different communication types available to choose from when talking to servos, really something that I missed out so far...thanks for the links and doing the research on it!
I can export the Virtual JD to the .3ds format, but I doubt that the wiring will still work...the whole idea is to animate in 3ds max and send out the data to ARC, which can be done with HTTP as a live control, or by 3ds max writing the animation to a disk file which will be then processed by ARC!
The .3ds will most likely contain all the objects and the corresponding animation, but will not transport all the information of the parameter wiring and of course not the script which will handle the exchange of the servo rotation to the disk file or to the ARCs HTTP server...
@Anthony
So just in case you paid us a visit I thought I'd repost some of my progress in modeling my robot in 3ds max and the revisions of my servo hinge for the Tower sg90 9g micro servo...I did not want to flood your thread, so if you see this I would be happy to have you on board!
Glad to do it. You're very welcome.
I had to make yet another change to the code I posted. After a much needed good nights sleep, I realized I had left in some debugging code that prevented the last line from being loaded into the array. (Yeah, that's my excuse and I'm sticking to it ) It 's these lines of the code that I removed:
@WBS00001 finally I had the time to test your code...I works like a charm, good to know how to handle this, I would not ever have coded this myself!
I got some error messages so I added some lines of code, now it works for driving the servo from file...
Needles to say that it still runs very choppy as too many different servo positions are being send and no accurate timing is given!
But that is another story, and I am curious how you will tame this beast!
We could also try to clean up the array on the 3ds max side and just store the keyframes to the disk file...or the servo number first, followed by a tandem of keyframes plus the frame number of the keyframe?
Just an idea that came to my mind a while ago...
$HighServoArray =GetArraySize("$ServoDataArray") #Find out how big it is
$NextLine =0 #Now read from the array, character by character
repeatwhile($NextLine <= $HighServoArray)
$NextNum =0
if($NextLine < $HighServoArray) #it gave me an error code over here
Print($ServoDataArray[$NextLine])
$TheNumStr =Split($ServoDataArray[$NextLine],";",$NextNum)
Print($TheNumStr)
else
print("finished")
endif
repeatwhile($TheNumStr != "")
$TheNumStr =Split($ServoDataArray[$NextLine],";",$NextNum)
#Here is where you would do whatever it is you want to do with
#the value just extracted. I'll just print it.
Print($TheNumStr)
if($TheNumStr = "") #and it gave me an error code here if the variable was blank
Print("empty")
else
Servo(D0,$TheNumStr)
Print($TheNumStr)
endif
#I put a sleep here if you want to actually see the numbers as
#they go by.
Sleep(5)
$NextNum++
endrepeatwhile
$NextLine++
endrepeatwhile
endif
So this is a new version of the Virtual JD, it is a 3ds max scene with an animation for testing purposes.
This will let you control your JD with the animation package so you can transfer motion to ARC by a script that @WBS00001 is currently developing!
The new scene has some changes in the naming conventions to make it more suitable for the script which will be reading the rotation values!
@ ptp
Thanks for your observation but the script help says: *Note: The variable passed as a parameter must be in quotations. See the example below. Example: $x = GetArraySize($myArray)
@wbs0001
Wow, learning something new every day...
a string for me is delimited by quotation marks, so i didn't think twice...
it breaks the common pattern, although some languages have an Eval method with some code inside a string.
@WBS00001 this is great help! I just spent so much time wrenching my brain on how to get this going, seeing your code just explains why I could not get it done!
Thanks for helping me with all the coding, I would be stuck instantly and the whole project would be on a dead stop!
Did you see that @Anthony from XLRobots.com just posted a thread where he is modeling a virtual robot in 3ds max...it would be kind of cool to integrate this into our project since he is using the same platform for modeling and rigging!
Johnny-5 Made For 3d Print Ezbv4 Controlled Robot Kit
@ptp Hey I just read your explanation on the different communication types available to choose from when talking to servos, really something that I missed out so far...thanks for the links and doing the research on it!
I can export the Virtual JD to the .3ds format, but I doubt that the wiring will still work...the whole idea is to animate in 3ds max and send out the data to ARC, which can be done with HTTP as a live control, or by 3ds max writing the animation to a disk file which will be then processed by ARC! The .3ds will most likely contain all the objects and the corresponding animation, but will not transport all the information of the parameter wiring and of course not the script which will handle the exchange of the servo rotation to the disk file or to the ARCs HTTP server...
@Anthony So just in case you paid us a visit I thought I'd repost some of my progress in modeling my robot in 3ds max and the revisions of my servo hinge for the Tower sg90 9g micro servo...I did not want to flood your thread, so if you see this I would be happy to have you on board!
@Mickey666Maus
Glad to do it. You're very welcome. I had to make yet another change to the code I posted. After a much needed good nights sleep, I realized I had left in some debugging code that prevented the last line from being loaded into the array. (Yeah, that's my excuse and I'm sticking to it
) It 's these lines of the code that I removed:
@WBS00001 finally I had the time to test your code...I works like a charm, good to know how to handle this, I would not ever have coded this myself!
I got some error messages so I added some lines of code, now it works for driving the servo from file...
Needles to say that it still runs very choppy as too many different servo positions are being send and no accurate timing is given! But that is another story, and I am curious how you will tame this beast!
We could also try to clean up the array on the 3ds max side and just store the keyframes to the disk file...or the servo number first, followed by a tandem of keyframes plus the frame number of the keyframe? Just an idea that came to my mind a while ago...
So this is a new version of the Virtual JD, it is a 3ds max scene with an animation for testing purposes. This will let you control your JD with the animation package so you can transfer motion to ARC by a script that @WBS00001 is currently developing!
The new scene has some changes in the naming conventions to make it more suitable for the script which will be reading the rotation values!
https://we.tl/6Vm37jJ2nF
Any luck with smoothing out the motions?