mxcad 1.0.219 → 1.0.220

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mxcad.d.ts CHANGED
@@ -157,7 +157,8 @@ export declare class McRxObject {
157
157
  */
158
158
  get objectName(): string;
159
159
  /**
160
- * 获取 DXF 代码 0 的值。
160
+ * 得到对象的DXF组码的类型名,这个和AutoCAD中的DXF组码是一样。
161
+ * 比如直线的类型名为:McDbLine,DXF0组码值: LINE,DXF0组码值可以用来构造集时的类型过滤。
161
162
  */
162
163
  get dxf0(): string;
163
164
  /**
@@ -615,12 +616,14 @@ export declare class McDbObject extends McRxObject {
615
616
  */
616
617
  freeTempRelationObject(): void;
617
618
  /**
618
- * 设置对象被改变的状态,可自动触发更新显示函数,更新显示。
619
- * 比如块表记录更新了,需要通知块引用更新显示,可以调用该函数。
620
- * @example
621
- * ```ts
622
- * ```
623
- */
619
+ * 设置对象被改变的状态,可自动触发更新显示函数,更新显示。
620
+ * 比如块表记录更新了,需要通知块引用更新显示,可以调用该函数。
621
+ * @example
622
+ * ```ts
623
+ * //假设obj为一个数据库对象
624
+ * obj.assertObjectModification()
625
+ * ```
626
+ */
624
627
  assertObjectModification(autoUndo?: boolean): number;
625
628
  }
626
629
  /** McDbObject 的一个数组,该数组存储了多个 McDbObject 对象的引用。 */
@@ -4258,7 +4261,7 @@ export declare class McDbEntity extends McDbObject {
4258
4261
  };
4259
4262
  /**
4260
4263
  * 得到对象的扩展数据
4261
- * @param appName XData 类型
4264
+ * @param appName 扩展数据名
4262
4265
  * @example
4263
4266
  * ```ts
4264
4267
  * // 假设ent为有效实例对象
@@ -4268,7 +4271,7 @@ export declare class McDbEntity extends McDbObject {
4268
4271
  getxData(appName?: string): MxCADResbuf;
4269
4272
  /**
4270
4273
  * 设置对象的扩展数据
4271
- * @param xdata resbuf 数据
4274
+ * @param xdata 扩展数据链表
4272
4275
  * @example
4273
4276
  * ```ts
4274
4277
  * import { MxCADUiPrEntity, McDbEntity } from "mxcad";
@@ -4286,12 +4289,15 @@ export declare class McDbEntity extends McDbObject {
4286
4289
  setxData(xdata: MxCADResbuf): boolean;
4287
4290
  /**
4288
4291
  * 获取与特定实体关联的 XData 信息,并以字符串形式返回
4289
- * @param appName XData 类型
4292
+ * @param appName 扩展数据名称
4290
4293
  * @returns { object } val XData信息 | ret 是否返回成功
4291
4294
  * @example
4292
4295
  * ```ts
4293
4296
  * // 假设ent为有效实例对象
4294
4297
  * let data = ent.getxDataString("DataName");
4298
+ * if(data.ret){
4299
+ * console.log(data.val)
4300
+ * }
4295
4301
  * ```
4296
4302
  */
4297
4303
  getxDataString(appName: string): {
@@ -4300,8 +4306,8 @@ export declare class McDbEntity extends McDbObject {
4300
4306
  };
4301
4307
  /**
4302
4308
  * 设置与特定实体关联的 XData 信息,并以字符串形式设置
4303
- * @param appName XData 类型
4304
- * @param val XData信息
4309
+ * @param appName 扩展数据名称
4310
+ * @param val 字符串值
4305
4311
  * @returns 是否设置成功
4306
4312
  * @example
4307
4313
  * ```ts
@@ -4323,8 +4329,16 @@ export declare class McDbEntity extends McDbObject {
4323
4329
  setxDataString(appName: string, val: string): boolean;
4324
4330
  /**
4325
4331
  * 获取实体的指定 XData 类型中的 double 值
4326
- * @param appName XData 类型
4332
+ * @param appName 扩展数据名称
4327
4333
  * @returns double 值
4334
+ * @example
4335
+ * ```ts
4336
+ * // 假设ent为有效实例对象
4337
+ * let data = ent.getxDataDouble("DataName");
4338
+ * if(data.ret){
4339
+ * console.log(data.val)
4340
+ * }
4341
+ * ```
4328
4342
  */
4329
4343
  getxDataDouble(appName: string): {
4330
4344
  val: number;
@@ -4332,15 +4346,39 @@ export declare class McDbEntity extends McDbObject {
4332
4346
  };
4333
4347
  /**
4334
4348
  * 设置实体的指定 XData 类型中的 double 值
4335
- * @param appName XData 类型
4349
+ * @param appName 扩展数据名称
4336
4350
  * @param val double 值
4337
4351
  * @returns 布尔值
4352
+ * @example
4353
+ * ```ts
4354
+ * import { MxCADUiPrEntity, McDbEntity } from "mxcad";
4355
+ * let selEntity = new MxCADUiPrEntity();
4356
+ * selEntity.setMessage("选择对象");
4357
+ * let id = await selEntity.go();
4358
+ * if (!id.isValid()) return;
4359
+ * let ent:McDbEntity = id.getMcDbEntity();
4360
+ * if (ent === null) return;
4361
+ * const res = ent.setxDataDouble("DataName", 0);
4362
+ * if(res){
4363
+ * //设置成功
4364
+ * }else{
4365
+ * //设置失败
4366
+ * }
4367
+ * ```
4338
4368
  */
4339
4369
  setxDataDouble(appName: string, val: number): boolean;
4340
4370
  /**
4341
4371
  * 获取实体的指定 XData 类型中的 long(整数)值
4342
- * @param appName XData 类型
4372
+ * @param appName 扩展数据名称
4343
4373
  * @returns long 值
4374
+ * @example
4375
+ * ```ts
4376
+ * // 假设ent为有效实例对象
4377
+ * let data = ent.getxDataLong("DataName");
4378
+ * if(data.ret){
4379
+ * console.log(data.val)
4380
+ * }
4381
+ * ```
4344
4382
  */
4345
4383
  getxDataLong(appName: string): {
4346
4384
  val: number;
@@ -4348,14 +4386,31 @@ export declare class McDbEntity extends McDbObject {
4348
4386
  };
4349
4387
  /**
4350
4388
  * 设置实体的指定 XData 类型中的 long(整数)值
4351
- * @param appName XData 类型
4389
+ * @param appName 扩展数据名称
4352
4390
  * @param val long 值
4353
4391
  * @returns long 值
4392
+ * @example
4393
+ * ```ts
4394
+ * import { MxCADUiPrEntity, McDbEntity } from "mxcad";
4395
+ *
4396
+ * let selEntity = new MxCADUiPrEntity();
4397
+ * selEntity.setMessage("选择对象");
4398
+ * let id = await selEntity.go();
4399
+ * if (!id.isValid()) return;
4400
+ * let ent:McDbEntity = id.getMcDbEntity();
4401
+ * if (ent === null) return;
4402
+ * const res = ent.setxDataLong("DataName", 123456);
4403
+ * if(res){
4404
+ * //设置成功
4405
+ * }else{
4406
+ * //设置失败
4407
+ * }
4408
+ * ```
4354
4409
  */
4355
4410
  setxDataLong(appName: string, val: number): boolean;
4356
4411
  /**
4357
4412
  * 获取实体的指定 XData 类型中的点对象
4358
- * @param appName XData 类型
4413
+ * @param appName 扩展数据名称
4359
4414
  * @return 获取结果及三维点对象
4360
4415
  */
4361
4416
  getxDataPoint(appName: string): {
@@ -4364,14 +4419,31 @@ export declare class McDbEntity extends McDbObject {
4364
4419
  };
4365
4420
  /**
4366
4421
  * 设置实体的指定 XData 类型中的点对象
4367
- * @param appName XData 类型
4422
+ * @param appName 扩展数据名称
4368
4423
  * @param val 点对象
4369
4424
  * @return 获取结果及三维点对象
4370
4425
  */
4371
4426
  setxDataPoint(appName: string, val: McGePoint3d): boolean;
4372
4427
  /**
4373
4428
  * 删除实体指定应用程序名称相关的数据
4374
- * @param appName XData 类型
4429
+ * @param appName 扩展数据名称
4430
+ * @example
4431
+ * ```ts
4432
+ * import { MxCADUiPrEntity, McDbEntity } from "mxcad";
4433
+ *
4434
+ * let selEntity = new MxCADUiPrEntity();
4435
+ * selEntity.setMessage("选择对象");
4436
+ * let id = await selEntity.go();
4437
+ * if (!id.isValid()) return;
4438
+ * let ent:McDbEntity = id.getMcDbEntity();
4439
+ * if (ent === null) return;
4440
+ * const res = ent.deleteXData("DataName");
4441
+ * if(res){
4442
+ * //删除成功
4443
+ * }else
4444
+ * //删除失败
4445
+ * }
4446
+ * ```
4375
4447
  */
4376
4448
  deleteXData(appName: string): boolean;
4377
4449
  /**
@@ -8870,20 +8942,20 @@ export declare class McDbTextStyleTableRecord extends McDbObject {
8870
8942
  get flagBits(): number;
8871
8943
  set flagBits(val: number);
8872
8944
  /**
8873
- * 字体名称
8945
+ * 字体文件名称
8874
8946
  * @example
8875
8947
  * ```ts
8876
8948
  * import { McDbTextStyleTableRecord } from 'mxcad';
8877
8949
  *
8878
8950
  * const newTextStyleRecord = new McDbTextStyleTableRecord();
8879
8951
  * newTextStyleRecord.fileName = "测试字体名";
8880
- * console.log("当前字体名:",newTextStyleRecord.fileName)
8952
+ * console.log("当前字体文件名:",newTextStyleRecord.fileName)
8881
8953
  * ```
8882
8954
  */
8883
8955
  get fileName(): string;
8884
8956
  set fileName(val: string);
8885
8957
  /**
8886
- * 大字体名称
8958
+ * 大字体文件名称
8887
8959
  * @example
8888
8960
  * ```ts
8889
8961
  * import { McDbTextStyleTableRecord } from 'mxcad';
@@ -10327,7 +10399,7 @@ export declare class McDbXrecord extends McDbObject {
10327
10399
  * const xrec = new McDbXrecord();
10328
10400
  * let data = new MxCADResbuf();
10329
10401
  * data.AddString("TestData");
10330
- * const res = dbXrecord.setData(xdata);
10402
+ * const res = xrec.setData(data);
10331
10403
  * if(res){
10332
10404
  * //设置成功
10333
10405
  * }else{
@@ -10570,6 +10642,18 @@ export declare class McObject {
10570
10642
  */
10571
10643
  constructor(imp?: any);
10572
10644
  /**
10645
+ * 设置对象的一些属性设置
10646
+ * @param val 属性设置内容.
10647
+ * 1. DisplayPrecision 显示精度设置,默认为0,可以取0 ~1000,1000为最高精度了
10648
+ * 2. EnableUndo 启用undo功能,默认是没有启动的
10649
+ * @example
10650
+ * ```ts
10651
+ * 启用undo
10652
+ * mxcad.setAttribute({EnableUndo:true})
10653
+ * ```
10654
+ */
10655
+ setAttribute(val: object): boolean;
10656
+ /**
10573
10657
  * 返回与MxCAD对象绑定的MxDraw对象。
10574
10658
  * @returns MxDraw对象
10575
10659
  * @example
@@ -10966,7 +11050,7 @@ export declare class McObject {
10966
11050
  * 设置绘制颜色索引
10967
11051
  * @returns val 颜色索引类型
10968
11052
  */
10969
- get drawColorIndex(): ColorIndexType;
11053
+ get drawColorIndex(): number;
10970
11054
  /**
10971
11055
  * 设置绘制颜色索引
10972
11056
  * @param val 颜色索引类型
@@ -10977,7 +11061,7 @@ export declare class McObject {
10977
11061
  * mxcad.drawColorIndex = ColorIndexType.kMagenta;
10978
11062
  * ```
10979
11063
  */
10980
- set drawColorIndex(val: ColorIndexType);
11064
+ set drawColorIndex(val: ColorIndexType | number);
10981
11065
  /**
10982
11066
  * 获取绘制线宽
10983
11067
  * @returns 返回绘制线宽
@@ -11987,6 +12071,14 @@ export declare class McAppType {
11987
12071
  */
11988
12072
  addNetworkLoadingFont(fontfiles: string | string[]): void;
11989
12073
  /**
12074
+ * 全局参数的初始设置
12075
+ * @param ini 初始设置值
12076
+ * @example
12077
+ * ```ts
12078
+ * ```
12079
+ */
12080
+ IniSet(ini: object): boolean;
12081
+ /**
11990
12082
  * 配置需要通过网络加载的bigfont shx字体
11991
12083
  * @param fontfiles 加载的字体文件
11992
12084
  * @example
@@ -12966,6 +13058,14 @@ export interface MxCadConfig {
12966
13058
  map?: any;
12967
13059
  /**多选模式 */
12968
13060
  multipleSelect?: boolean;
13061
+ /**是否启用Undo */
13062
+ enableUndo?: boolean;
13063
+ /**使用鼠标中键移动视区,默认是使用 */
13064
+ mouseMiddlePan?: number;
13065
+ /**是否启用选择功能,默认是使用 */
13066
+ enableIntelliSelect?: boolean;
13067
+ /**是否启用浏览模式,默认是编辑模式 */
13068
+ browse?: boolean;
12969
13069
  }
12970
13070
  /** 创建MxCad实例
12971
13071
  * @param config 参数配置
package/dist/mxcad.es.js CHANGED
@@ -14145,7 +14145,7 @@ win.McDrawObjectEvent_asciiToUTF8 = function (hexstr) {
14145
14145
  return MxG2312Obj.decodeFromGb2312(hexstr);
14146
14146
  };
14147
14147
 
14148
- const version$1 = "1.0.219";
14148
+ const version$1 = "1.0.220";
14149
14149
 
14150
14150
  var isSharedArrayBuffer = ("SharedArrayBuffer" in window);
14151
14151
  var isCdn = document.currentScript && /unpkg\.com\/mxcad/.test(document.currentScript.src);
@@ -19869,6 +19869,11 @@ var McObject = /*#__PURE__*/function () {
19869
19869
  this.imp = imp;
19870
19870
  }
19871
19871
  _createClass$1(McObject, [{
19872
+ key: "setAttribute",
19873
+ value: function setAttribute(val) {
19874
+ return this.imp.setAttribute(JSON.stringify(val));
19875
+ }
19876
+ }, {
19872
19877
  key: "getMxDrawObject",
19873
19878
  value: function getMxDrawObject() {
19874
19879
  return this.imp["mxdrawObject"];
@@ -21067,6 +21072,11 @@ var McAppType = /*#__PURE__*/function () {
21067
21072
  });
21068
21073
  }
21069
21074
  }
21075
+ }, {
21076
+ key: "IniSet",
21077
+ value: function IniSet(ini) {
21078
+ return this.imp.IniSet(JSON.stringify(ini));
21079
+ }
21070
21080
  }, {
21071
21081
  key: "addNetworkLoadingBigFont",
21072
21082
  value: function addNetworkLoadingBigFont(fontfiles) {
@@ -25153,7 +25163,7 @@ function _getMxreleaseidId() {
25153
25163
  }
25154
25164
  var createMxCad = /*#__PURE__*/function () {
25155
25165
  var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(config, mxcadobj) {
25156
- var _ref2, openParameter, networkFonts, fontspath, locateFile, wasmBinary, canvas, onOpenFileComplete, fileUrl, onInit, middlePan, registdata, registfile, viewBackgroundColor, map, multipleSelect, mxDraw, THREE, size, mxCadObj, registfileurl, regdataobj, fetchAttributes;
25166
+ var _ref2, openParameter, networkFonts, fontspath, locateFile, wasmBinary, canvas, onOpenFileComplete, fileUrl, onInit, middlePan, registdata, registfile, viewBackgroundColor, map, multipleSelect, enableUndo, mouseMiddlePan, enableIntelliSelect, browse, mxDraw, THREE, size, mxCadObj, registfileurl, regdataobj, fetchAttributes;
25157
25167
  return regenerator.wrap(function _callee$(_context) {
25158
25168
  while (1) switch (_context.prev = _context.next) {
25159
25169
  case 0:
@@ -25164,7 +25174,7 @@ var createMxCad = /*#__PURE__*/function () {
25164
25174
  _context.next = 3;
25165
25175
  return loadCoreCode();
25166
25176
  case 3:
25167
- _ref2 = config || {}, openParameter = _ref2.openParameter, networkFonts = _ref2.networkFonts, fontspath = _ref2.fontspath, locateFile = _ref2.locateFile, wasmBinary = _ref2.wasmBinary, canvas = _ref2.canvas, onOpenFileComplete = _ref2.onOpenFileComplete, fileUrl = _ref2.fileUrl, onInit = _ref2.onInit, middlePan = _ref2.middlePan, registdata = _ref2.registdata, registfile = _ref2.registfile, viewBackgroundColor = _ref2.viewBackgroundColor, map = _ref2.map, multipleSelect = _ref2.multipleSelect;
25177
+ _ref2 = config || {}, openParameter = _ref2.openParameter, networkFonts = _ref2.networkFonts, fontspath = _ref2.fontspath, locateFile = _ref2.locateFile, wasmBinary = _ref2.wasmBinary, canvas = _ref2.canvas, onOpenFileComplete = _ref2.onOpenFileComplete, fileUrl = _ref2.fileUrl, onInit = _ref2.onInit, middlePan = _ref2.middlePan, registdata = _ref2.registdata, registfile = _ref2.registfile, viewBackgroundColor = _ref2.viewBackgroundColor, map = _ref2.map, multipleSelect = _ref2.multipleSelect, enableUndo = _ref2.enableUndo, mouseMiddlePan = _ref2.mouseMiddlePan, enableIntelliSelect = _ref2.enableIntelliSelect, browse = _ref2.browse;
25168
25178
  _context.next = 6;
25169
25179
  return loadMxCADassembly(function () {
25170
25180
  return void 0;
@@ -25173,9 +25183,14 @@ var createMxCad = /*#__PURE__*/function () {
25173
25183
  MxFun.initMxCpp(MxCpp);
25174
25184
  MxCADUtility.init();
25175
25185
  MxFun.setIniset({
25176
- EnableIntelliSelect: true,
25186
+ EnableIntelliSelect: enableIntelliSelect === void 0 ? true : enableIntelliSelect,
25177
25187
  IntelliSelectType: 1
25178
25188
  });
25189
+ if (enableUndo !== void 0) {
25190
+ MxCpp.App.IniSet({
25191
+ EnableUndo: enableUndo
25192
+ });
25193
+ }
25179
25194
  if (viewBackgroundColor) {
25180
25195
  MxCpp.App.setDefaultViewBackgroundColor(viewBackgroundColor.red, viewBackgroundColor.green, viewBackgroundColor.blue);
25181
25196
  }
@@ -25183,9 +25198,9 @@ var createMxCad = /*#__PURE__*/function () {
25183
25198
  if (mxcadobj) {
25184
25199
  mxcadobj.callEvent("init");
25185
25200
  }
25186
- _context.next = 14;
25201
+ _context.next = 15;
25187
25202
  return createMxDraw(canvas, middlePan, map, mxcadobj);
25188
- case 14:
25203
+ case 15:
25189
25204
  mxDraw = _context.sent;
25190
25205
  if (multipleSelect !== void 0) {
25191
25206
  mxDraw.setMultipleSelect(multipleSelect);
@@ -25201,31 +25216,31 @@ var createMxCad = /*#__PURE__*/function () {
25201
25216
  mxDraw.getRenderer().getSize(size);
25202
25217
  mxCadObj = createMxCadCppObject(MxCpp.App.getImp(), size.width, size.height, mxDraw.getCanvas().id, mxDraw.isWebgl2(), mxDraw.getId(), map ? true : false, mxcadobj);
25203
25218
  if (mxCadObj.isTryVersion()) {
25204
- _context.next = 33;
25219
+ _context.next = 34;
25205
25220
  break;
25206
25221
  }
25207
25222
  if (!(registdata && registdata.length > 0)) {
25208
- _context.next = 27;
25223
+ _context.next = 28;
25209
25224
  break;
25210
25225
  }
25211
25226
  mxCadObj.initRegist(registdata);
25212
- _context.next = 33;
25227
+ _context.next = 34;
25213
25228
  break;
25214
- case 27:
25229
+ case 28:
25215
25230
  registfileurl = registfile;
25216
25231
  if (!(registfile && registfile.length > 0)) {
25217
25232
  registfileurl = "mxkey.json.frontpage.json";
25218
25233
  }
25219
- _context.next = 31;
25234
+ _context.next = 32;
25220
25235
  return getJsonFromUrl(registfileurl);
25221
- case 31:
25236
+ case 32:
25222
25237
  regdataobj = _context.sent;
25223
25238
  if (regdataobj && regdataobj.registdata) {
25224
25239
  mxCadObj.initRegist(regdataobj.registdata);
25225
25240
  } else {
25226
25241
  console.log("MxTip:empty regist data");
25227
25242
  }
25228
- case 33:
25243
+ case 34:
25229
25244
  getMxreleaseidId().then(function (val) {
25230
25245
  mxCadObj.getImp().SetAppId(val);
25231
25246
  });
@@ -25234,6 +25249,15 @@ var createMxCad = /*#__PURE__*/function () {
25234
25249
  onOpenFileComplete && onOpenFileComplete(mxCadObj);
25235
25250
  });
25236
25251
  if (mxcadobj) {
25252
+ if (browse === true) {
25253
+ mxcadobj.setBrowse(true);
25254
+ if (mouseMiddlePan === void 0) {
25255
+ mouseMiddlePan = 0;
25256
+ }
25257
+ }
25258
+ if (mouseMiddlePan !== void 0) {
25259
+ mxcadobj.mxdraw.setMouseMiddlePan(mouseMiddlePan);
25260
+ }
25237
25261
  mxcadobj.callEvent("init_mxcad", mxCadObj);
25238
25262
  }
25239
25263
  if (fileUrl) {
@@ -25244,7 +25268,7 @@ var createMxCad = /*#__PURE__*/function () {
25244
25268
  mxCadObj.openWebFile(fileUrl, void 0, true, openParameter, fetchAttributes);
25245
25269
  }
25246
25270
  return _context.abrupt("return", mxCadObj);
25247
- case 39:
25271
+ case 40:
25248
25272
  case "end":
25249
25273
  return _context.stop();
25250
25274
  }