GraphicPicker and surface normal
Hi!
I'm using GraphicPicker class on some of my RS AddIns and I was just wondering what is the easiest way to get the surface normal vector form the picked position? GraphicPickEventArgs doesn't seem to contain that information so currently I'm using ProjectRay on the selected position to get a ProjectObject. Then I cast PO to either Face or Part type and the I use GetNormalToSurface and TryGetNormalToSurface methods which give me the normal vector. It works somehow but I would like to know if there's a better way.
-Keijo
Comments
-
Hi Keke,
Your approach seems right but I'm not sure why you would need to call ProjectRay(), since GraphicPickEventArgs contains the picked object.
Regards,
Johannes
Johannes Weiman
Software Engineer
RobotStudio Team, ABB Robotics0 -
You are right, but I usually want to reset selection mode and in that case GraphicPickEventArgs.PickedObject is null. ProjectRay gives me the object regardless of the selection mode.
The reason why I want to usually reset selection mode is that when picking positions I don't really want to select bodies or parts (I don't want to change the color). Also if I have Group selection on and there are hidden parts in the group, those become visible when group is under the cursor. Same with Part selection and hidden bodies. This is very annoying when trying to pick positions inside some enclosure whose walls are hidden. These are of course small issues but devil is in the details
-Keijo
1
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 800 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings