QCAD Bugtracker

  • Status Closed
  • Percent Complete
    100%
  • Task Type Bug Report
  • Category QCAD (main)
  • Assigned To
    Andrew
  • Operating System All
  • Severity Low
  • Priority Very Low
  • Reported Version 3.24.2
  • Due in Version Undecided
  • Due Date Undecided
  • Votes 1
  • Private
Attached to Project: QCAD Bugtracker
Opened by Jasmine Moreira - 03.02.2020
Last edited by Andrew - 03.02.2020

FS#2039 - splines are not showing when drawn by QCAD Simple API neither by Entity Module

Hi guys,

I’m trying to create an spline to a complex library component, but it seems splines are not working properly. I would appreciate some help. These are minimum scripts to demonstrate the problem:

Example 1:

include("scripts/simple.js");

function TesteSpline() {
}

TesteSpline.init = function(formWidget) {
    if (!isNull(formWidget)) {
        TesteSpline.widgets = getWidgets(formWidget);
    }
};

TesteSpline.generate = function(documentInterface, file) {
    return TesteSpline.criarCorpo(documentInterface);
};

TesteSpline.generatePreview = function(documentInterface, iconSize) {
};

TesteSpline.criarCorpo = function(documentInterface) {

    addSpline([[0,0],[20,30],[100,100],[110,120]], false); // it doesn't work :-(
    addLine(0,0, 100,100);  // it works!!!

};

Example 2:

include("scripts/library.js");

function TesteSpline() {
}

TesteSpline.init = function(formWidget) {
    if (!isNull(formWidget)) {
        TesteSpline.widgets = getWidgets(formWidget);
    }
};

TesteSpline.generate = function(documentInterface, file) {
    return TesteSpline.criarCorpo(documentInterface);
};

TesteSpline.generatePreview = function(documentInterface, iconSize) {
};

TesteSpline.criarCorpo = function(documentInterface) {
    var addOperation = new RAddObjectsOperation(false);
    var doc = documentInterface.getDocument()
    // Spline
    var cavaData = new RSplineData();
    cavaData.appendFitPoint(new RVector(0,0));
    cavaData.appendFitPoint(new RVector(10,10));
    cavaData.appendFitPoint(new RVector(30,30));
    cavaData.isClosed = false;
  
    // It doesn't work
    var cava = new RSplineEntity(doc,cavaData);
    addOperation.addObject(cava);

    // it works
    var textData = new RTextData(new RVector(2,10),new RVector(2,10),0.4,0.4,0,0,0,0,1,"Hello","Arial",false,false,0,false);
    addOperation.addObject(new RTextEntity(doc,textData));

    return addOperation;
};



Closed by  Andrew
03.02.2020 13:11
Reason for closing:  Not a bug
Admin
Andrew commented on 03.02.2020 13:09

Are you using the free QCAD Community Edition? If so, splines from fit points are only supported with QCAD Professional (through the OpenDesign module).

See also:
https://www.qcad.org/en/documentation/features

Jasmine Moreira commented on 03.02.2020 13:30

It doesn't work even with control points.

include("scripts/library.js");

function TesteSpline() {
}

TesteSpline.init = function(formWidget) {
    if (!isNull(formWidget)) {
        TesteSpline.widgets = getWidgets(formWidget);
    }
};

TesteSpline.generate = function(documentInterface, file) {
    return TesteSpline.criarCorpo(documentInterface);
};

TesteSpline.generatePreview = function(documentInterface, iconSize) {
};

TesteSpline.criarCorpo = function(documentInterface) {
    var addOperation = new RAddObjectsOperation(false);
    var doc = documentInterface.getDocument()
    // Spline
    var cavaData = new RSplineData();
    cavaData.appendControlPoint(new RVector(0,0));
    cavaData.appendControlPoint(new RVector(10,10));
    cavaData.appendControlPoint(new RVector(30,30));
    cavaData.isClosed = false;
  
    // It doesn't work
    var cava = new RSplineEntity(doc,cavaData);
    addOperation.addObject(cava);

    // it works
    var textData = new RTextData(new RVector(2,10),new RVector(2,10),0.4,0.4,0,0,0,0,1,"Hello","Arial",false,false,0,false);
    addOperation.addObject(new RTextEntity(doc,textData));

    return addOperation;
};
Admin
Andrew commented on 03.02.2020 13:35

Spline of degree 3 needs at least 4 control points by definition.

Jasmine Moreira commented on 03.02.2020 13:39

Dear Andrew,

It worked like a charm. Thank you very much for your attention and forgive-me for my lack of experience on SPlines :-)

You are awesome!

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing