[QtDragon] Simple vismach window

More
05 Mar 2022 01:11 - 05 Mar 2022 01:32 #236387 by RomeReactor
Hi all. We're trying to create a very simple vismach configuration to run in qt dragon following this documentation , but it just displays an empty window with sliders to the left, apparently to control the viewport. The vismach config file is attached. Any ideas?

#!/usr/bin/python3

from qt_vismach import *
import hal
import math
import sys

c = hal.component("vm_test")
c.newpin("joint0", hal.HAL_FLOAT, hal.HAL_IN)
c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN)
c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN)
c.ready()

ram = CylinderZ(50.0, 50.0, 100.0, 50.0)
ram = Color([1,1,1,1],[ram])
ram = Translate([ram], 0.0, 0.0, -35.0)
ram = HalTranslate([ram], c, "joint2", 0.0, 0.0, 1.0)

table = BoxCenteredXY(0.0, 150.0, 15.0)
table = Color([2,2,2,2],[table])
table = Translate([table], 0.0, 0.0, 0.0)
table = HalTranslate([table], c, "joint1", 1.0, 0.0, 0.0)

ram = Capture()
table = Capture()
model = Collection ([ram, table])

main(model, ram, table, size=1000, hud=1, rotation_vectors=None, lat=0, lon=0)
Attachments:
Last edit: 05 Mar 2022 01:32 by RomeReactor. Reason: Added details.

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

More
05 Mar 2022 04:20 #236390 by cmorley
Those docs while relevant and helpful are for the tkinter version of vismach that is not embeddable in a gui (if that is what you wish to do)

There currently is no docs for qt_vismach that I can find, but there are a couple sample panels.

in a terminal try:
qtvcp vismach_mill_xyz
qtvcp vismach_scara

here is the relevant file for mill_xyz
Attachments:

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

More
06 Mar 2022 02:03 - 06 Mar 2022 02:04 #236472 by cmorley
Here is a folder with code based on your file.
unzip somewhere then if you write the following in a terminal it should display.
(cd to the directory that the file is in first)
qtvcp vismach_vm_test

you probably need to update to the latest master code (Are you using a compiled version?)
This version of the code still uses the HAL pins from the component defined in the vm_test.py file.
I also added some more docs to master, that hopefully helps.
probably more needed.
Attachments:
Last edit: 06 Mar 2022 02:04 by cmorley.

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

More
11 Mar 2022 20:30 #236956 by RomeReactor
hello cmorley, So far so good with the creation of my vismach, I proceeded to import my script but the following error has occurred in the handler when I try to execute the qtdragon, do you know why?

qtdragon_handler.py", line 165, in __ initialized
self.w.mainLayout.addWidget(machine)
AttributeError: object 'VCPWindow' does not have attribute 'mainLayout'

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

More
11 Mar 2022 20:38 #236957 by cmorley
I's need more info.
How did you try to load it in qtdragon?

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

More
12 Mar 2022 00:39 #236968 by RomeReactor
Hi cmorley. The previous answer was in relation to your previous post about where you uploaded a modified version of my file.

On a semi-unrelated note, we found this post (www.forum.linuxcnc.org/qtvcp/43377-import-tk-vismach-to-qtvcp) where annhandt09 managed to embed the scara tk vismach into qt_dragon. We can't seem to figure out what to replace "self.w.xxxx.addWidget(machine)" with. Any help?

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

More
12 Mar 2022 01:13 #236970 by cmorley
I don't see anywhere that I gave code to load vismach into qrdragon.
I did show how to load vismach using qtvcp into a qtvcp vcp panel.

qtdragon was not coded with thoughts to add user tabs easily.
It can be done but requires you to use custom qtdragon.ui and qtdragon_handler.py files.

Before I delve into that, I would like to confirm that the qtvcp panel works.

The scara example is included already as a qtvcp panel.

in a terminal:
qtvcp vismach_scara

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

More
12 Mar 2022 01:30 #236972 by cmorley
guessing that you already figured out how to modify qtdragon's handler.
The problem is that you are trying to place the vismach widget into a widget in qtdragon that does not exist. try this:

self.w.horizontalLayout_3.addWidget(machine)

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

More
12 Mar 2022 01:33 #236973 by RomeReactor
Thanks for the reply.
[ćode]
qtvcp vismach_scara
[/code]

does work in terminal.

On the post I linked, annhandt09 seemed to be able to embed vsmach in qtdragon (see attached picture). 
Attachments:

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

More
12 Mar 2022 01:55 #236974 by RomeReactor
Thanks for your last reply. Embedding worked with:
import press_brake as MILL
and:
machine = MILL.Window()
self.w.horizontalLayout_3.addWidget(machine)

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

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