CS-Lab Support Forum for CNC Community
Help to run this brand-new forum and stay with us.
Ask your questions, we are here to help!
Set a specific work coordinate
Quote from Dobbelju on 26 March 2024, 17:25Hello!
I can`t get one thing to work. I want wo change one specific value(Y - equals [1] / 2nd Number 26) from the "WorkOffset" String, which is also shown in the python guide:
Index = 3
WorkOffset = [ 20, 26, -44, 55, -50, -70]
d.setWorkOffset( Index, WorkOffset )
This is from the Guide itself, does anybody know how to change only the 2nd one (26, in this case the Y axis coordinate).
When i leave the other numbers blank, there is an error.
Regards
Dobbelju
Hello!
I can`t get one thing to work. I want wo change one specific value(Y - equals [1] / 2nd Number 26) from the "WorkOffset" String, which is also shown in the python guide:
Index = 3
WorkOffset = [ 20, 26, -44, 55, -50, -70]
d.setWorkOffset( Index, WorkOffset )
This is from the Guide itself, does anybody know how to change only the 2nd one (26, in this case the Y axis coordinate).
When i leave the other numbers blank, there is an error.
Regards
Dobbelju
Quote from erwan on 26 March 2024, 21:53maybe
New_Y_Value = 26
# Retrieve the current offsets
Index = 3
WorkOffset = d.getWorkOffset(Index)
# Modify only the second value in the WorkOffset list
WorkOffset[1] = New_Y_Value# Apply the modified new offsets
d.setWorkOffset(Index, WorkOffset)
maybe
New_Y_Value = 26
# Retrieve the current offsets
Index = 3
WorkOffset = d.getWorkOffset(Index)
# Modify only the second value in the WorkOffset list
WorkOffset[1] = New_Y_Value
# Apply the modified new offsets
d.setWorkOffset(Index, WorkOffset)
Quote from CS-Lab Support on 27 March 2024, 15:19Hello.
Erwan is right.
I would like to add that the same is done when we want to move the axes.
When we want to move the X-axis to machine position 0 :
vel = 100
pos = d.getPosition(CoordMode.Machine)
pos[Axis.X.value] = 0;
d.moveToPosition(CoordMode.Machine, pos, vel)
When we want to move the X-axis by 10mm in machine coordinates
vel = 100
pos = d.getPosition(CoordMode.Machine)
pos[Axis.X.value] += 10
d.moveToPosition(CoordMode.Machine, pos, vel)
Regards,
Wojtek
Hello.
Erwan is right.
I would like to add that the same is done when we want to move the axes.
When we want to move the X-axis to machine position 0 :
vel = 100
pos = d.getPosition(CoordMode.Machine)
pos[Axis.X.value] = 0;
d.moveToPosition(CoordMode.Machine, pos, vel)
When we want to move the X-axis by 10mm in machine coordinates
vel = 100
pos = d.getPosition(CoordMode.Machine)
pos[Axis.X.value] += 10
d.moveToPosition(CoordMode.Machine, pos, vel)
Regards,
Wojtek
Quote from Dobbelju on 19 April 2024, 08:30Hello!
Finally i could use your ideas on how to work this out. And it worked very well, thanks alot to you both!
Was very helpful.
Regarfs
Dobbelju
Hello!
Finally i could use your ideas on how to work this out. And it worked very well, thanks alot to you both!
Was very helpful.
Regarfs
Dobbelju
Quote from agm-kaufmann on 14 June 2024, 11:15Hello,
what index does the "Name" column have in the WorkOffset?
I would like to always have it displayed as well.
Best regards Anton
Hello,
what index does the "Name" column have in the WorkOffset?
I would like to always have it displayed as well.
Best regards Anton
Quote from agm-kaufmann on 14 June 2024, 21:45The headings of the Work Offset table are:
1(G54) Name X Y Z A B Cthese are used in the code as:
G54 ? 0 1 2 3 4 5You use
pos[Axis.X.value] = 0;
to access the contents of X.I want to output the contents of Name.
Regards Anton
The headings of the Work Offset table are:
1(G54) Name X Y Z A B C
these are used in the code as:
G54 ? 0 1 2 3 4 5
You use
pos[Axis.X.value] = 0;
to access the contents of X.
I want to output the contents of Name.
Regards Anton
Uploaded files:Quote from erwan on 14 June 2024, 22:19i can't find a commande for that CsLab will tell us more
but you can make it like that
# Function to get the name based on the offset number
def get_workoffset_name(offset_number):
if offset_number == 1:
return "schlusslanhanger"
elif offset_number == 2:
return "Gitarre body"
elif offset_number == 3:
return "gitarre hals"
elif offset_number == 4:
return "base4"
elif offset_number == 5:
return "base5"
elif offset_number == 6:
return "base6"
else:
return "Unknown"# Retrieve the offset number using the method from the software
offset_number = d.getWorkOffsetNumber()# Get the name corresponding to the offset number
offset_name = get_workoffset_name(offset_number)# Print the offset name
print(f"The offset number {offset_number} is named: {offset_name}")
i can't find a commande for that CsLab will tell us more
but you can make it like that
# Function to get the name based on the offset number
def get_workoffset_name(offset_number):
if offset_number == 1:
return "schlusslanhanger"
elif offset_number == 2:
return "Gitarre body"
elif offset_number == 3:
return "gitarre hals"
elif offset_number == 4:
return "base4"
elif offset_number == 5:
return "base5"
elif offset_number == 6:
return "base6"
else:
return "Unknown"
# Retrieve the offset number using the method from the software
offset_number = d.getWorkOffsetNumber()
# Get the name corresponding to the offset number
offset_name = get_workoffset_name(offset_number)
# Print the offset name
print(f"The offset number {offset_number} is named: {offset_name}")
Quote from agm-kaufmann on 15 June 2024, 06:41Hi Erwan, you're great! Thank you!
It would be good if I could think around behind too.
With a new name the code has to be changed too, but that's ok.
Hi Erwan, you're great! Thank you!
It would be good if I could think around behind too.
With a new name the code has to be changed too, but that's ok.
Quote from erwan on 15 June 2024, 09:12your welcome!
"With a new name the code has to be changed"
yes, but i can't find a "D.getworkoffsetName"
your welcome!
"With a new name the code has to be changed"
yes, but i can't find a "D.getworkoffsetName"