Home › Forum › SOFA › Using SOFA › [SOLVED] Error with global bounding box
- This topic has 11 replies, 3 voices, and was last updated 6 years, 5 months ago by ElDiwiny.
-
AuthorPosts
-
29 March 2018 at 11:55 #10735quentinBlocked
Hello everyone,
I’m trying to load a microscopic part in Sofa and I get this error :
[ERROR] [RealGUI] Global Bounding Box seems invalid ; please implement updateBBox in your components or force a value by adding the parameter bbox="minX minY minZ maxX maxY maxZ" in your root node
My first problem is that I don’t understand what is the Global Bounding Box and I have not found it in the doxygen.
My second problem is the way to solve it, add something likerootNode.createObject('GlobalBoudingBox' ...)
?Thank for your help,
Quentin
29 March 2018 at 12:10 #10736HugoKeymasterHi Quentin
The BoundingBox is a box covering the volume of all objects. In other words, the bounding box in a scene should therefore contain all objects.
If you have already a Mechanical Object in your scene, add the option “showObject”. This will force the computation of the BoundingBox (which is usually done by specific class/functions).
Let me know if this helps.
Cheers,Hugo
29 March 2018 at 14:20 #10738quentinBlockedThanks for the answer, I just added
accordion.createObject('MechanicalObject', name='tetras', template='Vec3d', showObject="1")
and it changed nothingI think I have a problem with the loader and there is no object so the box isn’t defined.
29 March 2018 at 14:56 #10739HugoKeymasterhmm ok it’s not the problem I imagined then.
Test to add this option in the root node : bbox=”0 0 0 1 1 1″11 May 2018 at 17:34 #11023ElDiwinyBlockedHi Hugo,
I am still stumbling how I can add the bbox=”0 0 0 1 1 1″ in the rootnode, could you please elaborate more in a written example?
Thanks!
14 May 2018 at 09:12 #11024HugoKeymasterHi Marwa,
Could you provide us your scene file? I suspect an issue in it.
Thanks !
15 May 2018 at 14:19 #11050HugoKeymasterHi @meldiwiny,
could you please post your file? I am sure we will find shortly the solution.
Best,
Hugo15 May 2018 at 14:28 #11051ElDiwinyBlockedHi Hugo,
I am sorry for late update, really thanks so much for your help and support. Kindly here is the file in this sharable link https://drive.google.com/open?id=1mSSSYxjnsyQDO6-ZEihCA5KLNIZL5aB0.
Thanks,
Marwa
15 May 2018 at 14:32 #11052HugoKeymasterThx Marwa, I copy paste here:
import Sofa from math import sin,cos #path = os.path.dirname(os.path.abspath(__file__))+'/' #One of the problem is the dimensions ############################## stiffness Test ############################################# def createScene(rootNode): rootNode.createObject('RequiredPlugin', name='SoftRobots') rootNode.createObject('RequiredPlugin', name='BeamAdapter') rootNode.createObject('RequiredPlugin', name='SofaPython') rootNode.createObject('VisualStyle', displayFlags='showVisualModels showBehaviorModels showCollisionModels hideBoundingCollisionModels showForceFields showInteractionForceFields hideWireframe' bbox='0 0 0 1 1 1') rootNode.findData('dt').value= 0.01 rootNode.findData('gravity').value= '0 9.8 0' rootNode.createObject('BackgroundSetting', color='0 0.168627 0.211765') rootNode.createObject('OglSceneFrame', style="Arrows", alignment="TopRight") rootNode.createObject('PythonScriptController', classname="controller", filename="test2.py") smawormNode = rootNode.createChild('SMAWorm') smawormNode.createObject('EulerImplicit') smawormNode.createObject('SparseLDLSolver') length = 10.716 nbEdges =10 edgesList = "" for i in range(0,nbEdges): edgesList += str(i)+ " " + str(i+1) + " " positionsList = "" for i in range(0,nbEdges+1): dx = length/(nbEdges+1) positionsList += str(dx*i)+ " 0 0 0 0 0 1 " smawormNode.createObject('Mesh', edges=edgesList) smawormNode.createObject('MechanicalObject', template='Rigid', position=positionsList, name='Frame') smawormNode.createObject('BeamInterpolation') smawormNode.createObject('RestShapeSpringsForceField', name="MeasurementFF", points="0" , stiffness="100000e100", recompute_indices="1", angularStiffness="100000e100" , drawSpring="1" , springColor="1 0 0 1") ################################## It doesnot make a big change in the system as it is dielectric layer and there is no big change in the displacement behavior, the displacement still in the same range speNode = smawormNode.createChild('SPE') speNode.createObject('Mesh', edges=edgesList) speNode.createObject('BeamInterpolation', name='Interpol', crossSectionShape='rectangular', lengthY='2.167', lengthZ='0.2', defaultYoungModulus='0.8e6') #### the change of SPE layer young Modulus it doesnot make a difference as it is dielectric material. speNode.createObject('AdaptiveBeamForceFieldAndMass', name="BeamForceField", computeMass="1", massDensity="0.0016") DOF0TransformNode = "" for i in range(0,nbEdges+1): DOF0TransformNode += " 0 0 0.1 0 0 0 1 " cp_upNode = smawormNode.createChild('CP_up') cp_upNode.createObject('Mesh', edges=edgesList) cp_upNode.createObject('BeamInterpolation', name='Interpol', crossSectionShape='rectangular', lengthY='2.167', lengthZ='0.025', defaultYoungModulus='0.1e9', dofsAndBeamsAligned='0', DOF0TransformNode0=DOF0TransformNode, DOF1TransformNode1=DOF0TransformNode) cp_upNode.createObject('AdaptiveBeamForceFieldAndMass', name="BeamForceField", computeMass="1", massDensity="0.0016") DOF0TransformNode = "" for i in range(0,nbEdges+1): DOF0TransformNode += " 0 0 -0.1 0 0 0 1 " cp_downNode=smawormNode.createChild('CP_down') cp_downNode.createObject('Mesh', edges=edgesList) cp_downNode.createObject('BeamInterpolation', name='Interpol', crossSectionShape='rectangular', lengthY='2.167', lengthZ='0.025', defaultYoungModulus='0.1e9', dofsAndBeamsAligned='0', DOF0TransformNode0=DOF0TransformNode, DOF1TransformNode1=DOF0TransformNode) cp_downNode.createObject('AdaptiveBeamForceFieldAndMass', name="BeamForceField", computeMass="1", massDensity="0.0016") #Mapping Point= smawormNode.createChild('SMAPoint') Point.createObject('MechanicalObject', position='5.2 0 0', name='location') Point.createObject('ConstantForceField',name='SMAForce', points= "0", forces='0 0 800', arrowSizeCoef="0.001") Point.createObject('AdaptiveBeamMapping', name="222000000") visuNode = smawormNode.createChild('visualization') visuNode.createObject('RegularGridTopology', name='topology', n="10 4 2" , min="0 -0.3 -0.05", max="10.716 0.5 0.05") visuNode.createObject('MechanicalObject', name='test', src='@topology') visuNode.createObject('AdaptiveBeamMapping', interpolation="@../SPE/Interpol", input="@../Frame", output="@test") oglNode = visuNode.createChild('ogl') oglNode.createObject('OglModel', name='visualModel', color='0 1 0 1') oglNode.createObject('IdentityMapping') visuNode2 = smawormNode.createChild('visualization2') visuNode2.createObject('RegularGridTopology', name='topology', n="10 4 2" , min="0 -0.3 -0.05", max="10.716 0.5 0.05") visuNode2.createObject('MechanicalObject', name='test', src='@topology') visuNode2.createObject('AdaptiveBeamMapping', interpolation="@../CP_up/Interpol", input="@../Frame", output="@test") oglNode2 = visuNode2.createChild('ogl') oglNode2.createObject('OglModel', name='visualModel', color='1 0 0 1') oglNode2.createObject('IdentityMapping') visuNode3 = smawormNode.createChild('visualization3') visuNode3.createObject('RegularGridTopology', name='topology', n="10 4 2" , min="0 -0.3 -0.05", max="10.716 0.5 0.05") visuNode3.createObject('MechanicalObject', name='test', src='@topology') visuNode3.createObject('AdaptiveBeamMapping', interpolation="@../CP_down/Interpol", input="@../Frame", output="@test") oglNode3 = visuNode3.createChild('ogl') oglNode3.createObject('OglModel', name='visualModel', color='1 0 0 1') oglNode3.createObject('IdentityMapping')
15 May 2018 at 14:40 #11053HugoKeymasterHi @meldiwiny
Since the PR#524 (also in the v17.12 release), a warning is sent when the BBox is invalid.
In such a case, make sure that the BBox is well computed in your scene:
- by adding a OglModel for the visualization if you have one
- by adding the option showObject=”1″ to your MechanicalObject
- or specifying directly in one of your nodes the bbox=”0 0 0 1 1 1″ for instance
Moreover, make sure that your scn.view file (same location as the scene) also has correct values. You might have saved invalid camera settings breaking the visualization.
In your case, there is a typography in you code, a missing commar before bbox:
rootNode.createObject('VisualStyle', displayFlags='showVisualModels showBehaviorModels showCollisionModels hideBoundingCollisionModels showForceFields showInteractionForceFields hideWireframe', bbox='0 0 0 1 1 1')
the bbox is therefore not taken into account.
Let me know if this is correct.Best,
Hugo
18 May 2018 at 10:40 #11059HugoKeymaster23 May 2018 at 16:00 #11077ElDiwinyBlockedHi Hugo,
So sorry for my late reply!. Perfect, finally it works.
Thank,
Marwa -
AuthorPosts
- You must be logged in to reply to this topic.