|
|
@@ -46,7 +46,10 @@ function DXFImport(guiAction, fileName) {
|
|
|
this.newPolylineEntityData = new Array();
|
|
|
this.newBlockEntityData = new Array();
|
|
|
this.newTextEntityData = new Array();
|
|
|
+
|
|
|
+ this.newScaleData = new Array();
|
|
|
this.ratio = 1.0;
|
|
|
+ this.LayerNum = 1;
|
|
|
|
|
|
// this.setUiOptions(DXFImport.includeBasePath + "/DXFImport.ui");
|
|
|
}
|
|
|
@@ -55,7 +58,7 @@ DXFImport.prototype = new Paste();
|
|
|
DXFImport.includeBasePath = includeBasePath;
|
|
|
|
|
|
DXFImport.prototype.beginEvent = function () {
|
|
|
- Paste.prototype.beginEvent.call(this);
|
|
|
+ //Paste.prototype.beginEvent.call(this);
|
|
|
|
|
|
var fileDialogInfo;
|
|
|
if (!isNull(this.fileName)) {
|
|
|
@@ -84,8 +87,9 @@ DXFImport.prototype.beginEvent = function () {
|
|
|
// 只再平面上加载
|
|
|
var di = getAssignDocumentInterface(1); // this.sourceDi; // this.getDocumentInterface();
|
|
|
var file = di.importFile(fileDialogInfo[0], fileDialogInfo[1], false);
|
|
|
- // di.regenerateScenes();
|
|
|
- // di.autoZoom();
|
|
|
+ di.regenerateScenes();
|
|
|
+ di.autoZoom();
|
|
|
+
|
|
|
if (file !== RDocumentInterface.IoErrorNoError) {
|
|
|
EAction.handleUserWarning(qsTr("Error while importing file %1").arg(fileDialogInfo[0]));
|
|
|
if (!isNull(this.sourceDi)) {
|
|
|
@@ -94,16 +98,31 @@ DXFImport.prototype.beginEvent = function () {
|
|
|
}
|
|
|
this.terminate();
|
|
|
}
|
|
|
+
|
|
|
+ //if (this.sourceDi.importFile(fileDialogInfo[0], fileDialogInfo[1], false) !== RDocumentInterface.IoErrorNoError) {
|
|
|
+ // EAction.handleUserWarning(qsTr("Error while importing file %1").arg(fileDialogInfo[0]));
|
|
|
+ // if (!isNull(this.sourceDi)) {
|
|
|
+ // destr(this.sourceDi);
|
|
|
+ // this.sourceDi = undefined;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // this.terminate();
|
|
|
+ // return;
|
|
|
+ //}
|
|
|
var entities = this.sourceDocument.queryAllEntities(false, false, RS.EntityImage);
|
|
|
for (var i = 0; i < entities.length; i++) {
|
|
|
var entityId = entities[i];
|
|
|
- var direct = this.sourceDocument.queryEntityDirect(entityId);
|
|
|
- var scale = direct.scale(new RVector(0.001, 0.001), new RVector(0, 0));
|
|
|
+ if (-1==this.newScaleData.indexOf(entityId)) {
|
|
|
+ var direct = this.sourceDocument.queryEntityDirect(entityId);
|
|
|
+ var scale = direct.scale(new RVector(0.001, 0.001), new RVector(0, 0));
|
|
|
+ this.newScaleData.push(entityId);
|
|
|
+ }
|
|
|
}
|
|
|
return;
|
|
|
} catch (error) {
|
|
|
EAction.handleUserWarning("error: " + error.toString());
|
|
|
}
|
|
|
+
|
|
|
};
|
|
|
|
|
|
DXFImport.prototype.finishEvent = function () {
|
|
|
@@ -645,4 +664,4 @@ DXFImport.prototype.applyOperation = function (preview) {
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
-}
|
|
|
+}
|