[Solved] What's Going On With This Preview

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
333onlyhalfevil
Full Member
Posts: 92
Joined: Fri Apr 28, 2023 12:39 pm

[Solved] What's Going On With This Preview

Post by 333onlyhalfevil » Thu Mar 20, 2025 7:28 am

Hello everyone.

One of my scripts switched out my getOperation() preview with what is shown in the attached image. I'm assuming it is because the operation has too many entities. Is that correct or is there some other reason it would be doing this? Also, is there a way to override this for faster computers?

Thank you.
Attachments
preview.jpg
preview.jpg (36.29 KiB) Viewed 52328 times
Last edited by 333onlyhalfevil on Fri Mar 21, 2025 8:49 pm, edited 1 time in total.

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

Re: What's Going On With This Preview

Post by CVH » Thu Mar 20, 2025 7:46 am

Please define what getOperation(preview) does.
In Preview mode typically the same as in final mode: Returning an ROperation.

The difference is that getOperation(true) is called from (this=)EAction.updatePreview(clear).
And in final mode you call getOperation(false) to definitely add entities to a document by an operation.

You can limit the generated preview entities based on the preview flag.
In final mode add all entities to the operation.

Is everything added to the operation validated and thus valid?

Define 'Too many'. 10, 30 or several hundreds.
Should not be an issue but it may slow down your Preview generation and affect cursor latency.

Regards,
CVH

333onlyhalfevil
Full Member
Posts: 92
Joined: Fri Apr 28, 2023 12:39 pm

Re: What's Going On With This Preview

Post by 333onlyhalfevil » Fri Mar 21, 2025 8:49 pm

Yeah, you're right, it is something wrong with my script. I just saw the 4 arrows and assumed something was wrong with my script and qcad was switching it out. Apparently it's just a coincidence that it looks like that. My script is drawing something and moving it to a certain position based on where the user's cursor is. The drawing works but the move function is what's messed up. It's centering every entity rather than moving all of them as a whole. I can probably figure it out from here. Thank you for the reply.

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

Re: [Solved] What's Going On With This Preview

Post by CVH » Sat Mar 22, 2025 6:29 am

333onlyhalfevil wrote:
Fri Mar 21, 2025 8:49 pm
It's centering every entity rather than moving all of them as a whole.
Typically move(...) is by an offset vector.
Using the same vector to move individuals should move all as a 'Whole'.

Regards,
CVH

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”