Welcome to Our Community

Some features disabled for guests. Register Today.

Tech support for Javascript Macros in CONTROL

Discussion in 'Control Software' started by sharmstr, Jan 4, 2021.

  1. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,701
    Likes Received:
    4,249
    Convenient way of not upsetting current modals. As you can include the modals you need in a jog command without needing to change them globally
     
    sharmstr and Misterg like this.
  2. Misterg

    Misterg Veteran
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 27, 2022
    Messages:
    340
    Likes Received:
    264
    Niuulh and Peter Van Der Walt like this.
  3. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,701
    Likes Received:
    4,249
    Thanks for the Share, in theme of this thread, could you include some eye candy, screenshots etc :) - scroll up for some examples of how its usually posted
     
  4. Ivo Beltchev

    Builder

    Joined:
    Apr 17, 2023
    Messages:
    32
    Likes Received:
    15
    I'll do that over the weekend.
     
    Peter Van Der Walt likes this.
  5. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,393
    Likes Received:
    1,892
    surely this is already sorted by using the OpenBuilds postprocessor?
    docs:software:fusion360 [OpenBuilds Documentation]
     
    Peter Van Der Walt likes this.
  6. Ivo Beltchev

    Builder

    Joined:
    Apr 17, 2023
    Messages:
    32
    Likes Received:
    15
    Looks like the only overlap in functionality is adding a pause when the spindle turns on. I don't think any of my other features are possible from inside a postprocessor.
     
  7. sharmstr

    sharmstr OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 23, 2018
    Messages:
    2,059
    Likes Received:
    1,448
    The OB fusion post restores rapids as well.
     
  8. Ivo Beltchev

    Builder

    Joined:
    Apr 17, 2023
    Messages:
    32
    Likes Received:
    15
    Oh, that's great to hear!
    I spent sometime investigating if it was possible, and determined that there was just not enough information passed down from F360.
    I will give the Open Builds version a try.
     
  9. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,701
    Likes Received:
    4,249
  10. Misterg

    Misterg Veteran
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 27, 2022
    Messages:
    340
    Likes Received:
    264
    Is there any way to display images in macro dialogs?

    The probing wizard uses something similar the following...

    Code:
    <img src="./img/xyzprobe/y.png" alt="probe-y" height="45" id="img-probe-y">
    
    (I think the image resource is compiled into the executable??)

    If I try and change that to an image on my computer I get an error "Not allowed to load local resource".

    So, is there any (reasonable) way to display images or custom icons in a user macro?

    This sort of thing:

    deltaz.png
    Thanks :)
     
    David the swarfer likes this.
  11. sharmstr

    sharmstr OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 23, 2018
    Messages:
    2,059
    Likes Received:
    1,448
    Unless something has changed recently, you'll have to use an image to html converter. It adds a bunch of code to the macro unfortunately. I ultimately used the included font icons library to convey what I wanted. There's many ways to manipulate icons (rotate, stack, etc: Font Awesome Examples) Not sure if you can do the same.
     
    Peter Van Der Walt and Misterg like this.
  12. Misterg

    Misterg Veteran
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 27, 2022
    Messages:
    340
    Likes Received:
    264
    Ok, that's very helpful. Thanks very much for the swift response :)
     
    sharmstr likes this.
  13. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,393
    Likes Received:
    1,892
    create a vector SVG so it draws the icon rather than storing a bitmap raster image.?
     
    Peter Van Der Walt likes this.
  14. Ivo Beltchev

    Builder

    Joined:
    Apr 17, 2023
    Messages:
    32
    Likes Received:
    15
    @David the swarfer - I looked at your cps code. It has a much more elegant solution. The secret sauce was the onParameter callback. I was unaware of it, which led me to conclude it cannot be done.
    It only took a few lines of code to add this in my own postprocess script.

    @Peter Van Der Walt - I am adding separate posts for each of my macro scripts.
     
    David the swarfer likes this.
  15. Robert White

    Builder

    Joined:
    Oct 17, 2020
    Messages:
    36
    Likes Received:
    3
    ok. thank you!! so how do I go about pulling up the macro program onto open build control. or software
     
  16. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,701
    Likes Received:
    4,249
    Please use Tech support for Javascript Macros in CONTROL for SUPPORT - don't use this library thread - we want to keep it clean.

    As for how to install it - simple, CONTROL > Macros Tab
     
  17. Evilspawn

    Evilspawn New
    Builder

    Joined:
    May 4, 2022
    Messages:
    34
    Likes Received:
    7
    Would this work with the Touch probe which Openbuilds sells?
     

    Attached Files:

  18. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,701
    Likes Received:
    4,249
  19. Daniel Jackson

    Builder

    Joined:
    Oct 23, 2021
    Messages:
    28
    Likes Received:
    3
    Good evening. I was just checking to see if anyone else as tested the tool offset macro in with X32. I can use it one time it will work great. On the next time after I swap tools when I go zero on z, it is about 1/4 above the surface. I have tested it with a solid block so I have a known z zero every time. It is possible it is something with my set up. I did need to modify the firmware to auto squaring Y. I do my initial probe with XYZ from open builds then my tool height setter is a different probe if that make any difference. My issue is I'm trying to cut a wavy flag and during tool changes I have nothing to reference from. Any suggestions would be great. Thank you
     
  20. Misterg

    Misterg Veteran
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 27, 2022
    Messages:
    340
    Likes Received:
    264
    Hi,

    The macro should work for that sort of thing...

    Are you setting your first tool as a 'Reference Tool' using the tool setter *after* you've set XYZ zero using the Openbuilds probe?

    Take me through your exact workflow and I'll see if I can help.
     
    Peter Van Der Walt likes this.
  21. Daniel Jackson

    Builder

    Joined:
    Oct 23, 2021
    Messages:
    28
    Likes Received:
    3
    Normally, home machine set g28 and g30 locations. Use xyz probe to set z for height only, I like to use the center of the wood as center of project. I will run first cut. Run Macro to set reference height, then change tool out. set new height. that one usually works fine. for the subsequent tool changes, I have tried to reset reference height and do just a tool change. neither seem to work. when I go to zero again after set second tool change. it is about .25" above work piece. I have done on solid uncut wood to see where it is returning to zero after tool change. Hope that helps to explain it. I can try and video if needed. Thank you for the response.
     
  22. Misterg

    Misterg Veteran
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 27, 2022
    Messages:
    340
    Likes Received:
    264
    It shouldn't be necessary to set the reference tool a second time, but equally, it shouldn't hurt anything, either.

    When you say 'go to zero', what exactly do you mean, and how do you do it? (which buttons or commands do you use - just trying to understand! :) )

    A video of the process might help - I'm puzzled as to what might be happening.
     
  23. Daniel Jackson

    Builder

    Joined:
    Oct 23, 2021
    Messages:
    28
    Likes Received:
    3
    I will work on a video. Go to zero is push the "gotozero" drop down and select the work Coord one, (G0 Z5, G0 X0 Y0, G0 Z0) option. when I use the XYZ it will touch the work surface at home. When I use the macro, it does not. I did try a cut anyway and it was above the work surface. Currently I use a work around with set up blocks and probe to reset zero after bit change. I did set up a macro to define g28 and g30. Ill send that too just in case it is the problem.
     
  24. Misterg

    Misterg Veteran
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 27, 2022
    Messages:
    340
    Likes Received:
    264
    Thanks - btw defining G28 & G30 should be a once only operation - the positions are stored through power cycles, etc. so don't need resetting every time (unless you want to move them).
     
  25. Daniel Jackson

    Builder

    Joined:
    Oct 23, 2021
    Messages:
    28
    Likes Received:
    3
    Thank you, that is good to know.
     
  26. Daniel Jackson

    Builder

    Joined:
    Oct 23, 2021
    Messages:
    28
    Likes Received:
    3
    I would like to thank you for your time. I just tried to make a video of the problem and it worked every time. I just did it four times in a row. The only thing I did change was I deleted to macro and had to reinstall it. Open builds would no longer run it and it disappeared from the GUI.
     
    Misterg likes this.
  27. Alain JBT

    Alain JBT Well-Known
    Builder

    Joined:
    Apr 23, 2023
    Messages:
    51
    Likes Received:
    29
    Hello everyone.
    Thank you @Misterg for this superb sharing!
    For me who am not developer it is a great tool to resume work on an existing part.
    I have questions about the configuration because I did not understand well:

    - How to configure the job of the probe if I want to measure from the outside or otherwise a measurement from the inside?
    - Is it possible to measure several heights around the periphery and the center of a piece that is curved?
    - What difference is there between the marked drawing "default UI:" and the one that is marked "alternative UI (simpleUI =" false ")".
    - Does this macro work with Control only (not Interface, right)?
    - I have to connect the 3D probe in serial or parallel mode if I want to keep XYZ Probe+ connected?
    - ok ok ok sorry ... I stop the questions, that's all for today :blackeye:

    Thank you so much!
     
  28. Misterg

    Misterg Veteran
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 27, 2022
    Messages:
    340
    Likes Received:
    264
    Hi - Do you mean this macro?

    Getting started with Javascript Macros in CONTROL / Library of Macros created by the community

    My macro only measures from the outside. Peter Van Der Walt already wrote a macro for measuring from the inside:

    Getting started with Javascript Macros in CONTROL / Library of Macros created by the community

    It starts to get complicated if you try and cover all the options from one macro.

    No, not using my macro or any other one I have seen for Control. You could look at BCNC gcode sender (alternative to Control) that has Z probing and digitising built in.

    bCNC

    One adds the setting for probe retract distance and Z travel speed

    simple centre.png advanced centre.png

    It uses javascript, so I think it will only work in Control.

    I *think* that a 'Normally Closed' (NC) 3D probe could be connected in parallel with the signal and ground for the XYZ Probe (which I think inverts the probe signal), but please get someone from OpenBuilds to verify that it won't cause damage (@Peter Van Der Walt ?). Otherwise, keep them separate. (I have a small interface circuit on my home built machine that allows a combination of NC and NO probes.)

    Thank you for your kind words. :)
     
    Alain JBT and Peter Van Der Walt like this.
  29. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,701
    Likes Received:
    4,249
    NC probe in parallel with an NO probe like ours will show the NO probe as "closed" all the time :)

    Best to have both as NO probes.
    If you can't avoid it, make them pluggable, and remember to change $6 depending on which you have plugged in
     
    Alain JBT likes this.
  30. Misterg

    Misterg Veteran
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 27, 2022
    Messages:
    340
    Likes Received:
    264
    Sorry - I thought that the XYZ probe inverted the signal. My bad.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice