Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

(ISSUE) SetVisible can hide but not show robot from API

// Visibility
public void HideVisuals() => _robot.SetVisible(false);
public void ShowVisuals() => _robot.SetVisible(true);

Using the C# code above, I can hide a robot (IItem) by setting its visibility to false, but when I set the visibility to true only the tool frame reappears. I tried to call RoboDK.Render(true), as well, but that had not effect.

When I toggle visibility in the RoboDK window, it acts as expected. Has anybody else seen this error before?
// My visibility control functions in C#
public void HideVisuals() => _robot.SetVisible(false, 1);    // Show only the tool frame
public void ShowVisuals()    // Show robot but not joint frames
    int jointNum = _robot.Joints().Length;
   int mask = 2;

   for (int i = 0; i < jointNum; i++)
       mask = (mask << 2) + 2;
   mask += 1; // Add mask for tool frame

   _robot.SetVisible(true, mask);            

Through experimentation, I found that you can set the visibility of specific joints in a mechanism. The joints to show are specified by a bit mask as the second argument to the .SetVisible(bool, mask) function. The first bit is always the tool frame, and then the bits alternate between joint visuals and joint frames. 

Note, the frames will not appear visible unless the corresponding joint is visible as well.

Users browsing this thread:
1 Guest(s)