Advanced Search

Search Results (Searched for: )

  • raggielyle1@gmail.com
  • raggielyle1@gmail.com
09 Feb 2026 08:33
Replied by raggielyle1@gmail.com on topic New Laser Build - raster engraving

New Laser Build - raster engraving

Category: Plasma & Laser

Try this code
#!/bin/bash
# Laser Engraving Converter - Final Vertical Fix

echo "========================================"
echo " LASER ENGRAVING CONVERTER "
echo "========================================"
echo ""

# Get filename
read -p "Enter image name (without .png): " base_name

# Find the file
if [ -f "${base_name}.png" ]; then
png_file="${base_name}.png"
elif [ -f "${base_name}.PNG" ]; then
png_file="${base_name}.PNG"
elif [ -f "$base_name" ]; then
png_file="$base_name"
else
echo "ERROR: File '${base_name}' not found!"
read -p "Press Enter to exit..."
exit 1
fi

echo "Found: $png_file"
gcode_file="${base_name}laser.ngc"
echo "Output: $gcode_file"
echo ""

# Get settings
read -p "Enter target width in mm: " target_width_mm
read -p "Enter DPI [75]: " dpi_input
dpi=${dpi_input:-75}
read -p "Enter feed rate [500]: " feed_rate_input
feed_rate=${feed_rate_input:-500}
read -p "Enter safe Z height [10]: " safe_z_input
safe_z=${safe_z_input:-10}
read -p "Enter engrave Z height [0]: " engrave_z_input
engrave_z=${engrave_z_input:-0}
read -p "Enter minimum power [1]: " min_power_input
min_power=${min_power_input:-1}
read -p "Enter maximum power [500]: " max_power_input
max_power=${max_power_input:-500}
read -p "Cross-hatching? (y/n) [n]: " cross_hatch_input
cross_hatch=${cross_hatch_input:-n}

echo ""
echo "=== SETTINGS ==="
echo "Image: $png_file"
echo "Width: ${target_width_mm}mm"
echo "DPI: $dpi"
echo "Feed: ${feed_rate} mm/min"
echo "Safe Z: ${safe_z}mm"
echo "Engrave Z: ${engrave_z}mm"
echo "Power: ${min_power}-${max_power}"
echo "Cross-hatch: $cross_hatch"
echo ""

read -p "Continue? (y/n): " confirm
if ! "$confirm" =~ ^[Yy]$; then
echo "Cancelled."
read -p "Press Enter to exit..."
exit 0
fi

echo "Converting..."
echo ""

cat > /tmp/laser_final_fix.py << 'PYTHON_EOF'
import sys
import os
from PIL import Image

def main():
if len(sys.argv) != 11:
print("ERROR: Wrong number of arguments")
return 1

# Parse arguments
input_file = sys.argv[1]
target_width_mm = float(sys.argv[2])
dpi = int(sys.argv[3])
feed_rate = int(sys.argv[4])
safe_z = float(sys.argv[5])
engrave_z = float(sys.argv[6])
min_power = int(sys.argv[7])
max_power = int(sys.argv[8])
cross_hatch = sys.argv[9]
output_file = sys.argv[10]

print(f"Converting: {os.path.basename(input_file)}")
print(f"Power range: {min_power}-{max_power}")

try:
# Load image
img = Image.open(input_file)
if img.mode != 'L':
img = img.convert('L')

orig_w, orig_h = img.size

# Calculate new size
pixels_per_mm = dpi / 25.4
target_px_w = int(target_width_mm * pixels_per_mm)
aspect_ratio = orig_h / orig_w
target_px_h = int(target_px_w * aspect_ratio)

actual_mm_w = target_px_w / pixels_per_mm
actual_mm_h = target_px_h / pixels_per_mm
mm_per_pixel = 25.4 / dpi

print(f"Image size: {target_px_w}x{target_px_h} pixels")
print(f"Physical size: {actual_mm_w:.1f}x{actual_mm_h:.1f} mm")
print(f"mm per pixel: {mm_per_pixel:.3f}")

# Resize
img = img.resize((target_px_w, target_px_h))
pixels = list(img.getdata())

# Generate G-code
with open(output_file, 'w') as f:
# Header
f.write('; Laser engraving - FINAL FIX\n')
f.write(f'; Image: {os.path.basename(input_file)}\n')
f.write(f'; Size: {actual_mm_w:.1f}x{actual_mm_h:.1f} mm\n')
f.write(f'; DPI: {dpi}\n')
f.write(f'; Feed: {feed_rate}\n')
f.write(f'; Power: {min_power}-{max_power}\n\n')

# Setup
f.write('G21\nG90\nG64\nG17\nG54\n\n')

# Initialize
f.write(f'F{feed_rate}\n')
f.write(f'G0 Z{safe_z:.1f}\n')
f.write('G0 X0 Y0\n')
f.write(f'G0 Z{engrave_z:.1f}\n')
f.write('M3\n\n')

# HORIZONTAL PASSES
f.write('; --- HORIZONTAL PASSES ---\n')
print("\nGenerating horizontal passes...")

for y in range(target_px_h):
# Flip Y: image row y (0=top) -> machine Y (target_px_h-1-y)*mm_per_pixel
y_pos = (target_px_h - 1 - y) * mm_per_pixel

if y % 2 == 0:
# Left to right
f.write(f'G0 X0 Y{y_pos:.3f}\n')
for x in range(target_px_w):
pixel = pixels[y * target_px_w + x]
power = min_power + int((max_power - min_power) * (255 - pixel) / 255)
f.write(f'G1 X{x*mm_per_pixel:.3f} S{power}\n')
else:
# Right to left
f.write(f'G0 X{actual_mm_w:.3f} Y{y_pos:.3f}\n')
for x in range(target_px_w-1, -1, -1):
pixel = pixels[y * target_px_w + x]
power = min_power + int((max_power - min_power) * (255 - pixel) / 255)
f.write(f'G1 X{x*mm_per_pixel:.3f} S{power}\n')

if y % 50 == 0:
print(f" Row {y+1}/{target_px_h}")

# VERTICAL PASSES
if cross_hatch.lower() == 'y':
f.write('\n; --- VERTICAL PASSES (CROSS-HATCH) ---\n')
print("\nGenerating vertical passes...")
print("DEBUG: This should engrave on the way UP, not on the way DOWN!")

for x in range(target_px_w):
x_pos = x * mm_per_pixel

if x % 2 == 0:
# Even columns: bottom to top (engrave on the way UP)
f.write(f'G0 X{x_pos:.3f} Y0\n')
# We want to go from Y=0 to Y=max
# Read pixels from BOTTOM (image row target_px_h-1) to TOP (image row 0)
for step in range(target_px_h):
# step: 0 to target_px_h-1 (bottom to top in machine coords)
# image_y: target_px_h-1 to 0 (bottom to top in image)
image_y = target_px_h - 1 - step
pixel = pixels[image_y * target_px_w + x]
power = min_power + int((max_power - min_power) * (255 - pixel) / 255)
current_y = step * mm_per_pixel # 0 to max
f.write(f'G1 Y{current_y:.3f} S{power}\n')
else:
# Odd columns: top to bottom (engrave on the way DOWN)
f.write(f'G0 X{x_pos:.3f} Y{actual_mm_h:.3f}\n')
# We want to go from Y=max to Y=0
# Read pixels from TOP (image row 0) to BOTTOM (image row target_px_h-1)
for step in range(target_px_h):
# step: 0 to target_px_h-1 (represents position from top)
image_y = step # 0 to target_px_h-1 (top to bottom in image)
pixel = pixels[image_y * target_px_w + x]
power = min_power + int((max_power - min_power) * (255 - pixel) / 255)
current_y = actual_mm_h - (step * mm_per_pixel) # max to 0
f.write(f'G1 Y{current_y:.3f} S{power}\n')

if x % 50 == 0:
print(f" Column {x+1}/{target_px_w}")


# End program
f.write('\n; --- END ---\n')
f.write('M5\n')
f.write(f'G0 Z{safe_z:.1f}\n')
f.write('G0 X0 Y0\n')
f.write('M2\n')

print(f"\n✅ G-code written to: {output_file}")

# Show sample of vertical section
if cross_hatch.lower() == 'y' and os.path.exists(output_file):
with open(output_file, 'r') as f:
lines = f.readlines()

# Find vertical section
for i, line in enumerate(lines):
if 'VERTICAL PASSES' in line:
print("\n=== SAMPLE OF VERTICAL SECTION ===")
# Show first 20 lines of vertical section
for j in range(i, min(i+20, len(lines))):
print(f" {lines[j].rstrip()}")
print("...")
break

return 0

except Exception as e:
print(f"\n❌ ERROR: {e}")
import traceback
traceback.print_exc()
return 1

if __name__ == "__main__":
sys.exit(main())
PYTHON_EOF

# Run the Python script
python3 /tmp/laser_final_fix.py \
"$png_file" \
"$target_width_mm" \
"$dpi" \
"$feed_rate" \
"$safe_z" \
"$engrave_z" \
"$min_power" \
"$max_power" \
"$cross_hatch" \
"$gcode_file"

result=$?

echo ""
echo "========================================"
if [ $result -eq 0 ]; then
echo "CONVERSION COMPLETE!"
echo "File: $gcode_file"
echo ""

else
echo "CONVERSION FAILED!"
fi
echo ""

read -p "Press Enter to exit..."
  • Hakan
  • Hakan
09 Feb 2026 07:44
Replied by Hakan on topic XHC WHB04B development?

XHC WHB04B development?

Category: General LinuxCNC Questions

Is it realistic to write a new firmware for the dongle? Is it to improve on the reset?

Sounds like you identified blocking wait states as at least one big part of the problem.
Realistic to rewrite those sections in the component?

fyi, I have the radio version, works well for me needs.
  • David-Diy
  • David-Diy's Avatar
09 Feb 2026 06:24
Replied by David-Diy on topic Hydraulic press brake control

Hydraulic press brake control

Category: CNC Machines

I just arrived but I just fixed a new Chinese 12 feet CNC press brake, and I have to say the control box HMI and the motor pump is very clean installation. The one that I fixed was 120T. I recommend you to build your own from a 5-10HP motor low speed, buy the oil pump, just the cylinder block. and connect 1/2" hoses to your reservoir. The already made will not have what it takes to be sufficiently powerful to be happy with repeatability.
  • Stephan@work
  • Stephan@work
09 Feb 2026 06:18

Configure Mesa 7i96s and pktuart with Omron MX2 (wj200)

Category: Advanced Configuration

Thank you Peter, thank you Tom.
I will try to increase the interval.
No pressure with these MX2. I have a running solution with the USB-Dongle.

Thank you !
  • amanker
  • amanker
09 Feb 2026 06:07 - 09 Feb 2026 06:10

Remora - Rpi Software Stepping Using External Microcontroller via SPI

Category: Computers and Hardware

Sorry, I was on mobile, not on PC so I wrongly uploaded platformio.ini. 
I am using SPI2 pins as per your previous suggestions and it was working ok in remora-spi with TMC.
So I am using same for ETH version.
I am uploading actual platformio.ini
 

File Attachment:

File Name: platformio...2-09.ini
File Size:4 KB


Please look at ldscript, which is I have made with reference to already available ldscripts.
  • David-Diy
  • David-Diy's Avatar
09 Feb 2026 05:53
Replied by David-Diy on topic Hydraulic press brake control

Hydraulic press brake control

Category: CNC Machines

If I didn't look at the second picture I didn't have a clear idea on how to make the steppers interact with your valves, they are mechanically driven like a joystick right? Y could move them in portions or one way or other. But with the motors they are electronically regulated. Which is so, so nice! also the clean and direct way of doing it. Is SUPER! Even if you don't have a proper feedback to know if both hydraulics go down exactly as they should. You could even use a g2 timing belt as a rack and small pulley with a DIY encoder disc to count movement.
Thanks to your photos I have many ideas now.
  • 3404gerber
  • 3404gerber
09 Feb 2026 05:16

Remora - Rpi Software Stepping Using External Microcontroller via SPI

Category: Computers and Hardware

Hi, 
So you are using the spi1 pins for the w5500? I think this will be a problem if your config uses tmc5160, as the module uses software spi and configure the pins as standard gpio. 
  • besriworld
  • besriworld
09 Feb 2026 04:33 - 09 Feb 2026 11:30

Servo Wiring and Tuning detailed How To example Mesa 7i77.

Category: Advanced Configuration

If you have time, please watch the video.
Even with a very small P value, the axis starts to oscillate.

PS. I understand that Linuxcnc is fighting with the internal PID controller of the servo driver.
  • rodw
  • rodw's Avatar
09 Feb 2026 03:54

Retrofitting an old industrial CNC Plasma table

Category: Plasmac

This example config include a separate ohmic.hal and the hypersensing component is in the components folder.
github.com/rodw-au/showstopper
  • Looby
  • Looby
09 Feb 2026 03:13

Lenovo T14 Gen2 AMD - CRAZY High Latency - Am I screwed?

Category: Computers and Hardware

Like it could be a cooling issue? I guess I can pull the cooler off but the fans are barely spinning and fdoesnt feel warm at all.
  • tommylight
  • tommylight's Avatar
09 Feb 2026 03:10

Lenovo T14 Gen2 AMD - CRAZY High Latency - Am I screwed?

Category: Computers and Hardware

Last ditch effort, but not far fetched: repaste the CPU.
  • tommylight
  • tommylight's Avatar
09 Feb 2026 03:09
  • besriworld
  • besriworld
09 Feb 2026 02:56

Servo Wiring and Tuning detailed How To example Mesa 7i77.

Category: Advanced Configuration

I am trying to configure the spindle as a C-axis, but I am having a problem and cannot find a solution.
Could someone please take a look at my configuration and the video and give me some advice?
I was not able to post this in the original lathe thread.





#########################
# AXIS C JOINT 2
#########################

setp  pid.c.Pgain     [JOINT_2](P)
setp  pid.c.Igain     [JOINT_2](I)
setp  pid.c.Dgain     [JOINT_2](D)
setp  pid.c.bias      [JOINT_2](BIAS)
setp  pid.c.FF0       [JOINT_2](FF0)
setp  pid.c.FF1       [JOINT_2](FF1)
setp  pid.c.FF2       [JOINT_2](FF2)
setp  pid.c.deadband  [JOINT_2](DEADBAND)
setp  pid.c.maxoutput [JOINT_2](MAX_OUTPUT)
setp  pid.c.error-previous-target true

net c-index-enable    =>  pid.c.index-enable
net c-enable          =>  pid.c.enable
net c-pos-cmd         =>  pid.c.command
net c-spindle-pos-fb  =>  pid.c.feedback
net c-output          <=  pid.c.output 

# ---PWM Generator signals/setup---

268 net c-output            =>  hm2_7i98.0.pwmgen.00.value
269 net c-pos-cmd           <=  joint.2.motor-pos-cmd
270 net c-enable            <=  joint.2.amp-enable-out
271 # enable _all_ sserial pwmgens
272 #net c-enable            =>  hm2_7i92.0.7i77.0.1.analogen

276 net c-spindle-pos-fb    <=  hm2_7i98.0.encoder.02.position
277 net c-spindle-vel-fb    <=  hm2_7i98.0.encoder.02.velocity
278 net c-spindle-pos-fb    =>  joint.2.motor-pos-fb
279 #net c-index-enable     joint.0.index-enable <=> hm2_7i92.0.encoder.06.index-enable
280 net c-pos-rawcounts     <=  hm2_7i98.0.encoder.02.rawcounts

282 # ---setup home / limit switch signals---

284 net c-home-sw           =>  joint.2.home-sw-in
285 net c-neg-limit         =>  joint.2.neg-lim-sw-in
286 net c-pos-limit         =>  joint.2.pos-lim-sw-in


[AXIS_C]
MAX_VELOCITY     = 360
MAX_ACCELERATION = 500
MIN_LIMIT        = -900.0
MAX_LIMIT        = 900.0

[JOINT_2]
TYPE             = ANGULAR
HOME             = 0.0
FERROR           = 1000.0
MIN_FERROR       = 500.0
MAX_VELOCITY     = 360
MAX_ACCELERATION = 500

P        = 0.0000001
I        = 0.
D        = 0.
FF0      = 0.98
FF1      = 0
FF2      = 0
BIAS     = 0
DEADBAND = 0.1
MAX_OUTPUT = 10

ENCODER_SCALE    = -40
OUTPUT_SCALE     = 10
OUTPUT_MIN_LIMIT = -10
OUTPUT_MAX_LIMIT = 10

MIN_LIMIT = -1000
MAX_LIMIT = 1000

HOME_OFFSET   = 0.0
HOME_SEQUENCE = 1
  • Looby
  • Looby
09 Feb 2026 02:51

Lenovo T14 Gen2 AMD - CRAZY High Latency - Am I screwed?

Category: Computers and Hardware

Well Ive spent all day trying other installs or live versions and no dice. Cant get any to run live as they just hang at a blank cursor screen. Cant even get anything installed due to a "bad archive mirror" error.

Tried latest regular Debian and got that installed and then followed directions to install linuxcnc and got it up enough to latency test aaaaaand 4,550,000ns....

What causes this so I have some idea what to avoid in the future? What in the hardware would cause this?
  • PCW
  • PCW's Avatar
09 Feb 2026 02:09
Replied by PCW on topic socket raw Eth.

socket raw Eth.

Category: Computers and Hardware

We did some tests last year comparing IP network access vs raw packets
with Mesa HostMot2 and the statistical improvement of peak latency  was
minimal so decided it was not worth the effort.

There no issue with root access and LinuxCNC as direct hardware access
requires this and the blocking of normal network traffic on the real time
Ethernet channel also requires root priviledges.
 
Displaying 136 - 150 out of 19287 results.
Time to create page: 0.254 seconds
Powered by Kunena Forum