Forum Replies Created
-
AuthorPosts
-
AlexBlocked
Hello all,
I’m sorry I’ve completely forgot to answer here
This is the solution that have been given to me :visuNode = model.createChild('visualization') visuNode.createObject('CylinderGridTopology', name='topology', radius=radius, length='25', drawQuads='0', n='3 3 25', axis='1 0 0') visuNode.createObject('MechanicalObject', name='test') visuNode.createObject('AdaptiveBeamMapping', interpolation="@../interpolation", input="@../frame1", output="@test") oglNode = visuNode.createChild('ogl') oglNode.createObject('OglModel', color='0.2 0.2 0.2 1') oglNode.createObject('IdentityMapping')
EDIT : Just noticed that this solution isn’t what I was asking for in my first post, maybe I should have not hit the ‘solved’ button ?
Thanks again!
Regards,
AlexAlexBlockedHello @Hugo
It’s getting closer but still not good, maybe is there something wrong with the way I’ve created my beam ?
Result :
The beam :model = solverNode.createChild('model') model.createObject('MeshSTLLoader', name='surface', filename='mesh/#.stl') model.createObject('Mesh', name="meshBeam", position=#, lines=#) model.createObject('MechanicalObject', template='Rigid3d', name='frame1', position=#, printLog=0, translation="0 0 0") model.createObject('BeamInterpolation', dofsAndBeamsAligned='1', straight='1', defaultYoungModulus="1.8e18", radius=radius, name="interpolation") model.createObject('AdaptiveBeamForceFieldAndMass', name="BeamForceField", computeMass="1", massDensity="0.0001") model.createObject('PartialFixedConstraint', indices='0', fixedDirections="1 1 1 1 1 1") model.createObject('BoxROI', name='ROI1', box='5 10 2 -2 -2 2', drawBoxes='true')
Regards,
AlexBlockedAlexBlockedHello @Hugo ,
I’ve managed to create the model I wanted, thanks for the help.
Out of curiosity, as you said the beam is oriented along the x axis and i’ve noticed that they are aiming at the origin of the beam, is it possible to change that parameter ?
I guess using the beam ‘backward’ (base of the beam as the end) would work but i’m not sure that this is very cleanThanks
AlexBlockedHello @Hugo
I am using the cable actuator at the moment and yes it works when I want to bend the beam but I got a problem with the ‘rotation’ properties of the beam
I would like to rotate that beam on itself around one axis (X), when I try to do it with code, it does not work but when I tweak around the value inside SOFA GUI it works (under ‘rotation’ of the mechanical object). This is how I try to change the ‘rotation’ value with python :self.beam = node.getChild("model").getObject("frame1") self.beam.findData('rotation').value[0][0] = self.beam.findData('rotation').value[0][0] + 1.0
‘frame1’ being the MechanicalObject
I guess there is something wrong with the way I set the new value or maybe a scope issue ?Thanks
-
AuthorPosts