-
Notifications
You must be signed in to change notification settings - Fork 26
[Scenes] Add an example of a hexaBeam scene under the gravity force #121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rmolazem
wants to merge
8
commits into
SofaDefrost:master
Choose a base branch
from
InfinyTech3D:hexaBeam_originalScene
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b97aed8
Add an example of a hexaBeam scene under the gravity force.
rmolazem 24dbd86
Apply the suggestion.
rmolazem 2dcbc91
Change the animation loop.
rmolazem b80abf8
Somthing was wrong by using the CG solver for this scene.
rmolazem b3d73f6
Rename files.
rmolazem 6ee9961
Add results.
rmolazem 40e35db
Remove files of listActiveNodes.
rmolazem 7f6fbd3
Remove Gie files.
rmolazem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # -*- coding: utf-8 -*- | ||
| import os | ||
| import Sofa | ||
|
|
||
| plugins=["SofaPython3","SoftRobots","ModelOrderReduction","STLIB", | ||
|
|
||
| "Sofa.Component.Visual", | ||
| "Sofa.Component.AnimationLoop", | ||
| "Sofa.GL.Component.Rendering3D", | ||
| "Sofa.Component.Constraint.Lagrangian.Solver", | ||
| 'Sofa.Component.IO.Mesh', | ||
| 'Sofa.Component.Playback', | ||
| 'Sofa.Component.Constraint.Lagrangian.Correction', # Needed to use components [GenericConstraintCorrection] | ||
| 'Sofa.Component.Engine.Select', # Needed to use components [BoxROI] | ||
| 'Sofa.Component.LinearSolver.Direct', # Needed to use components [SparseLDLSolver] | ||
| 'Sofa.Component.Mapping.Linear', # Needed to use components [BarycentricMapping] | ||
| 'Sofa.Component.Mass', # Needed to use components [UniformMass] | ||
| 'Sofa.Component.ODESolver.Backward', # Needed to use components [EulerImplicitSolver] | ||
| 'Sofa.Component.SolidMechanics.FEM.Elastic', # Needed to use components [TetrahedronFEMForceField] | ||
| 'Sofa.Component.SolidMechanics.Spring', # Needed to use components [RestShapeSpringsForceField] | ||
| 'Sofa.Component.StateContainer', # Needed to use components [MechanicalObject] | ||
| 'Sofa.Component.Topology.Container.Dynamic', # Needed to use components [TetrahedronSetTopologyContainer] | ||
| 'Sofa.Component.Constraint.Projective', # Needed to use components [FixedProjectiveConstraint] | ||
| 'Sofa.Component.Topology.Container.Grid'] # Needed to use components [RegularGridTopology] | ||
|
|
||
|
|
||
|
|
||
| def createScene(rootNode): | ||
|
|
||
| rootNode.findData('dt').value=0.02 | ||
| rootNode.findData('gravity').value=[0, -9810, 0] | ||
| rootNode.addObject('VisualStyle', displayFlags='showBehaviorModels showForceFields') | ||
| rootNode.addObject('RequiredPlugin', pluginName=plugins, printLog=False) | ||
| rootNode.addObject('FreeMotionAnimationLoop') | ||
| rootNode.addObject('GenericConstraintSolver', tolerance="1e-12", maxIterations="10000") | ||
|
|
||
|
|
||
| M1 = rootNode.addChild("M1") | ||
| M1.addObject('EulerImplicitSolver',rayleighStiffness="0.1", rayleighMass="0.1") | ||
| M1.addObject('SparseLDLSolver',name='preconditioner') | ||
alxbilger marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| M1.addObject('MechanicalObject', name='MO') | ||
| M1.addObject('UniformMass', totalMass="0.1") | ||
| M1.addObject('RegularGridTopology', nx="4", ny="4", nz="20", xmin="-9", xmax="-6", ymin="0", ymax="3", zmin="0", zmax="19") | ||
| M1.addObject('BoxROI', name='ROI1', box='-9 -2 -1 -3 4 5', drawBoxes='true') | ||
|
|
||
| M1.addObject('HexahedronFEMForceField', name="FEM", youngModulus="4000", poissonRatio="0.3", method="large") | ||
| M1.addObject('RestShapeSpringsForceField', points='@ROI1.indices', stiffness = '1e8') | ||
| M1.addObject('GenericConstraintCorrection', linearSolver='@preconditioner') | ||
|
|
||
| # Add a visual model | ||
| visualModel = M1.addChild('visualModel') | ||
| visualModel.addObject('OglModel', name="visu", color="green") | ||
| visualModel.addObject('IdentityMapping', input="@..", output="@visu") | ||
|
|
||
| actuator = rootNode.addChild('actuator') | ||
| actuator.addObject('MechanicalObject', name="actuatedState", template="Vec3d", position="@M1/MO.position") | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.