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

Lock an item

#1
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
#2
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
Find useful information about RoboDK and its features by visiting our Online Documentation and by watching tutorials on our Youtube Channel


#3
thanks Jeremy any progress on this?
Regards
Andy
#4
Hi Andy,

You can modify access to items by using setFlagsItem:
https://robodk.com/doc/en/PythonAPI/robo...tFlagsItem

Albert
#5
Great Albert.

Let us know how it goes Andy!
Find useful information about RoboDK and its features by visiting our Online Documentation and by watching tutorials on our Youtube Channel


#6
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
#7
(02-01-2022, 09:57 AM)Albert Wrote: Hi Andy,

You can modify access to items by using setFlagsItem:
https://robodk.com/doc/en/PythonAPI/robo...tFlagsItem

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
#8
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])
  




Users browsing this thread:
1 Guest(s)