QT C++ graphics display WIDGET
- udoS
- Offline
- Elite Member
Less
More
- Posts: 216
- Thank you received: 25
19 Oct 2021 07:20 #223525
by udoS
Replied by udoS on topic QT C++ graphics display WIDGET
yes it's a nml issue.
I made a new nml alongside the app. That works, so I'm OK.
I'm trying to hook the whole freecad into the the app or at least the part where I can use it as a shop-floor cad.
Just facing, pockets,drilling, pattern. You could make an interface to there planer: You could do that.
Do you know by now how to cut material away fast enough to keep up with the speed of the cnc without jocking.
Could voxels do that.
Best regards.
I made a new nml alongside the app. That works, so I'm OK.
I'm trying to hook the whole freecad into the the app or at least the part where I can use it as a shop-floor cad.
Just facing, pockets,drilling, pattern. You could make an interface to there planer: You could do that.
Do you know by now how to cut material away fast enough to keep up with the speed of the cnc without jocking.
Could voxels do that.
Best regards.
Please Log in or Create an account to join the conversation.
- udoS
- Offline
- Elite Member
Less
More
- Posts: 216
- Thank you received: 25
19 Oct 2021 20:30 #223591
by udoS
Replied by udoS on topic QT C++ graphics display WIDGET
Have you seen this effect with the qt_occ screen ?
The little image in the lower left corner.
The little image in the lower left corner.
Please Log in or Create an account to join the conversation.
- Grotius
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 2244
- Thank you received: 1984
23 Oct 2021 19:57 #224026
by Grotius
Replied by Grotius on topic QT C++ graphics display WIDGET
Hi Udo,
I'm trying to hook the whole freecad into the the app or at least the part where I can use it as a shop-floor cad.
Just facing, pockets,drilling, pattern. You could make an interface to there planer: You could do that.
Yes, that could be done. I have been thinking to build a autocad clone. I think i can do that.
But coming time i spent some time finalizing a cnc machine interface program called "hal-core".
Have you seen this effect with the qt_occ screen ?
I don't know why you are asking this. Gradient and shades can be drawn with opencascade. It could also be
showing a failure.
I'm trying to hook the whole freecad into the the app or at least the part where I can use it as a shop-floor cad.
Just facing, pockets,drilling, pattern. You could make an interface to there planer: You could do that.
Yes, that could be done. I have been thinking to build a autocad clone. I think i can do that.
But coming time i spent some time finalizing a cnc machine interface program called "hal-core".
Have you seen this effect with the qt_occ screen ?
I don't know why you are asking this. Gradient and shades can be drawn with opencascade. It could also be
showing a failure.
Please Log in or Create an account to join the conversation.
- udoS
- Offline
- Elite Member
Less
More
- Posts: 216
- Thank you received: 25
23 Oct 2021 21:19 #224033
by udoS
Replied by udoS on topic QT C++ graphics display WIDGET
sorry- more accurat.
I think that background window is showing up with that little image in the lower left corner.
That little image expands as soon as I resize the window. ( occQt-sample ).
The error is " Window Visual is incomplete: no depth buffer, no stencil buffer."
I was trying to build a absolut minimum occ window into that tab. No luck so far.
One more question: for how long did you have the graphics-Widget running at any given time.
As soon as I start to update the values, it's eating up memory and then eventually crashes. HTOP.
I think that background window is showing up with that little image in the lower left corner.
That little image expands as soon as I resize the window. ( occQt-sample ).
The error is " Window Visual is incomplete: no depth buffer, no stencil buffer."
I was trying to build a absolut minimum occ window into that tab. No luck so far.
One more question: for how long did you have the graphics-Widget running at any given time.
As soon as I start to update the values, it's eating up memory and then eventually crashes. HTOP.
Please Log in or Create an account to join the conversation.
- Grotius
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 2244
- Thank you received: 1984
24 Oct 2021 10:07 #224080
by Grotius
Replied by Grotius on topic QT C++ graphics display WIDGET
Hi,
In the c++ examples you can see how the occ window is initialized only once it's loaded. This is done to set the screensize etc.
github.com/grotius-cnc/universal_graphic...t/releases/tag/1.0.0
As soon as I start to update the values, it's eating up memory and then eventually crashes. HTOP.
Hi, i suspect you are creating multiple nml instances ("nml=new nml" ) over a period of time until it crashes.
In the above archive there is a nml example.
In the c++ examples you can see how the occ window is initialized only once it's loaded. This is done to set the screensize etc.
github.com/grotius-cnc/universal_graphic...t/releases/tag/1.0.0
As soon as I start to update the values, it's eating up memory and then eventually crashes. HTOP.
Hi, i suspect you are creating multiple nml instances ("nml=new nml" ) over a period of time until it crashes.
In the above archive there is a nml example.
Please Log in or Create an account to join the conversation.
- udoS
- Offline
- Elite Member
Less
More
- Posts: 216
- Thank you received: 25
29 Nov 2021 18:54 #227937
by udoS
Replied by udoS on topic QT C++ graphics display WIDGET
@Grotius
Hi Mr Grotius
I was looking at your git-repo Hal-view.
I was wondering if I could implement it into my GUI. Looks like a nice fit.
Best regards.
Hi Mr Grotius
I was looking at your git-repo Hal-view.
I was wondering if I could implement it into my GUI. Looks like a nice fit.
Best regards.
Please Log in or Create an account to join the conversation.
- Grotius
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 2244
- Thank you received: 1984
29 Nov 2021 23:46 - 29 Nov 2021 23:51 #227958
by Grotius
Replied by Grotius on topic QT C++ graphics display WIDGET
Hi Udo,
I lost the source code. Ai. Only the executables are left over on the internet.
It's done like below code example.
Below example request's a actual component time wich can be divided trough the servo-thread time.
The result is the actual servo-load in %. The servo load is displayed on a label in the picture below.
Header example:
source file example :
I lost the source code. Ai. Only the executables are left over on the internet.
It's done like below code example.
Below example request's a actual component time wich can be divided trough the servo-thread time.
The result is the actual servo-load in %. The servo load is displayed on a label in the picture below.
Header example:
Warning: Spoiler!
#ifndef HAL_INTERFACE_H
#define HAL_INTERFACE_H
#ifndef ULAPI
#define ULAPI
#endif
#include "/opt/hal-core/src/hal/hal.h"
#include "/opt/hal-core/src/hal/hal_priv.h"
#include "iostream"
//! Hal float pin in-out
typedef struct {
hal_float_t *Pin;
} float_data_t;
//! Hal bool pin in-out
typedef struct {
hal_bit_t *Pin;
} bit_data_t;
//! Int pin in-out
typedef struct {
hal_s32_t *Pin;
} s32_data_t;
//! Unsigned int pin in-out
typedef struct {
hal_u32_t *Pin;
} u32_data_t;
//! Char array port in-out
typedef struct {
hal_port_t *Pin;
} port_data_t;
//! Parameter pin rw float
typedef struct {
hal_float_t Pin;
} param_float_data_t;
//! Parameter pin rw bool
typedef struct {
hal_bit_t Pin;
} param_bit_data_t;
class hal_interface
{
public:
hal_interface();
~hal_interface();
void get_info();
double print_matrix_time();
};
#endif // HAL_INTERFACE_H
#define HAL_INTERFACE_H
#ifndef ULAPI
#define ULAPI
#endif
#include "/opt/hal-core/src/hal/hal.h"
#include "/opt/hal-core/src/hal/hal_priv.h"
#include "iostream"
//! Hal float pin in-out
typedef struct {
hal_float_t *Pin;
} float_data_t;
//! Hal bool pin in-out
typedef struct {
hal_bit_t *Pin;
} bit_data_t;
//! Int pin in-out
typedef struct {
hal_s32_t *Pin;
} s32_data_t;
//! Unsigned int pin in-out
typedef struct {
hal_u32_t *Pin;
} u32_data_t;
//! Char array port in-out
typedef struct {
hal_port_t *Pin;
} port_data_t;
//! Parameter pin rw float
typedef struct {
hal_float_t Pin;
} param_float_data_t;
//! Parameter pin rw bool
typedef struct {
hal_bit_t Pin;
} param_bit_data_t;
class hal_interface
{
public:
hal_interface();
~hal_interface();
void get_info();
double print_matrix_time();
};
#endif // HAL_INTERFACE_H
source file example :
Warning: Spoiler!
#include "hal_interface.h"
int comp_idxx;
typedef struct {
bool ok;
} skynet_t;
skynet_t *omicronx;
hal_interface::hal_interface()
{
}
hal_interface::~hal_interface()
{
}
double hal_interface::print_matrix_time(){
/*
if (halpr_find_comp_by_name("matrix") != 0) {
std::cout << "matrix found!" << std::endl;
}
if (halpr_find_param_by_name("matrix.tmax") != 0) {
std::cout << "matrix.time found!" << std::endl;
}*/
//! Get parameter value example
/*
hal_param_t *param;
hal_type_t type;
void *d_ptr;
param = halpr_find_param_by_name("matrix.tmax");
if (param) {
type = param->type;
d_ptr = SHMPTR(param->data_ptr);
static char buf[15];
snprintf(buf, 14, "%ld", (long)*((hal_s32_t *) d_ptr));
std::cout<<"value:"<<buf<<std::endl;
}*/
//! Get pin value example
/*
if (halpr_find_pin_by_name("matrix.time") != 0) {
std::cout << "matrix.time found!" << std::endl;
} */
hal_data_u *value;
hal_type_t type;
bool *con = nullptr;
int r=hal_get_pin_value_by_name("matrix.time",&type,&value,con);
if(r!=0){
std::cout<<"error from /libhal/hal_interface function"<<std::endl;
}
// std::cout << "matrix.time function result:"<<ok<< std::endl;
// std::cout << "matrix.time function result:"<<value->s<< std::endl;
return value->s;
}
void hal_interface::get_info(){
comp_idxx = hal_init("gui");
int error = hal_ready(comp_idxx);
if(error==0){
std::cout << "gui component ok" << std::endl;
} else {
std::cout << "gui component error" << std::endl;
}
}
int comp_idxx;
typedef struct {
bool ok;
} skynet_t;
skynet_t *omicronx;
hal_interface::hal_interface()
{
}
hal_interface::~hal_interface()
{
}
double hal_interface::print_matrix_time(){
/*
if (halpr_find_comp_by_name("matrix") != 0) {
std::cout << "matrix found!" << std::endl;
}
if (halpr_find_param_by_name("matrix.tmax") != 0) {
std::cout << "matrix.time found!" << std::endl;
}*/
//! Get parameter value example
/*
hal_param_t *param;
hal_type_t type;
void *d_ptr;
param = halpr_find_param_by_name("matrix.tmax");
if (param) {
type = param->type;
d_ptr = SHMPTR(param->data_ptr);
static char buf[15];
snprintf(buf, 14, "%ld", (long)*((hal_s32_t *) d_ptr));
std::cout<<"value:"<<buf<<std::endl;
}*/
//! Get pin value example
/*
if (halpr_find_pin_by_name("matrix.time") != 0) {
std::cout << "matrix.time found!" << std::endl;
} */
hal_data_u *value;
hal_type_t type;
bool *con = nullptr;
int r=hal_get_pin_value_by_name("matrix.time",&type,&value,con);
if(r!=0){
std::cout<<"error from /libhal/hal_interface function"<<std::endl;
}
// std::cout << "matrix.time function result:"<<ok<< std::endl;
// std::cout << "matrix.time function result:"<<value->s<< std::endl;
return value->s;
}
void hal_interface::get_info(){
comp_idxx = hal_init("gui");
int error = hal_ready(comp_idxx);
if(error==0){
std::cout << "gui component ok" << std::endl;
} else {
std::cout << "gui component error" << std::endl;
}
}
Last edit: 29 Nov 2021 23:51 by Grotius.
Please Log in or Create an account to join the conversation.
- udoS
- Offline
- Elite Member
Less
More
- Posts: 216
- Thank you received: 25
25 Dec 2021 12:16 #229956
by udoS
Replied by udoS on topic QT C++ graphics display WIDGET
@Grotius
Hi Grotius
I'm still at your graphics-widget.
At present I try to implement a path-view.
The problem I have is that I get a real big amount of edges/wires to display.
If I use your g-code sample with a update rate of 50msec that piles up to some 20.000 chunks.
Here is the Code;
void Opencascade::drawTestPath3D(QVariant data)
{
QStringList list=data.toStringList();
double x = list.at(0).toDouble();
double y = list.at(1).toDouble();
double z = list.at(2).toDouble();
int g = list.at(3).toInt();
//**Get a new Point in 3D-Space at actual location *************
gp_Pnt aTestPoint_p2{x, y, z};
//double l= sqrt(pow(pathPoint_p2.X()-pathPoint_p1.X(),2)+pow(pathPoint_p2.Y()-pathPoint_p1.Y(),2)+pow(pathPoint_p2.Z()-pathPoint_p1.Z(),2));
TopoDS_Edge aTopoDSEdgeShape;
// make an edge;
if((aTestPoint_p2.X() != aTestPoint_p1.X()) ||
(aTestPoint_p2.Y() != aTestPoint_p1.Y()) ||
(aTestPoint_p2.Z() != aTestPoint_p1.Z()))
{
aTopoDSEdgeShape = BRepBuilderAPI_MakeEdge(aTestPoint_p1,aTestPoint_p2);
if( g == 0 )
{
BRepBuilderAPI_MakeWire mkTestWire_G0;
mkTestWire_G0.Add(aTopoDSEdgeShape);
TopoDS_Wire myTestWire_TopoDS_Shape_G0 = mkTestWire_G0.Wire();
BRepLib::BuildCurves3d(myTestWire_TopoDS_Shape_G0);
//Handle(AIS_Shape) aTestEdge_Ais_Shape = new AIS_Shape(aTestEdge_TopoDS_Shape);
//m_context->Remove(myTestWire_Ais_Shape_G0, Standard_False);
Handle(AIS_Shape) myTestWire_Ais_Shape_G0 = new AIS_Shape(myTestWire_TopoDS_Shape_G0);
myTestWire_Ais_Shape_G0->SetColor(Quantity_NOC_YELLOW);
//aTestEdge_Ais_Shape->SetColor(Quantity_NOC_BLUE);
//m_context->Display(aTestEdge_Ais_Shape, Standard_False);
p_context->Display(myTestWire_Ais_Shape_G0, Standard_False);
BRepTools::Write (myTestWire_TopoDS_Shape_G0,"/home/udos/Downloads/myTestWire.txt");
aTestPoint_p1 = aTestPoint_p2;
}
if( g != 0 )
{
BRepBuilderAPI_MakeWire mkTestWire_G1;
mkTestWire_G1.Add(aTopoDSEdgeShape);
TopoDS_Wire myTestWire_TopoDS_Shape_G1 = mkTestWire_G1.Wire();
BRepLib::BuildCurves3d(myTestWire_TopoDS_Shape_G1);
//Handle(AIS_Shape) aTestEdge_Ais_Shape = new AIS_Shape(aTestEdge_TopoDS_Shape);
//m_context->Remove(myTestWire_Ais_Shape_G1, Standard_False);
myTestWire_Ais_Shape_G1 = new AIS_Shape(myTestWire_TopoDS_Shape_G1);
myTestWire_Ais_Shape_G1->SetColor(Quantity_NOC_BLUE);
//aTestEdge_Ais_Shape->SetColor(Quantity_NOC_BLUE);
//m_context->Display(aTestEdge_Ais_Shape, Standard_False);
p_context->Display(myTestWire_Ais_Shape_G1, Standard_False);
aTestPoint_p1 = aTestPoint_p2;
}
}
}
Hi Grotius
I'm still at your graphics-widget.
At present I try to implement a path-view.
The problem I have is that I get a real big amount of edges/wires to display.
If I use your g-code sample with a update rate of 50msec that piles up to some 20.000 chunks.
Here is the Code;
void Opencascade::drawTestPath3D(QVariant data)
{
QStringList list=data.toStringList();
double x = list.at(0).toDouble();
double y = list.at(1).toDouble();
double z = list.at(2).toDouble();
int g = list.at(3).toInt();
//**Get a new Point in 3D-Space at actual location *************
gp_Pnt aTestPoint_p2{x, y, z};
//double l= sqrt(pow(pathPoint_p2.X()-pathPoint_p1.X(),2)+pow(pathPoint_p2.Y()-pathPoint_p1.Y(),2)+pow(pathPoint_p2.Z()-pathPoint_p1.Z(),2));
TopoDS_Edge aTopoDSEdgeShape;
// make an edge;
if((aTestPoint_p2.X() != aTestPoint_p1.X()) ||
(aTestPoint_p2.Y() != aTestPoint_p1.Y()) ||
(aTestPoint_p2.Z() != aTestPoint_p1.Z()))
{
aTopoDSEdgeShape = BRepBuilderAPI_MakeEdge(aTestPoint_p1,aTestPoint_p2);
if( g == 0 )
{
BRepBuilderAPI_MakeWire mkTestWire_G0;
mkTestWire_G0.Add(aTopoDSEdgeShape);
TopoDS_Wire myTestWire_TopoDS_Shape_G0 = mkTestWire_G0.Wire();
BRepLib::BuildCurves3d(myTestWire_TopoDS_Shape_G0);
//Handle(AIS_Shape) aTestEdge_Ais_Shape = new AIS_Shape(aTestEdge_TopoDS_Shape);
//m_context->Remove(myTestWire_Ais_Shape_G0, Standard_False);
Handle(AIS_Shape) myTestWire_Ais_Shape_G0 = new AIS_Shape(myTestWire_TopoDS_Shape_G0);
myTestWire_Ais_Shape_G0->SetColor(Quantity_NOC_YELLOW);
//aTestEdge_Ais_Shape->SetColor(Quantity_NOC_BLUE);
//m_context->Display(aTestEdge_Ais_Shape, Standard_False);
p_context->Display(myTestWire_Ais_Shape_G0, Standard_False);
BRepTools::Write (myTestWire_TopoDS_Shape_G0,"/home/udos/Downloads/myTestWire.txt");
aTestPoint_p1 = aTestPoint_p2;
}
if( g != 0 )
{
BRepBuilderAPI_MakeWire mkTestWire_G1;
mkTestWire_G1.Add(aTopoDSEdgeShape);
TopoDS_Wire myTestWire_TopoDS_Shape_G1 = mkTestWire_G1.Wire();
BRepLib::BuildCurves3d(myTestWire_TopoDS_Shape_G1);
//Handle(AIS_Shape) aTestEdge_Ais_Shape = new AIS_Shape(aTestEdge_TopoDS_Shape);
//m_context->Remove(myTestWire_Ais_Shape_G1, Standard_False);
myTestWire_Ais_Shape_G1 = new AIS_Shape(myTestWire_TopoDS_Shape_G1);
myTestWire_Ais_Shape_G1->SetColor(Quantity_NOC_BLUE);
//aTestEdge_Ais_Shape->SetColor(Quantity_NOC_BLUE);
//m_context->Display(aTestEdge_Ais_Shape, Standard_False);
p_context->Display(myTestWire_Ais_Shape_G1, Standard_False);
aTestPoint_p1 = aTestPoint_p2;
}
}
}
Please Log in or Create an account to join the conversation.
- Grotius
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 2244
- Thank you received: 1984
26 Dec 2021 23:54 #230035
by Grotius
Replied by Grotius on topic QT C++ graphics display WIDGET
Hi Udo,
Is the problem to display 20.000 lines of gcode with opencascade ?
Running out of memory?
Is the problem to display 20.000 lines of gcode with opencascade ?
Running out of memory?
Please Log in or Create an account to join the conversation.
- udoS
- Offline
- Elite Member
Less
More
- Posts: 216
- Thank you received: 25
27 Dec 2021 09:31 - 27 Dec 2021 09:34 #230052
by udoS
Replied by udoS on topic QT C++ graphics display WIDGET
@Grotius
Hi Grotius. Thanks for reply.
No, it is not. The total comes to about 15-20M for your example. The problem is the Redraw() of the context.
As more edges/wires I get, the longer it takes to Redraw.
/// Pushback for Path *********************************************************
QStringList path;
path.push_back(QString::number(xAxisPosAbsACT));
path.push_back(QString::number(yAxisPosAbsACT));
path.push_back(QString::number(zAxisPosAbsACT));
path.push_back(G_Mode);
occ->drawTestPath3D(path);
occ->Redraw();
Thanks again for looking at it.
Hi Grotius. Thanks for reply.
No, it is not. The total comes to about 15-20M for your example. The problem is the Redraw() of the context.
As more edges/wires I get, the longer it takes to Redraw.
/// Pushback for Path *********************************************************
QStringList path;
path.push_back(QString::number(xAxisPosAbsACT));
path.push_back(QString::number(yAxisPosAbsACT));
path.push_back(QString::number(zAxisPosAbsACT));
path.push_back(G_Mode);
occ->drawTestPath3D(path);
occ->Redraw();
Thanks again for looking at it.
Last edit: 27 Dec 2021 09:34 by udoS.
Please Log in or Create an account to join the conversation.
Time to create page: 0.088 seconds