QT_Vismach

More
20 Dec 2020 07:48 - 20 Dec 2020 07:51 #192508 by cakeslob
QT_Vismach was created by cakeslob
Good stuff cmorley, qt_vismach is pretty cool. it has indeed, allowed embedding into other projects.
I thought this configuration would be useful for 5axis stuff.only problem is losing keyboard jog and vismach at the same time, and it will make all your user tabs go to the left side. minor details. just a bit of usercommand.py
W = root_window.tk.call

def _dynamic_tab(name, text):
    tab = widgets.tabs.insert("end", name, text=text)
    tab.configure(borderwidth=1, highlightthickness=0)
    return tab


W('.pane.top.tabs','configure','-width','800','-arcradius','8','-tabpady','1''1')
Attachments:
Last edit: 20 Dec 2020 07:51 by cakeslob.

Please Log in or Create an account to join the conversation.

More
20 Dec 2020 08:37 #192509 by cmorley
Replied by cmorley on topic QT_Vismach
Glad it worked for someone in the real world!

embedding placement is up to AXIS.
It would be nice if AXIS honored INI's {DISPLAY] EMBED_TAB_LOCATION
Maybe an AXIS expert will take that on.

If you build a nice vismach machine that you want to share let me know and I'll add it to qtvcp.
It shouldn't be hard to convert the other existing samples.

What would be really cool is if one could build a vismach machine that reads the INI and modifies it's sizes to suit a config.
I don;t think that would be too hard either.

just time :)

Thanks for the post.
Chris

Please Log in or Create an account to join the conversation.

More
20 Dec 2020 08:40 #192510 by cmorley
Replied by cmorley on topic QT_Vismach
Would a 'tear away' window be better? I think Pyqt has a widget that does that.
You click the top and it pop off as a separate window that you can put back.

Chris

Please Log in or Create an account to join the conversation.

More
20 Dec 2020 21:15 - 20 Dec 2020 21:23 #192574 by cakeslob
Replied by cakeslob on topic QT_Vismach

It would be nice if AXIS honored INI's {DISPLAY] EMBED_TAB_LOCATION

having it change side via INI file is no problem, , only issue im having is getting them to load in more than 1 spot. i can only get it to do left or right and not both.
def _dynamic_tab(name, text):
    if inifile.find("DISPLAY", "EMBED_TAB_POSITION") == "LEFT":
            tab = widgets.right.insert("end", name, text=text)
    else:
            tab = widgets.tabs.insert("end", name, text=text)
    
    tab.configure(borderwidth=1, highlightthickness=0)
    return tab

If you build a nice vismach machine that you want to share let me know and I'll add it to qtvcp.
It shouldn't be hard to convert the other existing samples.

well, i do, kinda. I noticed recently that the one of the leading cam software does their machine simulation similar to how (the older) vismach , except instead of a python file, it uses an xml file to layout all the all the stl files. there are over 20 machine configs , i just dont know if it will cause legal issues to post them. ill have to find some open examples of their sim and use those probably.



for anyone else doing vismach sims, mastercam's machsim seems like an nice tool for setting up a simulation file and constraints, and outputs all the coordinates to an xml file that can be transferred over to a vismach py file. the educational version of mastercam is free and as far as i know, does everything except post gcode, so the simulator portion should be available to play with without doing anything illegal



Would a 'tear away' window be better? I think Pyqt has a widget that does that.
You click the top and it pop off as a separate window that you can put back.


probably the best option. as soon as i was playing with the embedding, i realized embedding is great, but its limiting.


edit. might as well post it now so theres less confusion later, qt_vismach will not work on pi4. on the embedded version the error destroys before you can read it, but it says the same thing ,more or less, as the gcode graphics error , and will only display an empty tab
Attachments:
Last edit: 20 Dec 2020 21:23 by cakeslob.
The following user(s) said Thank You: Aciera

Please Log in or Create an account to join the conversation.

More
20 Dec 2020 21:38 #192582 by cmorley
Replied by cmorley on topic QT_Vismach
AXIS only looks for one set of INI EMBED settings.
GMoccapy,Gscreen and Qtvcp allow many.
Here is the search code from GMoccapy:
    def get_embedded_tabs(self):
        # Check INI file for embed commands
        # NAME is used as the tab label if a notebook is used
        # LOCATION is the widgets name from the gladefile.
        # COMMAND is the actual program command
        # if no location is specified the main notebook is used

        tab_names = self.inifile.findall("DISPLAY", "EMBED_TAB_NAME")
        tab_location = self.inifile.findall("DISPLAY", "EMBED_TAB_LOCATION")
        tab_cmd = self.inifile.findall("DISPLAY", "EMBED_TAB_COMMAND")

        if len(tab_names) != len(tab_cmd):
            return False, False, False
        if len(tab_location) != len(tab_names):
            for num, i in enumerate(tab_names):
                try:
                    if tab_location[num]:
                        continue
                except:
                    tab_location.append("notebook_mode")
        return tab_names, tab_location, tab_cmd

Then they are processed separately.
Again Gmoccapy:
    def _init_dynamic_tabs(self):
        # dynamic tabs setup
        self._dynamic_childs = {}
        # register all tabs, so they will be closed together with the GUI
        atexit.register(self._kill_dynamic_childs)

        tab_names, tab_locations, tab_cmd = self.get_ini_info.get_embedded_tabs()
        if not tab_names:
            print (_("**** GMOCCAPY INFO ****"))
            print (_("**** Invalid embedded tab configuration ****"))
            print (_("**** No tabs will be added! ****"))
            return

        try:
            for t, c, name in zip(tab_names, tab_cmd, tab_locations):
                nb = self.widgets[name]
                xid = self._dynamic_tab(nb, t)
                if not xid: continue
                cmd = c.replace('{XID}', str(xid))
                child = subprocess.Popen(cmd.split())
                self._dynamic_childs[xid] = child
                nb.show_all()
        except:
            print(_("ERROR, trying to initialize the user tabs or panels, check for typos"))
        self.set_up_user_tab_widgets(tab_locations)

    # adds the embedded object to a notebook tab or box
    def _dynamic_tab(self, widget, text):
        s = gtk.Socket()
        try:
            widget.append_page(s, gtk.Label(" " + text + " "))
        except:
            try:
                widget.pack_end(s, True, True, 0)
            except:
                return None
        return s.get_id()

    # Gotta kill the embedded processes when gmoccapy closes
    def _kill_dynamic_childs(self):
        for child in list(self._dynamic_childs.values()):
            child.terminate()

Please Log in or Create an account to join the conversation.

More
20 Dec 2020 21:46 #192584 by cmorley
Replied by cmorley on topic QT_Vismach
Qtvcp uses the same process to build vismach then the Tk version does.
There is just a couple differences for embedding capability.

For standalone there is one import difference.

I see vismach can read STL files of some capacity.
If we can add the capability to read a common XML system that would be probably be useful - even if we don't supply the XML files because of legality.

More documentation I guess would be helpful.

Chris

Please Log in or Create an account to join the conversation.

More
21 Dec 2020 01:10 #192588 by cakeslob
Replied by cakeslob on topic QT_Vismach

Qtvcp uses the same process to build vismach then the Tk version does.
There is just a couple differences for embedding capability.

For standalone there is one import difference.

I see vismach can read STL files of some capacity.
If we can add the capability to read a common XML system that would be probably be useful - even if we don't supply the XML files because of legality.

More documentation I guess would be helpful.

Chris


so, something like the vcpparse.py and pyvcp but for vismach? cool. sorry, i didnt expect to be talking about it with anyone so I came unprepared initially. I found some links on the pocketnc website, so that should be kosher. the postprocessor they provide for mastercam also seems useful as it relates to linuxcnc, if anyone is interested.
pocketnc.com/pages/mastercam-information
the first link doesnt work, but this one has the files, its" v1 machine simulation"
cdn.shopify.com/s/files/1/0077/5477/6623...ineSim9-1-16.zip?992
this has all the stl files for the pocketnc model and the xml file for assembling it and the constraints

Warning: Spoiler!


a lot of it seems to be defining colour and stuff like reflective bitmap can be ignored, but the axis id and the transform values should be what we are looking for. it appears to build in the opposite direction is vismach, as to my understanding
, ill see if i can find some docs on the context of the xml file

AXIS only looks for one set of INI EMBED settings.
GMoccapy,Gscreen and Qtvcp allow many.
Here is the search code from GMoccapy:


ok, bear with my ignorance for a moment, if I just take those to definitions, and change them to relate to axis dynamic tabs and tkinter, would that do what we are looking for?

Please Log in or Create an account to join the conversation.

More
21 Dec 2020 10:57 #192619 by cmorley
Replied by cmorley on topic QT_Vismach

Qtvcp uses the same process to build vismach then the Tk version does.

AXIS only looks for one set of INI EMBED settings.
GMoccapy,Gscreen and Qtvcp allow many.
Here is the search code from GMoccapy:


ok, bear with my ignorance for a moment, if I just take those to definitions, and change them to relate to axis dynamic tabs and tkinter, would that do what we are looking for?


Those functions were based on the AXIS code, so shouldn't be too hard to convert back.

The main difference would be GMoccapy uses the actual name of the widget to embed into.
For AXIS, I think it would be better to pick some key words like LEFT, CENTER, RIGHT, BOTTOM.

Chris

Please Log in or Create an account to join the conversation.

Moderators: cmorley
Time to create page: 0.145 seconds
Powered by Kunena Forum