Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoleveler opening a scan containing negative space coordinates fails #2571

Open
rurigk opened this issue Jul 21, 2024 · 1 comment
Open

Comments

@rurigk
Copy link

rurigk commented Jul 21, 2024

Version

2.1.8

Hardware / Firmware

GRBL 1.1

What happened

I tried to open a autoleveler saved scan with "Open scan" button and it shows an error

java.lang.IllegalStateException: The supplied file is missing height data for grid point: com.willwinder.universalgcodesender.model.Position@48569148[units=MM,a=NaN,b=NaN,c=NaN,x=19.4,y=-1.6999999999999886,z=NaN]
	at com.willwinder.ugs.platform.surfacescanner.actions.OpenScannedSurfaceAction.lambda$updatePoints$1(OpenScannedSurfaceAction.java:117)
	at java.base/java.util.Optional.orElseThrow(Unknown Source)
	at com.willwinder.ugs.platform.surfacescanner.actions.OpenScannedSurfaceAction.updatePoints(OpenScannedSurfaceAction.java:117)
	at com.willwinder.ugs.platform.surfacescanner.actions.OpenScannedSurfaceAction.actionPerformed(OpenScannedSurfaceAction.java:97)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
	at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
	at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.desktop/java.awt.Component.processEvent(Unknown Source)
	at java.desktop/java.awt.Container.processEvent(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
[catch] at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

Original settings
image

Settings when i try to import the scan (it resets the minY to 0.0)
image

I can't redo the scan because the surface is not there anymore because some of traces are already milled (pcb milling)

How to reproduce

Open this scan file with 2.1.8
twilight_left_front_scan.txt

Rename to .xyz, github didn't allowed me to upload .xyz files

Operating System

Arch Linux

Anything else

No response

@rurigk
Copy link
Author

rurigk commented Jul 22, 2024

I found out why

In https://github.com/winder/Universal-G-Code-Sender/blob/master/ugs-platform/ugs-platform-surfacescanner/src/main/java/com/willwinder/ugs/platform/surfacescanner/Utils.java#L51
uses Double.MIN_VALUE but it represents the lowest non-zero positive number

https://stackoverflow.com/questions/3884793/why-is-double-min-value-in-not-negative#3884879

Thats why it goes to 0 on the settings

Changing it to

double maxX = -Double.MAX_VALUE;
double maxY = -Double.MAX_VALUE;
double maxZ = -Double.MAX_VALUE;

works as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant