RoboDK Forum
Lock an item- Printable Version

+- RoboDK Forum (//www.sinclairbody.com/forum)
+-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN)
+ - - -论坛:通用RoboDK问题(//www.sinclairbody.com/forum/Forum-General-questions-about-RoboDK)
+--- Thread: Lock an item (/Thread-Lock-an-item)



Lock an item-ANDY_F1-01-26-2022

Hi
I had an issue where a user accidently changed the values for a reference frame - is it possible to lock certain items in RDK to prevent users modifying? Password protect certain values or similar?
Regards
Andy


RE: Lock an item-Jeremy-01-26-2022

I know we have something hidden regarding this, but I can't find where it is. (it should be more accessible I believe)

I'll ask Albert.

Jeremy


RE: Lock an item-ANDY_F1-02-01-2022

thanks Jeremy any progress on this?
Regards
Andy


RE: Lock an item-Albert-02-01-2022

Hi Andy,

You can modify access to items by using setFlagsItem:
//www.sinclairbody.com/doc/en/PythonAPI/robolink.html#robolink.Robolink.setFlagsItem

Albert


RE: Lock an item-Jeremy-02-01-2022

Great Albert.

Let us know how it goes Andy!


RE: Lock an item-jermias-05-22-2023

Hey all, I tried using the setFlagsItem and I did not have results I expected. I was able to get the flags, change them, and see that they were changed, but the item was still not locked and ended up moving around as if there was no change to the flags.

I had to go up the tree in the documentation and use setFlagsRoboDK to make a real change. My goal was to lock the generated reference frames and this was the code that worked:

RDK.setFlagsRoboDK(flags=32768+8192+4096+2048+1024+512+256+128+64+32+16+8+4+2+1)

However, once the frames are locked in this instance of RoboDK, anytime I open a new instance the frames remain locked. I can easily unlock the frames with this command so this approach will work:

RDK.setFlagsRoboDK(flags=0XFFFF)

Good luck,

Josh Ermias


RE: Lock an item-jermias-05-26-2023

(02-01-2022, 09:57 AM)Albert Wrote:Hi Andy,

You can modify access to items by using setFlagsItem:
//www.sinclairbody.com/doc/en/PythonAPI/robolink.html#robolink.Robolink.setFlagsItem

Albert

Hey Albert,

Using the setRoboDKFlags on the reference frame ended up not allowing me to move anything in the RoboDK window using the "ALT" hot key, it makes me think the reference frames are connected to the other obejects in the software.

I have been able to use setFlagsItem and getFlagsItem on my generated reference frames and I see that I can change the flag number. However, the frames remain unlocked and can still be moved.

Can you elaborate on a solution?

Josh E


RE: Lock an item-Albert-05-31-2023

setFlagsItem only applies to the behavior within the tree. This function does not alter the behavior in the 3D view. The best way to lock a coordinate system is to hide it. You can hide it by using setVisible, example:

Code:
frame.setVisible(False)

You could add a 3D model that represents this coordinate system to visualize where it is without being able to move it.

Another option is to use setInteractiveMode to customize the behavior of moving references. Example:
Code:
from robolink import *
RDK = Robolink()

frame = RDK.Item("Frame 1", ITEM_TYPE_FRAME)

# Provoke pressing Alt to move objects with special behavior for Frame 1 so we can only move Frame 1 on the XY plane
RDK.setInteractiveMode(SELECT_MOVE, DISPLAY_REF_DEFAULT, [frame], [DISPLAY_REF_NONE | DISPLAY_REF_TX | DISPLAY_REF_TY | DISPLAY_REF_RZ | DISPLAY_REF_PXY])