dwg2svg script file location

If you are having problems with QCAD, post here. Please report bugs through our Bug Tracker instead.

Always attach your original DXF or DWG file and mentions your QCAD version and the platform you are on.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
buildyouridea
Newbie Member
Posts: 4
Joined: Wed Feb 04, 2015 12:39 am

dwg2svg script file location

Post by buildyouridea » Wed Feb 04, 2015 12:43 am

Hi Andrew, just purchased the Pro version and I can't find the scripts dwg2svg.js, dwg2bmp.js or dwg2pdf.js. The bash script dwg2bmp is referencing it but there is no /scripts/Pro directory in there. Why are there pointers to no .js files but the converter still runs?

Thanks!
Dave

User avatar
andrew
Site Admin
Posts: 9052
Joined: Fri Mar 30, 2007 6:07 am

Re: dwg2svg script file location

Post by andrew » Wed Feb 04, 2015 9:56 am

Everything in scripts/Pro is compiled into the qcadproscripts plugin located in the plugins folder as resource. These resources can be accessed by QCAD like regular files.

Perhaps, you could explain what you are intending to do, so I can help more effectively.

buildyouridea
Newbie Member
Posts: 4
Joined: Wed Feb 04, 2015 12:39 am

Re: dwg2svg script file location

Post by buildyouridea » Wed Feb 04, 2015 6:38 pm

Yes, thanks for the reply Andrew. I'm getting an error when I try to run dwg2bmp from any directory except qcad-3.7.7-pro-linux-x86_32. The error is: Warning: Autostart script not found at: "/home/dave/opt/qcad-3.7.7-pro-linux-x86_32/scripts/Pro/Tools/Dwg2Bmp/Dwg2Bmp.js :/home/dave/opt/qcad-3.7.7-pro-linux-x86_32/scripts/Pro/Tools/Dwg2Bmp/Dwg2Bmp.js"

This caused me to look at the dwg2bmp script and see what it is doing. In dwg2bmp, there is this reference: -autostart "$DIR/scripts/Pro/Tools/Dwg2Bmp/Dwg2Bmp.js

This raised the question as to why there is no Pro/Tools directory in qcad-3.7.7-pro-linux-x86_32. So, how is dwg2bmp running if this Pro/Tools doesn't exist nor does Dwg2Bmp.js file exist? Just trying to understand what is going on.

Thanks!
Dave

User avatar
andrew
Site Admin
Posts: 9052
Joined: Fri Mar 30, 2007 6:07 am

Re: dwg2svg script file location

Post by andrew » Thu Feb 05, 2015 9:17 am

There is indeed an error in the dwg2bmp bash script. The $DIR variable should NOT be prepended to the script path, i.e.:

Code: Select all

"$binary" -no-dock-icon -no-gui -allow-multiple-instances -autostart "scripts/Pro/Tools/Dwg2Bmp/Dwg2Bmp.js" "$0" "$@"
The other command line scripts look fine.

buildyouridea
Newbie Member
Posts: 4
Joined: Wed Feb 04, 2015 12:39 am

Re: dwg2svg script file location

Post by buildyouridea » Thu Feb 05, 2015 6:45 pm

Andrew, that may be an issue as well, but what I'm not understanding is why there is no scripts/Pro/ directory, why it doesn't even exist. Is there some magic going on where these scripts are compiled into a plugin and bash somehow knows to look into an object file if the path to the "real" .js file is invalid or doesn't exist?

The root of the issue here is that I'd like to build on what you guys have done with the dwg2bmp.js script and if it's in a library, I can't even see it. Is there a way I can get access to this script so I can see what is going on in there?

Dave

User avatar
andrew
Site Admin
Posts: 9052
Joined: Fri Mar 30, 2007 6:07 am

Re: dwg2svg script file location

Post by andrew » Thu Feb 05, 2015 9:24 pm

buildyouridea wrote:Is there some magic going on where these scripts are compiled into a plugin and bash somehow knows to look into an object file if the path to the "real" .js file is invalid or doesn't exist?
Yes, this script is compiled into a plugin. There is no file in your file system with that name.

Note that bash has nothing to do with this. The script file location is handed over by bash to the QCAD executable as a command line argument.
buildyouridea wrote:The root of the issue here is that I'd like to build on what you guys have done with the dwg2bmp.js script and if it's in a library, I can't even see it. Is there a way I can get access to this script so I can see what is going on in there?
The dwg2bmp command line tool as well as the other dwg2... command line tools are part of QCAD Professional and not part of the open source QCAD Community Edition. If you are interested in command line tools in general, you might want to have a look at the merge tool which is open source:
https://github.com/qcad/qcad/blob/maste ... rawings.js

buildyouridea
Newbie Member
Posts: 4
Joined: Wed Feb 04, 2015 12:39 am

Re: dwg2svg script file location

Post by buildyouridea » Fri Feb 06, 2015 8:50 pm

Thanks for the explanation Andrew. I actually did just purchase the Pro version but it sounds like you are saying that these scripts are not even visible in the purchased version correct?

Can you point me in the right direction for developing my own dwg2bmp.js or dwg2jpg.js script? Like maybe a high level explanation as to what libs are used and how this works?

Dave

User avatar
andrew
Site Admin
Posts: 9052
Joined: Fri Mar 30, 2007 6:07 am

Re: dwg2svg script file location

Post by andrew » Mon Feb 09, 2015 9:21 am

For an example of creating a command line tool, have a look at the merge tool (scripts/Tools/MergeDrawings/MergeDrawings.js).

This would be the gist of creating a bitmap from a drawing file:
var doc = new RDocument(new RMemoryStorage(), new RSpatialIndexNavel());
    var di = new RDocumentInterface(doc);
    var scene = new RGraphicsSceneQt(di);
    di.importFile("myfile.dxf");
    var view = new RGraphicsViewImage();
    view.setScene(scene, false);
    view.resizeImage(800, 600);
    view.autoZoom(10, true);
    scene.regenerate();
    var buffer = view.getBuffer();
    scene.unregisterView(view);
    var iw = new QImageWriter(fileName);
    iw.write(buffer);

Post Reply

Return to “QCAD Troubleshooting and Problems”