FlexPainter beta 0.34

Discussion forum for contributors and developers who are using the QCAD ECMAScript development platform or the C++ plugin interface or who are otherwise looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Post Reply
CVH
Premier Member
Posts: 156
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

FlexPainter beta 0.34

Post by CVH » Thu Sep 05, 2019 4:15 pm

Hello to you all,

Here goes nothing....

It started with an order of my old mentor in engraving.
He is retired and lives partially in Uganda these days.
The order was to make 14 badges as relation gift.

The first pic is the design I got from him, the second is what I proposed.
ESCU_Commodore.png
ESCU_Commodore.png (64.89 KiB) Viewed 381 times
ESCU_Commodore_v2.png
ESCU_Commodore_v2.png (32.47 KiB) Viewed 381 times
I followed a tube on how to flex the rope manually.
Drew 1 corner with Qcad and cloned it 3 times.

The badges are allready donated a while ago.
Engraving them was a whole other story.
Sharpest detail radius is 0.08mm in engavers brass.

But something kept me coming back to it.
As it was merely slicing the 'painter' and recasting it orthogonal on the bend.
A script could do that.
And it could do that with any 'painter' or lines, dots, ....
It is that versatility that drived me in coding it.

For now, the zip package is intended to be extracted to QCAD\scripts\Misc\Examples\MathExamples\
In there is a subfolder 'FlexPainterTemplates' with 2 dxf drawings.
A tutorial on how the painter is constructed, and one with a bunch of test cases.
On a win system they might beter be moved out of the protected OS portion.

Its stable and works exactly how it is intended.
I came to a point where I need some input of the community.
There is a lot of info inside the script file. Look also for 'ToDo' and 'Issue'.
A large remark block is at the end of the script.
These are not intended as a thousand questions in one post.
They are my guidlines to start asking questions or simply not to forget anything....

It might that the coding is horrible, not Java minded, nor Qcad minded, nor proper coded.
But you have to look at the potential far beyond casting a rope.
As I hate to be verbose the tool is persistent verbose.

I like to hear the others their opinion, and if any, about unknown issues.
In the long run I see it to be promoted out the experimental level.

On simple request I will redraw the proposition.

Kind regards,
CVH
Attachments
FlexPainter.zip
(95.19 KiB) Downloaded 14 times
Last edited by CVH on Mon Sep 09, 2019 10:05 am, edited 1 time in total.
QCAD 3.23.0.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

CVH
Premier Member
Posts: 156
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: FlexPainter beta 0.34

Post by CVH » Fri Sep 06, 2019 9:23 am

The script adds an entry to Misc| Script Examples | Mathematics | ..
The script mimics a roller stamp that travels along the selected base curve.

Pictures say more then words.
FlexPainterDialog.png
Command started with all selected.
FlexPainterDialog.png (111.66 KiB) Viewed 349 times
FlexPainterResult.png
Resulting castings
FlexPainterResult.png (133.96 KiB) Viewed 349 times
QCAD 3.23.0.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

User avatar
andrew
Site Admin
Posts: 6246
Joined: Fri Mar 30, 2007 6:07 am

Re: FlexPainter beta 0.34

Post by andrew » Fri Sep 06, 2019 9:36 am

This is truly impressive! It's like complex line types on steroids e_surprised

Can this be included in QCAD as an (impressive) example script? What are the licensing terms?
If so, how can I credit you in the about dialog? As CVH?

Thanks.

CVH
Premier Member
Posts: 156
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: FlexPainter beta 0.34

Post by CVH » Fri Sep 06, 2019 10:28 am

Thanks Andrew,
much appreciated coming from you.

Please read inside the script.

The math was simply cast left , cast right.
But then it evolved in several stages.
All curve-based
Nice endings.
Apexes.
Dynamically scaling to a closed form (without apexes)
The idee of insertions eg. a knot in this case.
Global casts along the base curve.
Margin crossing.

The FlexPainter having the flaws in steep curves is error-like but it is super realistic.
Twisting a roller stamp to much will smudge.
What about chain-like behaviour?!
Or common stamp like?

But that is all artistic stuff.
Its also a base for more thecnical stuff with a custom well defined painterset.
Repetitive texts if you like.
Splines through offsets at regular intervals.
......
Endless

Thanks, again
Kind regards,
CVH
QCAD 3.23.0.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

CVH
Premier Member
Posts: 156
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: FlexPainter beta 0.34

Post by CVH » Fri Sep 06, 2019 11:04 am

My first hurdle is SIZE.

To have a idea of the actual width....
I was thinking in the way CXF is standarized.
A non-limiting base height of 9 units.
4.5 up & 4.5 down.

Then we could work with actual dimensions instead of a scaler of something hardcoded.

But how will this work out on system or a document not in mm.
The hardcoded stamp is about 3mm high.
(10x actual size on the badges)
On a system in inches the same painter is 3 inch high.

We could keep units for units and only adapt the default scaling on first load to the system/document settings.
Metric then starts with eg. f2.5 and Inches with f 0.1 (same order as 0.09842519...)

Do you have an addressable parameter in scope that tells us what the document it's units are?
With this, I think I can test this route out and perhaps increase the user friendliness.
But that all depends on the yes & no of a circular value conflict.

Regards,
CVH
QCAD 3.23.0.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

User avatar
andrew
Site Admin
Posts: 6246
Joined: Fri Mar 30, 2007 6:07 am

Re: FlexPainter beta 0.34

Post by andrew » Fri Sep 06, 2019 1:24 pm

CVH wrote:
Fri Sep 06, 2019 11:04 am
My first hurdle is SIZE.
Yes, I think a standard size would probably be the easiest to implement.
CVH wrote:
Fri Sep 06, 2019 11:04 am
Do you have an addressable parameter in scope that tells us what the document it's units are?

Code: Select all

doc.getUnit()
This returns RS.Unit (RS.Millimeter, RS.Inch, etc.).

Class RUnit has some conversion tools:

Code: Select all

RUnit.convert(1.2, RS.Millimeter, RS.Inch);
to convert 1.2 from Millimeter to Inch.

CVH
Premier Member
Posts: 156
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: FlexPainter beta 0.34

Post by CVH » Fri Sep 06, 2019 1:52 pm

Will look into it.
CVH
QCAD 3.23.0.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

CVH
Premier Member
Posts: 156
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: FlexPainter beta 0.34

Post by CVH » Wed Sep 11, 2019 9:58 am

Andrew,
is there an 'easy' way to set a Dialog not modal.
Can't follow my script in debugger mode with the dialog displayed.

Tried to create a widget instead.

Code: Select all

WidgetFactory.createDialog(...)
vs.
WidgetFactory.createWidget(...)
Only found:

Code: Select all

progressDialog.windowModality = Qt.WindowModal;
ProgressBar.progressDialog.windowModality = Qt.ApplicationModal;
in the master scripts and nothing related to modal online.

Regards,
CVH
QCAD 3.23.0.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

CVH
Premier Member
Posts: 156
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: FlexPainter beta 0.34

Post by CVH » Fri Sep 13, 2019 9:01 am

CVH wrote:
Wed Sep 11, 2019 9:58 am
Can't follow my script in debugger mode with the dialog displayed.
This seems to be a MS Windows issue only.
QCAD 3.23.0.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

CVH
Premier Member
Posts: 156
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: FlexPainter beta 0.34

Post by CVH » Fri Sep 13, 2019 10:58 am

Andrew, all,

v0.36 now and a little stuck.

The painter width is now base9.
By this the user can choose the actual width.
And it was also possible to let the actual painter length and stepsize to be set individually.
PreserveLook overrides these two and revert back to base9 times a factor dictated by the unchanged width.
On first load reasonable defaults are set.
(Still not sure how to handle doc changes)

On PainterSet change two values are needed: the base9 painter length & the base9 painter stepsize.
These are set by a function FlexPainter.prototype.PainterSetInit(painterSet) part of Flexpainter.js script.

With inserting a multitude of 'debuggers;' and canceling the Dialog every time,
I still could evaluate one widget dialog change functions at a time before the dialog itself terminates.

I'm stuck on the fact that when the on change functions run the data is out off scope.
(This is starting to begin to be the story off my Qcad experience) :oops:

I've looked up the use of '.connect' in the master scripts and tried some things out.
I don't get further then declaring copies in the FlexPainter.prototype.initWidgets function.
After declaring they remain static and don't reflect the PainterSet change.

As an on change functions runs the flexpainter functions are also out off scope.
Can't find a way to run the FlexPainter.prototype.PainterSetInit(painterSet) function.

Is there a proper way so: :?:
On PainterSet change my data storage reflect the change?
The on change functions have access to that data?

I don't include the new sources because they are corrupt without a solution.
I can PM them for evaluation as long as the dialog is cancelled.

Any help appreciated,
CVH
QCAD 3.23.0.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

User avatar
andrew
Site Admin
Posts: 6246
Joined: Fri Mar 30, 2007 6:07 am

Re: FlexPainter beta 0.34

Post by andrew » Fri Sep 13, 2019 1:34 pm

I tend to use qDebug("..."); rather than debugger statements, especially with dialogs. The debugger can change the order in which events are processed and even lead to crashes. Feel free to PM the sources and I will have a look. That would have to wait till next week though.

CVH
Premier Member
Posts: 156
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: FlexPainter beta 0.34

Post by CVH » Fri Sep 13, 2019 2:13 pm

I'll first try to get a version running stable with a 'fixed' actual painterset selection.
Handy, when it not crashes on its own.

I've seen the qDebug throughout the project.
And this link:
https://www.ribbonsoft.com/rsforum/viewtopic.php?t=2872

I suppose the qDebug("..."); is shown in the Debug output tab of the Qt debugger.
When first activated by a 'debugger;' command!?

Regards,
QCAD 3.23.0.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

CVH
Premier Member
Posts: 156
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: FlexPainter beta 0.34

Post by CVH » Thu Sep 19, 2019 9:09 am

QCAD 3.23.0.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

Post Reply

Return to “QCAD Developers and Contributors”