Coder Social home page Coder Social logo

chrono-website's People

Contributors

armanpazouki avatar benatti1991 avatar conlain-k avatar dannegrut avatar hmazhar avatar rserban avatar shlok191 avatar tasora avatar thepianoboy avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

kevin51jiang

chrono-website's Issues

SetPos() does not work correctly with ChBodyEasyCascade() type bodies

I am running a piece of code in which I want to manually move an OCC object, and check if it collides with another object.
The function SetPos() works correctly if I move around a box, but it does not work if I move the OCC object.

See code below: (the # at bottom can be used to switch between OCC and Box):

`

Generate a milling tool from primitives

from OCC.Core.BRepPrimAPI import *
from OCC.Core.BRepAlgoAPI import *
sphere = BRepPrimAPI_MakeSphere(2.0).Shape()
cylinder = BRepPrimAPI_MakeCylinder(1.5, 20.0).Shape()
tool = [BRepAlgoAPI_Fuse(sphere, cylinder).Shape()]

Setup Collision Simulator

from pychrono.core import *
ChCollisionModel.SetDefaultSuggestedEnvelope(0.001);
ChCollisionModel.SetDefaultSuggestedMargin(0.001);

Create default collision material

material = ChMaterialSurfaceNSC()

Specify bodies with proper center of mass and inertia tensor

from pychrono.cascade import *
tolerance = ChCascadeTriangulateTolerances(0.1 ,True,0.5)
bodyTool = ChBodyEasyCascade(tool[0], 1, tolerance, True, material)

Add bodies to physics system

system = ChSystemNSC()
system.Add(bodyTool)

floor = ChBodyEasyBox(10, 10, 2.0, 1, True, True, material)
system.Add(floor)
MakeSphere(2.0).Shape()
cylinder = BRepPrimAPI_MakeCylinder(1.5, 20.0).Shape()
tool = [BRepAlgoAPI_Fuse(sphere, cylinder).Shape()]

Compute collision state

system.ComputeCollisions()
print("Collisions: " + str(system.GetNcontacts()))

bodyTool.SetPos(ChVectorD(0,0,10)) <- DOES NOT WORK
#floor.SetPos(ChVectorD(0,0,-10)) <- WORKS!
system.ComputeCollisions()
print("Collisions: " + str(system.GetNcontacts()))
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.