fbpx

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! 

 

Please or Register to create posts and topics.

Set a specific work coordinate

Page 1 of 2Next

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

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)

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

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

erwan has reacted to this post.
erwan

Hello,

what index does the "Name" column have in the WorkOffset?

I would like to always have it displayed as well.

Best regards Anton

Not sure to understand.

Can you clarify?

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:
  • WorkOffset.jpg

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}")

Uploaded files:
  • Capture-decran-2024-06-14-221518.png
carbonkid has reacted to this post.
carbonkid

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.

your welcome!

"With a new name the code has to be changed"

yes, but i can't find a  "D.getworkoffsetName"

Page 1 of 2Next

PARTNERS:

 

USA

Germany

Slovenia / Bosnia

Spain

South Africa

UNI-CAM

The Netherlands

Portugal

Greece

  Distrib milionis logo

Hungary

Distrib logot

Bulgaria

Master

Kenya

Proteq Automation

Egypt

Germanelectronix

China

Jun Ma

Serbia

ALCO

Italy

LVL tech r

Denmark

Varntoft Dania

Finland

×

Hello!

Click one of our contacts below to chat on WhatsApp

× How can I help you?