Abstract— This paper describes a virtual reality based Programming by Demonstration system for grasp recognition in manipulation tasks and robot pregrasp planning. The system classifies the human hand postures taking advantage of virtual grasping and information about the contact points and normals computed in the virtual reality environment. A pregrasp planning algorithm mimicking the human hand motion is also proposed. Reconstruction of human hand trajectories, approaching the objects in the environment, is based on NURBS curves and a data smoothing algorithm. Some experiments involving grasp classification and pregrasp planning, while avoiding obstacles in the workspace, show the viability and effectiveness of the approach.