1) How can I add something to current DWG or DXF file by my script. I use:
- Code: Select all
// init application name:
qApp.applicationName = "Nacti body";
// init DWG / DXF exporter:
RDwgExporterFactory.registerFileExporter();
var storage = new RMemoryStorage();
var spatialIndex = new RSpatialIndexNavel();
var document = new RDocument(storage, spatialIndex);
document.setUnit(RS.Meter);
// create document interface (needed for file export functionality):
var di = new RDocumentInterface(document);
// create an operation:
var operation = new RAddObjectsOperation();
...
// apply operation to document:
operation.apply(document);
// export document to DWG, version 2000:
di.exportFile(file_name.dwg "DWG 2000");
It create new file file_name.dwg with results of my script, but I need to add results of my script to existing file f.e. current_file.dwg
2) I'm not able to open GUI with created DWG file at the end of my script. I must open QCad GUI and load file manually. I run my script by command:
- Code: Select all
./qcad-trial -autostart my_script.js
I know that is non-gui command but
- Code: Select all
./qcad -exec my_script.js
don't work to me, probably because I use only trial version. But it doesn't matter, because I want use boolean variable which define if file should be open or not.
I try use something like this:
- Code: Select all
var open = true;
if (open){
include("scripts/File/OpenFile/OpenFile.js");
var action = new OpenFile();
action.openFile("my_file.dwg");
action.finishEvent();
}
But i take error mesage:
- Code: Select all
NewFile.prototype.beginEvent [1339929706108]
EAction.prototype.showUiOptions: no options tool bar
Creating storage...
Creating spatial index...
Creating document...
RDocument::setCurrentBlock: removing block: 22
Init idle and default actions...
EAction.prototype.showUiOptions: no options tool bar
./qcad-trial: řádek 36: 6058 Neoprávněný přístup do paměti (SIGSEGV) LD_LIBRARY_PATH="$DIR" "$binary" $OPT1 $OPT2 "$@"