@buerli.io/react-cad 0.13.1-beta.11 → 0.13.1-beta.13

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.
@@ -22933,17 +22933,15 @@ const FileUtils = {
22933
22933
  const format = (type === 'step' ? 'stp' : type).toUpperCase();
22934
22934
  const res = isRoot ? await classcad.createApi(drawingId).v1.common.save({
22935
22935
  format,
22936
- encoding: 'base64',
22937
- compression: 'deflate'
22936
+ encoding: 'base64'
22938
22937
  }).catch(console.warn) : await classcad.createApi(drawingId).v1.assembly.exportNode({
22939
22938
  id: objectId,
22940
22939
  format: format,
22941
- encoding: 'base64',
22942
- compression: 'deflate'
22940
+ encoding: 'base64'
22943
22941
  }).catch(console.warn);
22944
22942
  const content = res == null ? void 0 : (_res$result = res.result) == null ? void 0 : _res$result.content;
22945
22943
  if (content) {
22946
- const data = classcad.compression.inflateFromBase64(content);
22944
+ const data = atob(content);
22947
22945
  const link = document.createElement('a');
22948
22946
  link.href = window.URL.createObjectURL(new Blob([data], {
22949
22947
  type: 'application/octet-stream'
@@ -27900,15 +27898,13 @@ function RootImpl$2({
27900
27898
  };
27901
27899
  reader.readAsArrayBuffer(file);
27902
27900
  });
27903
- const data = typeof result !== 'string' ? classcad.compression.deflateToBase64(result) : result;
27901
+
27904
27902
  // TODO: Handle the format differently. It would probably be good to check the format beforehand, and avoid calling the API if it is wrong.
27905
27903
  return classcad.createApi(drawingId).v1.part.updateImportFeature({
27906
27904
  id: objectId,
27907
27905
  name,
27908
- data,
27909
- format: type,
27910
- encoding: 'base64',
27911
- compression: 'deflate'
27906
+ data: result,
27907
+ format: type
27912
27908
  }).finally(() => isUpdating.current = false);
27913
27909
  }, [drawingId, objectId, fileParam]);
27914
27910
  const validate = React.useCallback(() => {
@@ -28469,12 +28465,9 @@ const ImportModel = ({
28469
28465
  const type = pathBrowserify.extname(file.name).replace('.', '');
28470
28466
  const format = (type === 'step' ? 'stp' : type).toUpperCase();
28471
28467
  if (['OFB', 'STP'].includes(format)) {
28472
- const data = typeof content !== 'string' ? classcad.compression.deflateToBase64(content) : content;
28473
28468
  classcad.createApi(drawingId).v1.assembly.loadProduct({
28474
- data,
28475
- format: format,
28476
- encoding: 'base64',
28477
- compression: 'deflate'
28469
+ data: content,
28470
+ format: format
28478
28471
  }).catch(console.warn);
28479
28472
  } else {
28480
28473
  throw new Error('This type of file is not supported to import.');
@@ -28683,16 +28676,16 @@ const load = (file, singleDrawingApp) => {
28683
28676
  const drawingId = await classcad.BuerliCadFacade.utils.connect(file.name).catch(console.warn);
28684
28677
  if (drawingId) {
28685
28678
  try {
28679
+ if (!result) {
28680
+ throw new Error('No data to load!');
28681
+ }
28686
28682
  core.api.getState().api.setActiveDrawing(drawingId);
28687
28683
  const type = pathBrowserify.extname(file.name).replace('.', '');
28688
28684
  const format = (type === 'step' ? 'stp' : type).toUpperCase();
28689
- const data = typeof result !== 'string' ? classcad.compression.deflateToBase64(result) : result;
28690
28685
  if (['OFB', 'STP', 'IWP'].includes(format)) {
28691
28686
  await classcad.createApi(drawingId).v1.common.load({
28692
- data,
28693
- format: format,
28694
- encoding: 'base64',
28695
- compression: 'deflate'
28687
+ data: result,
28688
+ format: format
28696
28689
  }).catch(console.warn);
28697
28690
  } else {
28698
28691
  throw new Error('This type of file is not supported to load.');
package/build/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { useDrawing, CameraHelper, useBuerli, usePlugin, usePluginExists, useFeaturePluginDef, GlobalTransform, BuerliGeometry } from '@buerli.io/react';
2
2
  import * as React from 'react';
3
3
  import React__default, { useState, useCallback, useEffect, useRef, memo, useMemo, useContext, useReducer, forwardRef } from 'react';
4
- import { ccUtils, ScgClassType, createApi as createApi$1, ReorientedType, FlipType, ScgGraphicType, BooleanOperationType, ExtrusionType as ExtrusionType$1, ChamferType, WorkAxisType, WorkPlaneType, WorkPointType, WorkCoordSystemType, compression, BuerliCadFacade } from '@buerli.io/classcad';
4
+ import { ccUtils, ScgClassType, createApi as createApi$1, ReorientedType, FlipType, ScgGraphicType, BooleanOperationType, ExtrusionType as ExtrusionType$1, ChamferType, WorkAxisType, WorkPlaneType, WorkPointType, WorkCoordSystemType, BuerliCadFacade } from '@buerli.io/classcad';
5
5
  import * as THREE from 'three';
6
6
  import { Matrix4 } from 'three';
7
7
  import { getDrawing, createGraphicItem, MemberType, MathUtils, api, showMessage, ExtrusionType, createInfo, getPlugin, BuerliScope, solidFilter, edgeFilter, meshFilter, loopFilter, planeFilter, EntityTypes, Measure, MeasureResultType, pointFilter, lineFilter, arcFilter, circleFilter, arcCircleFilter } from '@buerli.io/core';
@@ -22910,17 +22910,15 @@ const FileUtils = {
22910
22910
  const format = (type === 'step' ? 'stp' : type).toUpperCase();
22911
22911
  const res = isRoot ? await createApi$1(drawingId).v1.common.save({
22912
22912
  format,
22913
- encoding: 'base64',
22914
- compression: 'deflate'
22913
+ encoding: 'base64'
22915
22914
  }).catch(console.warn) : await createApi$1(drawingId).v1.assembly.exportNode({
22916
22915
  id: objectId,
22917
22916
  format: format,
22918
- encoding: 'base64',
22919
- compression: 'deflate'
22917
+ encoding: 'base64'
22920
22918
  }).catch(console.warn);
22921
22919
  const content = res == null ? void 0 : (_res$result = res.result) == null ? void 0 : _res$result.content;
22922
22920
  if (content) {
22923
- const data = compression.inflateFromBase64(content);
22921
+ const data = atob(content);
22924
22922
  const link = document.createElement('a');
22925
22923
  link.href = window.URL.createObjectURL(new Blob([data], {
22926
22924
  type: 'application/octet-stream'
@@ -27877,15 +27875,13 @@ function RootImpl$2({
27877
27875
  };
27878
27876
  reader.readAsArrayBuffer(file);
27879
27877
  });
27880
- const data = typeof result !== 'string' ? compression.deflateToBase64(result) : result;
27878
+
27881
27879
  // TODO: Handle the format differently. It would probably be good to check the format beforehand, and avoid calling the API if it is wrong.
27882
27880
  return createApi$1(drawingId).v1.part.updateImportFeature({
27883
27881
  id: objectId,
27884
27882
  name,
27885
- data,
27886
- format: type,
27887
- encoding: 'base64',
27888
- compression: 'deflate'
27883
+ data: result,
27884
+ format: type
27889
27885
  }).finally(() => isUpdating.current = false);
27890
27886
  }, [drawingId, objectId, fileParam]);
27891
27887
  const validate = React__default.useCallback(() => {
@@ -28446,12 +28442,9 @@ const ImportModel = ({
28446
28442
  const type = extname(file.name).replace('.', '');
28447
28443
  const format = (type === 'step' ? 'stp' : type).toUpperCase();
28448
28444
  if (['OFB', 'STP'].includes(format)) {
28449
- const data = typeof content !== 'string' ? compression.deflateToBase64(content) : content;
28450
28445
  createApi$1(drawingId).v1.assembly.loadProduct({
28451
- data,
28452
- format: format,
28453
- encoding: 'base64',
28454
- compression: 'deflate'
28446
+ data: content,
28447
+ format: format
28455
28448
  }).catch(console.warn);
28456
28449
  } else {
28457
28450
  throw new Error('This type of file is not supported to import.');
@@ -28660,16 +28653,16 @@ const load = (file, singleDrawingApp) => {
28660
28653
  const drawingId = await BuerliCadFacade.utils.connect(file.name).catch(console.warn);
28661
28654
  if (drawingId) {
28662
28655
  try {
28656
+ if (!result) {
28657
+ throw new Error('No data to load!');
28658
+ }
28663
28659
  api.getState().api.setActiveDrawing(drawingId);
28664
28660
  const type = extname(file.name).replace('.', '');
28665
28661
  const format = (type === 'step' ? 'stp' : type).toUpperCase();
28666
- const data = typeof result !== 'string' ? compression.deflateToBase64(result) : result;
28667
28662
  if (['OFB', 'STP', 'IWP'].includes(format)) {
28668
28663
  await createApi$1(drawingId).v1.common.load({
28669
- data,
28670
- format: format,
28671
- encoding: 'base64',
28672
- compression: 'deflate'
28664
+ data: result,
28665
+ format: format
28673
28666
  }).catch(console.warn);
28674
28667
  } else {
28675
28668
  throw new Error('This type of file is not supported to load.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerli.io/react-cad",
3
- "version": "0.13.1-beta.11",
3
+ "version": "0.13.1-beta.13",
4
4
  "description": "buerli CAD components",
5
5
  "author": "AWV Informatik AG <info@awv-informatik.ch>",
6
6
  "repository": {},
@@ -87,8 +87,8 @@
87
87
  "three": ">=0.153"
88
88
  },
89
89
  "dependencies": {
90
- "@buerli.io/classcad": "0.13.1-beta.11",
91
- "@buerli.io/react": "0.13.1-beta.11",
90
+ "@buerli.io/classcad": "0.13.1-beta.13",
91
+ "@buerli.io/react": "0.13.1-beta.13",
92
92
  "@dnd-kit/core": "^6.0.8",
93
93
  "@dnd-kit/modifiers": "^6.0.1",
94
94
  "@dnd-kit/sortable": "^7.0.2",