Problem with di.applyOperation (op);

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

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
pietro_72_
Full Member
Posts: 81
Joined: Fri Apr 17, 2015 6:40 am
Location: http://creativitainformaticart.altervista.org

Problem with di.applyOperation (op);

Post by pietro_72_ » Thu Jan 02, 2020 6:36 pm

Hello
I have a problem with di.applyOperation (op); in row 1161
QCAD turns off, I tried to insert it at various points in the code, but QCAD keeps turning off, just commenting it doesn't turn off.

I attach files
http://creativitainformaticart.altervis ... :49:43.mp4
Attachments
OrthogonalProjections.js
(85.14 KiB) Downloaded 554 times

CVH
Premier Member
Posts: 3467
Joined: Wed Sep 27, 2017 4:17 pm

Re: Problem with di.applyOperation (op);

Post by CVH » Thu Jan 02, 2020 7:03 pm

Are you adding a RModifyObjectsOperation?
Or
Are you adding a new Object?

Or are you trying to do both in one go.

Then I think you have to preset the property of the object.
And add a RAddObjectsOperation.

Wild guess.
Regards,
CVH

pietro_72_
Full Member
Posts: 81
Joined: Fri Apr 17, 2015 6:40 am
Location: http://creativitainformaticart.altervista.org

Re: Problem with di.applyOperation (op);

Post by pietro_72_ » Thu Jan 02, 2020 9:16 pm

Thanks, I also tried with RAddObjectsOperation, it continues to give me the same problem

CVH
Premier Member
Posts: 3467
Joined: Wed Sep 27, 2017 4:17 pm

Re: Problem with di.applyOperation (op);

Post by CVH » Thu Jan 02, 2020 9:20 pm

What is the error while in debugger mode?

CVH

pietro_72_
Full Member
Posts: 81
Joined: Fri Apr 17, 2015 6:40 am
Location: http://creativitainformaticart.altervista.org

Re: Problem with di.applyOperation (op);

Post by pietro_72_ » Thu Jan 02, 2020 9:35 pm

I can't use the debugger mode, if QCAD shuts down before I get to my script:
viewtopic.php?f=30&t=6810

pietro_72_
Full Member
Posts: 81
Joined: Fri Apr 17, 2015 6:40 am
Location: http://creativitainformaticart.altervista.org

Re: Problem with di.applyOperation (op);

Post by pietro_72_ » Thu Jan 02, 2020 10:03 pm

Running QCAD from Terminal you can see these messages:
Attachments
Istantanea_2020-01-02_22-02-42.png
Istantanea_2020-01-02_22-02-42.png (212.84 KiB) Viewed 12831 times

CVH
Premier Member
Posts: 3467
Joined: Wed Sep 27, 2017 4:17 pm

Re: Problem with di.applyOperation (op);

Post by CVH » Thu Jan 02, 2020 10:47 pm

pietro_72_ wrote:
Thu Jan 02, 2020 9:35 pm
I can't use the debugger mode, if QCAD shuts down before I get to my script:
viewtopic.php?f=30&t=6810
That are 2 include exceptions for the same CAM script.
Qcad is still gathering its addons...
Meaning your code did not run yet.

Qcad can't locate LayerDialogPro.js

Could be a bad includeBasePath, an init that did not run ....
Or .... missing somewhere one bracket ([{ }]), a semicolon ....

Apart from that:
This is nothing you can fix with placing a copy of that script under scripts.
Its PRO and not released on GIT.

I supose you don't use that.
Try without CAM.
If that doesn't fail then you need a clean install I presume.

BTW, your code looks much neater now... :)

CVH

pietro_72_
Full Member
Posts: 81
Joined: Fri Apr 17, 2015 6:40 am
Location: http://creativitainformaticart.altervista.org

Re: Problem with di.applyOperation (op);

Post by pietro_72_ » Thu Jan 02, 2020 11:33 pm

ok I will try, I will use and text my program On QCAD / CAM that I purchased some time ago, meanwhile thanks, I thought, if possible, that I could make sure that your FlexPainter program allows users to create arbitrary forms to follow path :) , or already does it?

CVH
Premier Member
Posts: 3467
Joined: Wed Sep 27, 2017 4:17 pm

Re: Problem with di.applyOperation (op);

Post by CVH » Fri Jan 03, 2020 12:21 am

pietro_72_ wrote:
Thu Jan 02, 2020 11:33 pm
I thought, if possible, that I could make sure that your FlexPainter program allows users to create arbitrary forms to follow path
I get what you mean by that.

Reply see:
https://qcad.org/rsforum/viewtopic.php?t=6857#p26113

Regards,
CVH

pietro_72_
Full Member
Posts: 81
Joined: Fri Apr 17, 2015 6:40 am
Location: http://creativitainformaticart.altervista.org

Re: Problem with di.applyOperation (op);

Post by pietro_72_ » Fri Jan 03, 2020 1:08 am

My program also appears to work on the Community Edition, but it continues to give me the same problem

Ok
Hi, good night and good job
Attachments
ParallelLines.zip
(10.9 KiB) Downloaded 568 times
OrthogonalProjections.zip
(52.45 KiB) Downloaded 555 times
Istantanea_2020-01-03_00-59-03.png
Istantanea_2020-01-03_00-59-03.png (290.83 KiB) Viewed 12812 times

CVH
Premier Member
Posts: 3467
Joined: Wed Sep 27, 2017 4:17 pm

Re: Problem with di.applyOperation (op);

Post by CVH » Fri Jan 03, 2020 1:20 am

I see,
Same problem with the debugger too?

CVH

pietro_72_
Full Member
Posts: 81
Joined: Fri Apr 17, 2015 6:40 am
Location: http://creativitainformaticart.altervista.org

Re: Problem with di.applyOperation (op);

Post by pietro_72_ » Fri Jan 03, 2020 1:33 am

Yes

CVH
Premier Member
Posts: 3467
Joined: Wed Sep 27, 2017 4:17 pm

Re: Problem with di.applyOperation (op);

Post by CVH » Fri Jan 03, 2020 1:20 pm

pietro_72_ wrote:
Thu Jan 02, 2020 6:36 pm
I have a problem with di.applyOperation (op); in row 1161
Got something similar...
And maybe a solution...

I was altering Explode.js to interpolation...
After a few edits I needed to do a lot of heavy type banging.
Been busy since... since... before christmas actually...

Entities, Shapes, Objects, QSharedPointer, New RxxxEntities ......
Entities from data, data from entities ......
(eg.: entity.getData().castToShape() or shape = shapes[k].data();)
Then its a function, then it is not.
Then its an array.
Then its a Qlist, what isn't an array per se.
In the debugger an array top is voided, a Qlist shows a copy of the first item.
........ :roll:
Or there is even nothing readable about an item in the In the debugger.
Expanding the item in interest may lead to a crach from the debugger.
Hovering over the vars works safer....untill you hover and get a black screen. :shock:

I can not grasp the differences, nor is there something written about it to be found.
It is probably pritty simple and logic once you see the trees in the wood.

My method: Trial and error .... in this case type banging :oops:
Banging untill its accepted.

Maybe this will help a bit:

Explode.js
Explode.explodeSelection = function(di, toolTitle)
section:

Code: Select all

// add explosion result and delete original:
if it is an entity its simple added:

Code: Select all

if (isEntity(news[k])) {
var newEntity = news[k];
op.addObject(newEntity, false, true);
Ifnot it is first cast to an entity:

Code: Select all

else {
var newShape = news[k];
e = shapeToEntity(entity.getDocument(), newShape);
op.addObject(e, false);
Here 'entity.getDocument()' refers to the document where the original entity originated from.
In your case that's obvious.

Regards,
CVH

pietro_72_
Full Member
Posts: 81
Joined: Fri Apr 17, 2015 6:40 am
Location: http://creativitainformaticart.altervista.org

Re: Problem with di.applyOperation (op);

Post by pietro_72_ » Sun Jan 05, 2020 3:16 pm

I solved taking inspiration from this post by Andrew:
viewtopic.php?f=30&t=6651&p=25120&hilit ... ion#p25120

modifying the for loop as seen in line 1154
Attachments
OrthogonalProjections.js
(85.83 KiB) Downloaded 561 times

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”