Loss of Script operation after using snaps

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
pietro_72_
Full Member
Posts: 52
Joined: Fri Apr 17, 2015 6:40 am
Location: http://creativitainformaticart.altervista.org

Loss of Script operation after using snaps

Post by pietro_72_ » Fri Oct 04, 2019 9:00 am

I can't understand why I lose control of the script operation when using snaps

If someone can give me a tip, if you have time and desire and always without haste :-D

I attach the source files:
Attachments
OrthogonalProjections.zip
(18.37 KiB) Downloaded 7 times

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

Re: Loss of Script operation after using snaps

Post by CVH » Fri Oct 04, 2019 11:40 am

hello,
Seen your latest topics.
Been on your site lately, curious about the 3D button.

Can you explain in short what the purpose and the method are?
Is there a testfile associated with this?
I think none of my files would be a candidate.
At what point do you use snapping?

Is it correct that OrthogonalProjections.js is not open source?
Was it written by Andrew?
Is it correct that I see traces of ExXmlExport.js in Export3D.js?

I do understand you prefer Italian but isn't there a consensus that code itself should be written in English?
Pritty hard to trow thrue a translator like a site or a forum topic.

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

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

Re: Loss of Script operation after using snaps

Post by pietro_72_ » Fri Oct 04, 2019 10:41 pm

Hello

Oops, thank you, I have to correct the GPL license references on the scripts, it is a program that I am trying to make myself as a hobby but starting from the files and / or parts of these made by Andrew, trying to understand how it works.

What would be the most correct way to write the GPL License?
For example on a previous script I added the following after Andrew's LPG Heading:
//ParallelLines_of_Cona_Pietro_.........._Extension for QCAD.zip
// Copyright © 2005-2015 Pietro Cona
// Website: http://pietro72li.altervista.org
// Website: http://pietro72li.heliohost.org
// Under the GPL license

I don't know English, I manage with the google translator (maybe sooner or later I decide to study it 😁), but slowly I translate into English if it can be better this way.

I'm trying to make a little program that can put QCAD in communication with Blender-type 3D modellers through orthogonal projections exporting in 3D formats like obj, dae, dxf (with Blender it seems better to obj)

At the moment on my site I have not put any demo file, there is only an attachment to this post, but it is still early because it does what I would like

Setting the first drop-down menu on "Create 3D Entities:" and the second on "3D Vertex" (Part I'm working on) you start tracing the vertices in orthogonal projections at the first click on the XY axes and at the second click automatically on the 'Z axis and so on for each vertex, but if for example I set a relative 0 on a previous vertex and a horizontal restrict on the XY axes after it no longer traces the vertices to me and seems to stop after the 503 line of OrthogonalProjectins.js

Regards
Peter

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

Re: Loss of Script operation after using snaps

Post by CVH » Sat Oct 05, 2019 12:12 am

Peter,
Like I said, I do not possess of a suitable dxf to even test it.

Did a quick read of your script....
I am just starting to learn Javascript.
And Qcad. :)

For one, I would use the same closing brackets sheme as Andrew does.
(round, curly or sqaured)
Blocks of code are more clearly that way.
I am using Notepad++ and then it is all so obvious.

Instead:

Code: Select all

function{
    If (xyzxyz) {
        code...;
        code...;
        switch (this.state) {
            case xyzxyz: {
                code...;
                code...;
                }
            case xyzxyz: {
                code...;
                }
            }
        }
    else if (xyzxyz) {
        code...;
        }
    };
 

Set the closer under the first letter of the line where it is opened. :wink:

Code: Select all

function{
    If (xyzxyz) {
        code...;
        code...;
        switch (this.state) {
            case xyzxyz: {
                code...;
                code...;
            }
            case xyzxyz: {
                code...;
            }
        }
    }
    else if (xyzxyz) {
        code...;
    }
};

pietro_72_ wrote:
Fri Oct 04, 2019 10:41 pm
but if for example I set a relative 0 on a previous vertex and a horizontal restrict on the XY axes after it no longer traces the vertices to me and seems to stop after the 503 line of OrthogonalProjectins.js
Hard to follow without an example, just a few things:
Its hard to believe a UserMessage would halt your script. :shock:
The mentioned else if block at line 503 includes a new RRestrictVertical(di) and you are speaking of a horizontal restrict.
If you restrict to both you can't set anything else but the relative zero. :!:

That's what I make of it.
Regards,
CVH
QCADpro 3.23.0.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

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

Re: Loss of Script operation after using snaps

Post by pietro_72_ » Sun Oct 06, 2019 11:27 pm

I made some corrections on the files, maybe so they are a little clearer and I also did a little movie about it.

For now, the Export 3D button only saves a file in dxf format that contains a square whose vertices are not connected to the vertices drawn on QCAD

http://creativitainformaticart.altervis ... 9%3A29.mp4
Attachments
OrthogonalProjections.zip
(18.52 KiB) Downloaded 6 times

Post Reply

Return to “QCAD Developers and Contributors”