Can i change transforms in a list of robtargets?
            
                
                    k_schmid                
                
                     ✭                
            
                        
            I am trying to get rid of globals and typing names in my program.
I want to change transforms of some targets
CONST string targetnames{5}:=["Target_R11_10","Target_R11_40","Target_R11_30","Target_R11_20","Target_R11_50"];
GetDataVal targetnames{1},current_robtarg1;! Is this a copy?
current_robtarg1.trans.z:=current_robtarg1.trans.z + z; ! will this change Target_R11_10?
Whats the best way to do it?
Are there global variables between tasks?
Also, anyway to reference tools and workobjects without names?
Thanks so much
0  
            Comments
- 
            k_schmid said:I am trying to get rid of globals and typing names in my program.I want to change transforms of some targetsCONST string targetnames{5}:=["Target_R11_10","Target_R11_40","Target_R11_30","Target_R11_20","Target_R11_50"];This needs to be PERS, you cannot write a value to a CONST. Also, must be PERS in all tasks for tasks to access the values and change them.
GetDataVal targetnames{1},current_robtarg1;! Is this a copy?
You need to declare this.current_robtarg1.trans.z:=current_robtarg1.trans.z + z; ! will this change Target_R11_10?Whats the best way to do it?Target_R11_10.trans.z:=current_robtarg1.trans.z + z; ! will this change Target_R11_10?This will.Are there global variables between tasks?Also, anyway to reference tools and workobjects without names?
I have to think about that some.Thanks so much
Lee Justice0 - 
            Wait: CONST string targetnames are just names for lookup, the targets are PERS..., not writing to that array.GetDataVal targetnames{1},current_robtarg1;! Is this a copy?Is declared of course.So is GetDataVala making a copy of my target implicitly? How do i reference a target without making a copy if it is?
0 - 
            I see, my oversight about just target names. No, it does not make a copy, per se, it writes the values from the target into the destination variable.Lee Justice1
 - 
            Great thanks
0 - 
            Hello,
GetDataVal copies the value of the data declaration into a variable.
If you modify the copied data, you have to use SetDataVal to write the new value back into the named data declaration.
/Br
Micky
1 - 
            Ah thanks so much, I check that
0 
Categories
- All Categories
 - 5.6K RobotStudio
 - 401 UpFeed
 - 21 Tutorials
 - 15 RobotApps
 - 306 PowerPacs
 - 407 RobotStudio S4
 - 1.8K Developer Tools
 - 250 ScreenMaker
 - 2.9K Robot Controller
 - 363 IRC5
 - 81 OmniCore
 - 8 RCS (Realistic Controller Simulation)
 - 853 RAPID Programming
 - 31 AppStudio
 - 4 RobotStudio AR Viewer
 - 19 Wizard Easy Programming
 - 110 Collaborative Robots
 - 5 Job listings
 
