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

Move Geometry (Apply move through python code?)

#1
Hello,


I'm building this program to make it easier for our operators to use RoboDK.

But I get the following problems.

The object I import has an incorrect orientation so I use (setPoseAbs and setGeometryPose) to change the orientation and position to make it automaticly get the right position. But with the geometry you have to press the "Apply move" button to get changes to the geometry and I want to make it as simple as possible and therefore remove this extra navigation to the "Apply move" button if possible.


So is there some method to apply the move from the python program?

Best regards Martin.K
#2
You can use item.setGeometryPose()
https://robodk.com/doc/en/PythonAPI/robo...ometryPose
#3
(03-08-2022, 07:04 PM)Alex Wrote: You can use item.setGeometryPose()
https://robodk.com/doc/en/PythonAPI/robo...ometryPose

Sorry but i might have been a litle unclear in my sentence.
But I'm using the setGeometryPose()

The problem is that it won't apply the move untill i have pressed the "apply move" button.
Since i have not pressed "apply move" when i simulate the metal coating program it looks like a ghost shape of the object is geting the coating and no coating on the visible object.

But if i press this butten before simulation everything is fine.
But i would like for the operator to not have to navigate to this button every time we are using a new item.
   
   

Best regards Martin.K
#4
This is officially not supported right now using the API but there is a workaround you can do by following these steps:
  1. Open the robolink.py file you'll find here:
    C:/RoboDK/Python/robodk/robolink.py
  2. Search for the setGeometry pose function (around line 4304)
  3. Replace this function by this one to have the optional apply flag:
Code:
   def setGeometryPose(self, pose, apply=False):
       """Set the position (pose) the object geometry with respect to its own reference frame. This can be applied to tools and objects.
       The pose must be a :class:`robomath.Mat`"""
       with self.link._lock:
           self.link._check_connection()
           command = 'S_Hgeo2'
           self.link._send_line(command)
           self.link._send_item(self)
           self.link._send_pose(pose)
           self.link._send_int(1 if apply else 0)            
           self.link._check_status()

We'll add this by default with new versions of RoboDK.
#5
(03-09-2022, 07:41 AM)Albert Wrote: This is officially not supported right now using the API but there is a workaround you can do by following these steps:
  1. Open the robolink.py file you'll find here:
    C:/RoboDK/Python/robodk/robolink.py
  2. Search for the setGeometry pose function (around line 4304)
  3. Replace this function by this one to have the optional apply flag:
Code:
   def setGeometryPose(self, pose, apply=False):
       """Set the position (pose) the object geometry with respect to its own reference frame. This can be applied to tools and objects.
       The pose must be a :class:`robomath.Mat`"""
       with self.link._lock:
           self.link._check_connection()
           command = 'S_Hgeo2'
           self.link._send_line(command)
           self.link._send_item(self)
           self.link._send_pose(pose)
           self.link._send_int(1 if apply else 0)            
           self.link._check_status()

We'll add this by default with new versions of RoboDK.

This works fine! Yesterday I had to make the change.
  




Users browsing this thread:
1 Guest(s)