Import STL File

Hello,

I want to import a stl file with a calculated center of mass, the moment of inertia and a mass in the AnyBody Posture Prediction model and replace the cube with my stl file.
How do I proceed or are there useful tutorials regarding the topic?

Best regards
Lars

Hi Lars,

I am not sure if we have an appropriate tutorial for your exact objective, but I will try to guide you.

For using stl files, you can look for AnyDrawSurf in the reference manual. Most classes in the reference manual come with an example for the class. This can be helpful. But this class would only talk about importing surfaces and visualizing it.

For your simulation, specifically for the Posture prediction model, you can do the following steps:
• In the main file, you can see the variable called ObjectWeight in Main.InputFolder. Please set this to the weight of your object.
• A couple of lines further, you can see the variables HandPosRight and HandPosLeft. These define the relative position of the hand with respect to the origin of the segment. Please set them accordingly
• The actual segment for the box is defined in Environment.any. It’s called HandSeg. Over here, you can set the Jii matrix for the moment of inertia. You can also make links to the variables defined in the input parameters folder (like it has been done for the mass). The moment of inertia is, by default, defined about the origin of the segment but you can set it to be defined about the center of mass by setting inside the segment: JaboutCoMOnOff = On;
• Lastly, for the center of mass, AnySeg has a property called sCoM that is the relative position of the center of mass. You can set this inside the scope of AnySeg HandSeg (you can also make links to a vector that you define in input parameters). Alternatively, since it’s not predefined in the script, you can simply define it inside your inputparameters by writing: Main.Model.Environment.HandSeg.sCoM = {x,y,z}; where x,y,z are the relative coordinates of the center of mass.
• For the visualization of your stl, you can double click on the box in the model view. This will open the location in the model tree where this draw object has been defined. From there, you can right-click and locate in AnyScript. It will bring you back to the HandSeg definition. And if you notice, the drawing object is defined under the BoxMidpoint reference node. This will be the origin for the drawing object and should coincide with origin of your stl file.. you can of course, make another reference node inside the segment that should be the origin for the stl file. Or you can just define the drawing object a level up, directly in the AnySeg (then it will coincide with the origin of the segment).

I hope this helps!

Best regards,
Dave

This topic was automatically closed 125 days after the last reply. New replies are no longer allowed.