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

M-Code-Definitions with "=" #3

Open
Sajuuk09 opened this issue Oct 24, 2022 · 1 comment
Open

M-Code-Definitions with "=" #3

Sajuuk09 opened this issue Oct 24, 2022 · 1 comment

Comments

@Sajuuk09
Copy link

Hello,

first I want to thank you for the time, you spent making this awesome VS-Code Extension. I really like it.
My Problem is, that my CNC-machine has some M-Codes, that i can't process normally.
For example, M4=3 means "spindle start, Main spindle, clockwise" whereas M3=3 means "spindle start, counterspindle, clockwise"
There is a whole bunch of these special M-Codes my machine ist using.
At the moment i am not able to use these definitions, even if i write them into the settings.json-file, because i think he stops at the "="-symbol and doesn't read further. It seems it is all just M4 or M3 for the program.
Unfortunately I am not a programmer, so I would like to ask you for your help. Is there a solution to this problem.
Thank you very much in advance and have a nice day.

Best regards

Ben

@Sajuuk09 Sajuuk09 changed the title G-Code-Definitions with "=" M-Code-Definitions with "=" Oct 24, 2022
@scottmwyant
Copy link
Owner

scottmwyant commented Mar 7, 2024

I will have to update parsing logic. Looks like I could handle this by assuming key: value syntax to be used where the key includes a = character.


Note to self:

\(\s*[A-Z0-9]{2,5}((=\d{1,5}\:\s)|\s?\=\s?|:\s)[a-zA-Z0-9\,\s]+\s*\)

const regex = /\(\s*[A-Z0-9]{2,5}\s*[:=]\s*[a-zA-Z0-9\,\s]+\s*\)/g;

Change characters being replaced (to form valid json) depending on presence of :. When colon is used, just replace with quotes, otherwise use current implementation.

comments = comments.map(comment => comment.replace(/\s*[:=]\s*/, '": "'));

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

2 participants