Page 3 of 5

Posted: Thu Oct 20, 2011 12:36 pm
by hungerburg
Alf, this might be off-topic, but I think it may be of use for you: In many places SVG can do, what you want PDF for… So if you paste these lines to the bottom of example.js, QCAD will write an SVG representation of the drawing:

Code: Select all

include("scripts/ImportExport/SvgExporter/SvgExporterPG.js");
var exporter = new SvgExporterPG(document, { "scale": "10:1"});
exporter.exportFile("example.svg");

Posted: Thu Oct 20, 2011 12:43 pm
by andrew
PDF export will be documented soon in the tutorials as well. Maybe later today, if I can find the time.

Posted: Thu Oct 20, 2011 1:15 pm
by hungerburg
hungerburg wrote:

Code: Select all

include("scripts/ImportExport/SvgExporter/SvgExporterPG.js");
var exporter = new SvgExporterPG(document, { "scale": "10:1"});
exporter.exportFile("example.svg");
Obviously, this will fail when -no-gui was called for. Below patch helps though:

Code: Select all

--- SvgExporter.js~	2011-10-20 14:11:45.527589416 +0200
+++ SvgExporter.js	2011-10-20 14:12:46.277502814 +0200
@@ -1,6 +1,5 @@
 include("scripts/library.js");
 include("scripts/date.js");
-include("scripts/File/PrintPreview/Print.js");
 
 /**
  * File exporter implementation for the SVG format.
@@ -116,7 +115,7 @@
     this.svgUnitAbbr = ret[1];
 
     // scale
-    this.scale = Print.parseScale(this.scaleStr);
+    this.scale = RMath.parseScale(this.scaleStr);
 
     var bb = this.doc.getBoundingBox();
     var size = bb.getSize();

Posted: Thu Oct 20, 2011 1:27 pm
by alf2006x
we need exactly pdf because it is non editable format. drawings maked from site will be signed his author (director of customer) and send to manufacturer (back to us)

Posted: Thu Oct 20, 2011 2:03 pm
by hungerburg
I would like to further expand the tutorial text:

Code: Select all

var td = new RTextData();
td.setText("QCAD rocks");
td.setTextHeight(1);
td.setPosition(p1);
operation.addObject(new RTextEntity(document, td));
Pasting this before the operation gets applied will write this flattering line - because it is true :)

Posted: Thu Oct 20, 2011 7:28 pm
by alf2006x
hungerburg, andrew one more question to you.

How can I do the best performance of my system? I see two ways to solve the problem.

First one is to make some daemon, witch will gets input data, then generate the text file, save it as script and runs the script in "headless silent mode".

The second way is to write the script for QCAD, wich will runs one time and will wait for incoming file with input data.

What do you think?

Posted: Thu Oct 20, 2011 10:04 pm
by andrew
I don't know your exact environment, but I assume your service is somehow web based?

If so, your application will have to be able to handle multiple requests simultaneously, so running only one instance of QCAD is not an option.

You could for example create a CGI which handles incoming requests, parses incoming user data (e.g. POST or GET parameters) and creates a QCAD script from this user data.

The CGI then launches QCAD with that script file as -autostart parameter. QCAD generates the PDF file and the CGI returns the PDF file contents as response to the request.

Posted: Fri Oct 21, 2011 3:03 pm
by andrew
A PDF export tutorial is now online at:
http://www.ribbonsoft.com/doc/qcad/3.0/ ... xport.html

Posted: Fri Oct 21, 2011 7:30 pm
by alf2006x
Example works in main mode of QCAD, but do not work in -no-gui mode
It shows message:

alf3@ubuntu:~/Downloads/qcad-3.0.0-beta3-trial-linux$ ./qcad-trial -no-gui -autostart '/home/alf3/QCAD/example.js'
#50-Ubuntu SMP Mon Sep 12 21:18:14 UTC 2011
i686
QWidget: Cannot create a QWidget when no GUI is being used
./qcad-trial: строка 39: 16545 Аварийный останов LD_LIBRARY_PATH="$DIR" "$binary" $OPT1 $OPT2 "$@"

and command:
./qcad-trial -autostart '/home/alf3/QCAD/example.js'
works wery well

Posted: Fri Oct 21, 2011 9:38 pm
by andrew
alf2006x: please apply the fix to EAction.js that I have posted in this thread earlier. See:
http://www.ribbonsoft.com/rsforum/viewt ... =4966#4966

-> post at bottom of the page from 17 Oct 2011 09:28 am

Posted: Fri Oct 21, 2011 10:07 pm
by alf2006x
Perfect, wonderful, superb!
It works! It works !!! IT WORKS !!!
:D

I copy my example.pdf in Windows and it opens!

GREAT THANKS! QCAD IS THE BEST CAD FOR LINUX!
Now my project will be completed. I do not doubt it.

Posted: Mon Oct 24, 2011 8:11 am
by alf2006x
andrew, help me again please. our provider uses Ubuntu-Server 10.04.2 LTS Lucid Lynx - Release amd64
how can i install qcad3 beta3 on this system? will it be enough simple copying linux tar.gz package and unpacking them to run headless qcad3 beta3? or i must do something else?

Posted: Mon Oct 24, 2011 10:15 am
by andrew
To run QCAD (32bit) on a 64bit platform, you need to have the 32bit libraries installed (package ia32-libs).

Posted: Tue Oct 25, 2011 1:30 pm
by hungerburg
alf2006x wrote: Ubuntu-Server 10.04.2 LTS Lucid Lynx - Release amd64
how can i install qcad3 beta3 on this system? will it be enough simple copying linux tar.gz package and unpacking them to run headless qcad3 beta3? or i must do something else?
I do not use the installer, instead I download the archive and unpack into /opt/, which is a widely used convention for packages like qcad. On a server edition of ubuntu -- depending on how strict -no-gui works -- you may also have to install some X11 libraries on your own, because they are not part of the base. The ldd utility can help you find out which prerequisites are missing: "ldd /opt/qcad3/qcad-bin". Also "apt-cache search something" comes quite handy.

Posted: Wed Oct 26, 2011 9:55 pm
by alf2006x
Hi to all.
This is my new trouble.
On my "Ubuntu-Server 10.04.2 LTS Lucid Lynx - Release amd64" I installed ia32-libs.
And moved my folder '/qcad/qcad3b' (with qcad files) into '/opt' folder.

Now command prompt shows me this:

alfus@ubuntu:/opt/qcad/qcad3b$ ./qcad-trial
#55-Ubuntu SMP Mon Jan 10 23:42:43 UTC 2011
x86_64
./qcad-trial-bin: error while loading shared libraries: libGL.so.1: cannot open shared object file: No such file or directory
alfus@ubuntu:/opt/qcad/qcad3b$

What is it?