mxcad 1.0.388 → 1.0.390

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
@@ -8383,6 +8383,43 @@ export declare class McDbProxyEntity extends McDbEntity {
8383
8383
  }
8384
8384
  /**
8385
8385
  * 光栅图片类,该类用于在CAD中显示光栅图形
8386
+ * @example
8387
+ * ```ts
8388
+ import { MxCpp, McGePoint3d, McDbRasterImage, McGeVector3d } from "mxcad";
8389
+
8390
+ //画图片
8391
+ function drawImg() {
8392
+ const mxcad = MxCpp.getCurrentMxCAD();
8393
+ // 创建新画布
8394
+ mxcad.newFile();
8395
+ //图片地址
8396
+ let imagUrl = "https://cdn.pixabay.com/photo/2022/11/15/12/23/winter-7593872_960_720.jpg";
8397
+ mxcad.loadImage(imagUrl, (image) => {
8398
+ if (!image) {
8399
+ console.log("loadImage failed");
8400
+ return;
8401
+ }
8402
+ let width = mxcad.mxdraw.viewCoordLong2Cad(100);
8403
+ let height = (image.height / image.width) * width;
8404
+ const id = mxcad.addImageDefine(imagUrl, "winter-7593872_960_720.jpg", true);
8405
+ const img = new McDbRasterImage();
8406
+ img.setImageDefId(id);
8407
+ img.setDwgImageSize(image.width, image.height);
8408
+ const origin = new McGePoint3d(0, 0, 0);
8409
+
8410
+ const uCorner = McGeVector3d.kXAxis.clone();
8411
+ uCorner.mult(width);
8412
+
8413
+ const vOnPlane = McGeVector3d.kYAxis.clone();
8414
+ vOnPlane.mult(height);
8415
+
8416
+ img.setOrientation(origin, uCorner, vOnPlane);
8417
+ mxcad.drawEntity(img);
8418
+ //mxcad.drawImage((pt as any).x, (pt as any).y, width, height, 0, imagUrl,true,image.width,image.height);
8419
+ mxcad.updateDisplay();
8420
+ });
8421
+ };
8422
+ * ```
8386
8423
  */
8387
8424
  export declare class McDbRasterImage extends McDbEntity {
8388
8425
  /**
@@ -8438,12 +8475,10 @@ export declare class McDbRasterImage extends McDbEntity {
8438
8475
  };
8439
8476
  /**
8440
8477
  * 设置保存dwg文件时,图片的宽高像素。
8441
- * ```
8442
8478
  */
8443
8479
  setDwgImageSize(width: number, height: number): boolean;
8444
8480
  /**
8445
8481
  * 返回dwg文件中的图片的宽高像素。
8446
- * ```
8447
8482
  */
8448
8483
  getDwgImageSize(): number[];
8449
8484
  /**
@@ -8461,7 +8496,7 @@ export declare class McDbRasterImage extends McDbEntity {
8461
8496
  */
8462
8497
  setImageDefId(imageId: McObjectId): void;
8463
8498
  /**
8464
- * 获取图像的定义I
8499
+ * 获取图像的定义ID
8465
8500
  * @example
8466
8501
  * ```ts
8467
8502
  * //假设 rasterImage 为光栅图片实例
@@ -8530,7 +8565,6 @@ export declare class McDbRasterImage extends McDbEntity {
8530
8565
  export declare class McDbWipeout extends McDbEntity {
8531
8566
  /**
8532
8567
  * 构造函数。
8533
- * ```
8534
8568
  */
8535
8569
  constructor(x?: object);
8536
8570
  /**
@@ -8589,7 +8623,6 @@ export declare class McDbSpline extends McDbCurve {
8589
8623
  /**
8590
8624
  * 得到样条线的数据.
8591
8625
  * @example
8592
- * ```
8593
8626
  */
8594
8627
  getNurbsData(): {
8595
8628
  degree: number;
@@ -8605,7 +8638,7 @@ export declare class McDbSpline extends McDbCurve {
8605
8638
  /**
8606
8639
  * 设置样条线的数据.
8607
8640
  * @example
8608
- * ```
8641
+ *
8609
8642
  */
8610
8643
  setNurbsData(data: {
8611
8644
  degree: number;
@@ -8621,7 +8654,6 @@ export declare class McDbSpline extends McDbCurve {
8621
8654
  /**
8622
8655
  * 得到样条线的拟合数据.
8623
8656
  * @example
8624
- * ```
8625
8657
  */
8626
8658
  getFitPoints(): {
8627
8659
  degree: number;
@@ -8634,7 +8666,6 @@ export declare class McDbSpline extends McDbCurve {
8634
8666
  /**
8635
8667
  *设置样条线的拟合数据.
8636
8668
  * @example
8637
- * ```
8638
8669
  */
8639
8670
  setFitPoints(data: {
8640
8671
  degree: number;
@@ -8651,7 +8682,7 @@ export declare class McDbSpline extends McDbCurve {
8651
8682
  * ```ts
8652
8683
  * ```
8653
8684
  */
8654
- export declare class McDbXline extends McDbEntity {
8685
+ export declare class McDbXline extends McDbCurve {
8655
8686
  /**
8656
8687
  * 构造函数。
8657
8688
  * @param imp 内部对象。
@@ -8721,7 +8752,7 @@ export declare class McDbXline extends McDbEntity {
8721
8752
  * ```ts
8722
8753
  * ```
8723
8754
  */
8724
- export declare class McDbRay extends McDbEntity {
8755
+ export declare class McDbRay extends McDbCurve {
8725
8756
  /**
8726
8757
  * 构造函数。
8727
8758
  * @param imp 内部对象。
@@ -16599,6 +16630,7 @@ export declare function postMemoryFile(memoryData: any, url: string, filename: s
16599
16630
  export declare function postEmscriptenIndexedDBFile(filekey: string, url: string, retCall: (code: number, message: string) => void, param?: any): void;
16600
16631
  export declare function createCursor(cursorSize?: number, targetFrameSize?: number, color?: string): any;
16601
16632
  export declare function createMdGeLongLongArrayFormAryId(aryId: McObjectId[]): any;
16633
+ export declare function copyMcDbEntityProperties(fromEnt: McDbEntity, toEnt: McDbEntity): void;
16602
16634
  export declare const MxTools: {
16603
16635
  b64Encode: typeof b64Encode;
16604
16636
  b64Decode: typeof b64Decode;
@@ -16613,6 +16645,7 @@ export declare const MxTools: {
16613
16645
  postMemoryFile: typeof postMemoryFile;
16614
16646
  createCursor: typeof createCursor;
16615
16647
  createMdGeLongLongArrayFormAryId: typeof createMdGeLongLongArrayFormAryId;
16648
+ copyMcDbEntityProperties: typeof copyMcDbEntityProperties;
16616
16649
  };
16617
16650
  export declare class MxCanvas2Image {
16618
16651
  private $support;
package/dist/mxcad.es.js CHANGED
@@ -14596,7 +14596,7 @@ win.McDrawObjectEvent_asciiToUTF8 = function (hexstr) {
14596
14596
  return MxG2312Obj.decodeFromGb2312Imp(hexstr);
14597
14597
  };
14598
14598
 
14599
- const version$1 = "1.0.387";
14599
+ const version$1 = "1.0.389";
14600
14600
 
14601
14601
  var isSharedArrayBuffer = "SharedArrayBuffer" in window;
14602
14602
  var isCdn = document.currentScript && /unpkg\.com\/mxcad/.test(document.currentScript.src);
@@ -19256,8 +19256,8 @@ var McDbSpline = /*#__PURE__*/function (_McDbCurve6) {
19256
19256
  }]);
19257
19257
  return McDbSpline;
19258
19258
  }(McDbCurve);
19259
- var McDbXline = /*#__PURE__*/function (_McDbEntity10) {
19260
- _inherits$1(McDbXline, _McDbEntity10);
19259
+ var McDbXline = /*#__PURE__*/function (_McDbCurve7) {
19260
+ _inherits$1(McDbXline, _McDbCurve7);
19261
19261
  var _super25 = _createSuper$9(McDbXline);
19262
19262
  function McDbXline(imp) {
19263
19263
  var _this21;
@@ -19296,9 +19296,9 @@ var McDbXline = /*#__PURE__*/function (_McDbEntity10) {
19296
19296
  }
19297
19297
  }]);
19298
19298
  return McDbXline;
19299
- }(McDbEntity);
19300
- var McDbRay = /*#__PURE__*/function (_McDbEntity11) {
19301
- _inherits$1(McDbRay, _McDbEntity11);
19299
+ }(McDbCurve);
19300
+ var McDbRay = /*#__PURE__*/function (_McDbCurve8) {
19301
+ _inherits$1(McDbRay, _McDbCurve8);
19302
19302
  var _super26 = _createSuper$9(McDbRay);
19303
19303
  function McDbRay(imp) {
19304
19304
  var _this22;
@@ -19337,9 +19337,9 @@ var McDbRay = /*#__PURE__*/function (_McDbEntity11) {
19337
19337
  }
19338
19338
  }]);
19339
19339
  return McDbRay;
19340
- }(McDbEntity);
19341
- var McDbMxRegion = /*#__PURE__*/function (_McDbEntity12) {
19342
- _inherits$1(McDbMxRegion, _McDbEntity12);
19340
+ }(McDbCurve);
19341
+ var McDbMxRegion = /*#__PURE__*/function (_McDbEntity10) {
19342
+ _inherits$1(McDbMxRegion, _McDbEntity10);
19343
19343
  var _super27 = _createSuper$9(McDbMxRegion);
19344
19344
  function McDbMxRegion(imp) {
19345
19345
  var _this23;
@@ -19417,8 +19417,8 @@ var McDbMxRegion = /*#__PURE__*/function (_McDbEntity12) {
19417
19417
  }]);
19418
19418
  return McDbMxRegion;
19419
19419
  }(McDbEntity);
19420
- var McDbViewport = /*#__PURE__*/function (_McDbEntity13) {
19421
- _inherits$1(McDbViewport, _McDbEntity13);
19420
+ var McDbViewport = /*#__PURE__*/function (_McDbEntity11) {
19421
+ _inherits$1(McDbViewport, _McDbEntity11);
19422
19422
  var _super28 = _createSuper$9(McDbViewport);
19423
19423
  function McDbViewport(x) {
19424
19424
  var _this24;
@@ -41995,7 +41995,8 @@ function _Mx_Offset() {
41995
41995
  if (aryObj2.empty()) return;
41996
41996
  aryObj2.forEach(function (obj) {
41997
41997
  if (obj instanceof McDbEntity) {
41998
- pw.drawMcDbEntity(obj);
41998
+ MxTools.copyMcDbEntityProperties(curve2, obj);
41999
+ pw.drawMcDbEntity(obj, false, true);
41999
42000
  }
42000
42001
  });
42001
42002
  });
@@ -42095,6 +42096,7 @@ function _Mx_Offset() {
42095
42096
  if (!isSourceLayer) {
42096
42097
  obj.layer = MxCpp.getCurrentMxCAD().getDatabase().getCurrentlyLayerName();
42097
42098
  }
42099
+ MxTools.copyMcDbEntityProperties(curve, obj);
42098
42100
  var id = MxCpp.getCurrentMxCAD().drawEntity(obj);
42099
42101
  if (isMultiple) retIds.unshift(id);
42100
42102
  }
@@ -47066,6 +47068,14 @@ function createMdGeLongLongArrayFormAryId(aryId) {
47066
47068
  });
47067
47069
  return ids_imp;
47068
47070
  }
47071
+ function copyMcDbEntityProperties(fromEnt, toEnt) {
47072
+ toEnt.layerId = fromEnt.layerId;
47073
+ toEnt.linetypeId = fromEnt.linetypeId;
47074
+ toEnt.linetypeScale = fromEnt.linetypeScale;
47075
+ toEnt.lineweight = fromEnt.lineweight;
47076
+ toEnt.trueColor = fromEnt.trueColor;
47077
+ toEnt.textStyleId = fromEnt.textStyleId;
47078
+ }
47069
47079
  var MxTools = {
47070
47080
  b64Encode: b64Encode,
47071
47081
  b64Decode: b64Decode,
@@ -47079,7 +47089,8 @@ var MxTools = {
47079
47089
  postEmscriptenIndexedDBFile: postEmscriptenIndexedDBFile,
47080
47090
  postMemoryFile: postMemoryFile,
47081
47091
  createCursor: createCursor,
47082
- createMdGeLongLongArrayFormAryId: createMdGeLongLongArrayFormAryId
47092
+ createMdGeLongLongArrayFormAryId: createMdGeLongLongArrayFormAryId,
47093
+ copyMcDbEntityProperties: copyMcDbEntityProperties
47083
47094
  };
47084
47095
 
47085
47096
  var MxCanvas2Image = /*#__PURE__*/function () {
@@ -104214,6 +104225,7 @@ const mxcad = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
104214
104225
  postEmscriptenIndexedDBFile,
104215
104226
  createCursor,
104216
104227
  createMdGeLongLongArrayFormAryId,
104228
+ copyMcDbEntityProperties,
104217
104229
  MxTools,
104218
104230
  MxCanvas2Image,
104219
104231
  McGePoint3d,
@@ -104353,4 +104365,4 @@ globalThis.Buffer = buffer$1.Buffer;
104353
104365
  globalThis.Buffer.alloc = buffer$1.Buffer.alloc;
104354
104366
  globalThis.Buffer.from = buffer$1.Buffer.from;
104355
104367
 
104356
- export { ColorIndexType, ColorMethod, DxfCode, FetchAttributes, IMcDbDwgFiler, IsZero, MLineJustificationType, McAppType, McCmColor, McDb, McDb2LineAngularDimension, McDbAlignedDimension, McDbArc, McDbAttribute, McDbAttributeDefinition, McDbBackgroundEntity, McDbBlockReference, McDbBlockTable, McDbBlockTableRecord, McDbCircle, McDbCurve, McDbCustomEntity, McDbDatabase, McDbDiametricDimension, McDbDictionary, McDbDimStyleTable, McDbDimStyleTableRecord, McDbDimension, McDbEllipse, McDbEntity, McDbGroup, McDbHatch$1 as McDbHatch, McDbLayerTable, McDbLayerTableRecord, McDbLine, McDbLinetypeTable, McDbLinetypeTableRecord, McDbMLine, McDbMText, McDbMxRegion, McDbObject, McDbObjectArray, McDbPoint, McDbPolyline, McDbProxyEntity, McDbRadialDimension, McDbRasterImage, McDbRasterImageDef, McDbRay, McDbRotatedDimension, McDbSpatialFilter, McDbSpline, McDbText, McDbTextStyleTable, McDbTextStyleTableRecord, McDbViewport, McDbWipeout, McDbXline, McDbXlsxTable, McDbXrecord, McGeBound, McGeDoubleArray, McGeLongArray, McGeMatrix3d, McGePoint3d, McGePoint3dArray, McGeStringArray, McGeVector3d, McObject, McObjectId, McObjectIdType, McObjectTempDraw, McRxObject, MxCADBaseCustomElement, MxCADBaseCustomText, MxCADCloneType, MxCADMText, MxCADPluginBase, MxCADPluginMapDefaultData, MxCADPluginSampleCode, MxCADResbuf, MxCADSelectionSet, MxCADSelectionSetStatus, MxCADTempForbiddenIntelliSelect, MxCADUiPrAngle, MxCADUiPrBase, MxCADUiPrDist, MxCADUiPrEntity, MxCADUiPrInt, MxCADUiPrKeyWord, MxCADUiPrPoint, MxCADUiPrPointTransform, MxCADUiPrString, MxCADUtility, MxCADUtilityClass, MxCADWorldDraw, MxCADWorldDrawType, MxCanvas2Image, MxCheckTheBrowser, MxCompare, MxCooperate, MxCoordConvert, MxCoordConvertType, MxCpp, MxCppType, MxMap, MxMapAddGoogleCnLayer, MxMapAddRasterTileLayer, MxModifyColor, MxPropertiesWindowCustom, MxPropertiesWindowCustomValue, MxPropertiesWindowCustomValueType, MxTIFFLoader, MxTools, Mx_About, Mx_Erase, TableRenderDirection, _ML_String, b64Decode, b64Encode, crateHexString, createCursor, createMcCmColor, createMdGeLongLongArrayFormAryId, createMxCad, mxcad as default, downloadFile, downloadFileFromUrl, drawArc, drawCircle, drawEllipticalArc, drawLine, drawMText, drawPolyLine, drawPolygon, drawRectang, drawText, getColorUtils, getFileFromUrl, getFilterImp, getJsonFromUrl, loadMxCADassembly, mx_gcj02_To_gps84, mx_gps84_To_gcj02, postEmscriptenIndexedDBFile, postMemoryFile, saveAsFileDialog, setMcCmColor };
104368
+ export { ColorIndexType, ColorMethod, DxfCode, FetchAttributes, IMcDbDwgFiler, IsZero, MLineJustificationType, McAppType, McCmColor, McDb, McDb2LineAngularDimension, McDbAlignedDimension, McDbArc, McDbAttribute, McDbAttributeDefinition, McDbBackgroundEntity, McDbBlockReference, McDbBlockTable, McDbBlockTableRecord, McDbCircle, McDbCurve, McDbCustomEntity, McDbDatabase, McDbDiametricDimension, McDbDictionary, McDbDimStyleTable, McDbDimStyleTableRecord, McDbDimension, McDbEllipse, McDbEntity, McDbGroup, McDbHatch$1 as McDbHatch, McDbLayerTable, McDbLayerTableRecord, McDbLine, McDbLinetypeTable, McDbLinetypeTableRecord, McDbMLine, McDbMText, McDbMxRegion, McDbObject, McDbObjectArray, McDbPoint, McDbPolyline, McDbProxyEntity, McDbRadialDimension, McDbRasterImage, McDbRasterImageDef, McDbRay, McDbRotatedDimension, McDbSpatialFilter, McDbSpline, McDbText, McDbTextStyleTable, McDbTextStyleTableRecord, McDbViewport, McDbWipeout, McDbXline, McDbXlsxTable, McDbXrecord, McGeBound, McGeDoubleArray, McGeLongArray, McGeMatrix3d, McGePoint3d, McGePoint3dArray, McGeStringArray, McGeVector3d, McObject, McObjectId, McObjectIdType, McObjectTempDraw, McRxObject, MxCADBaseCustomElement, MxCADBaseCustomText, MxCADCloneType, MxCADMText, MxCADPluginBase, MxCADPluginMapDefaultData, MxCADPluginSampleCode, MxCADResbuf, MxCADSelectionSet, MxCADSelectionSetStatus, MxCADTempForbiddenIntelliSelect, MxCADUiPrAngle, MxCADUiPrBase, MxCADUiPrDist, MxCADUiPrEntity, MxCADUiPrInt, MxCADUiPrKeyWord, MxCADUiPrPoint, MxCADUiPrPointTransform, MxCADUiPrString, MxCADUtility, MxCADUtilityClass, MxCADWorldDraw, MxCADWorldDrawType, MxCanvas2Image, MxCheckTheBrowser, MxCompare, MxCooperate, MxCoordConvert, MxCoordConvertType, MxCpp, MxCppType, MxMap, MxMapAddGoogleCnLayer, MxMapAddRasterTileLayer, MxModifyColor, MxPropertiesWindowCustom, MxPropertiesWindowCustomValue, MxPropertiesWindowCustomValueType, MxTIFFLoader, MxTools, Mx_About, Mx_Erase, TableRenderDirection, _ML_String, b64Decode, b64Encode, copyMcDbEntityProperties, crateHexString, createCursor, createMcCmColor, createMdGeLongLongArrayFormAryId, createMxCad, mxcad as default, downloadFile, downloadFileFromUrl, drawArc, drawCircle, drawEllipticalArc, drawLine, drawMText, drawPolyLine, drawPolygon, drawRectang, drawText, getColorUtils, getFileFromUrl, getFilterImp, getJsonFromUrl, loadMxCADassembly, mx_gcj02_To_gps84, mx_gps84_To_gcj02, postEmscriptenIndexedDBFile, postMemoryFile, saveAsFileDialog, setMcCmColor };