diff --git a/packages/viewer-sandbox/src/main.ts b/packages/viewer-sandbox/src/main.ts index 4e1711eec..53ca70084 100644 --- a/packages/viewer-sandbox/src/main.ts +++ b/packages/viewer-sandbox/src/main.ts @@ -39,4 +39,6 @@ viewer.on('load-complete', () => { sandbox.makeGenericUI() sandbox.makeSceneUI() // Load demo object -sandbox.loadUrl('https://latest.speckle.dev/streams/3ed8357f29/commits/b21fb0dcf7') +sandbox.loadUrl( + 'https://speckle.xyz/streams/638d3b1f83/commits/6025e2b546?c=%5B2.18058,-0.20814,9.67642,3.85491,5.05364,0,0,1%5D' +) diff --git a/packages/viewer/src/modules/SceneObjectManager.js b/packages/viewer/src/modules/SceneObjectManager.js index 19106c439..2ee16093a 100644 --- a/packages/viewer/src/modules/SceneObjectManager.js +++ b/packages/viewer/src/modules/SceneObjectManager.js @@ -8,6 +8,7 @@ import SpeckleStandardMaterial from './materials/SpeckleStandardMaterial' import SpeckleLineMaterial from './materials/SpeckleLineMaterial' import SpeckleLineBasicMaterial from './materials/SpeckleLineBasicMaterial' import SpeckleBasicMaterial from './materials/SpeckleBasicMaterial' +import { getConversionFactor } from './converter/Units' /** * Manages objects and provides some convenience methods to focus on the entire scene, or one specific object. */ @@ -234,7 +235,11 @@ export default class SceneObjectManager { if (wrapper.meta.displayStyle) { material = this.lineMaterial.clone() if (wrapper.meta.displayStyle.lineweight > 0) { - material.linewidth = wrapper.meta.displayStyle.lineweight + material.linewidth = + wrapper.meta.displayStyle.lineweight * + getConversionFactor( + wrapper.meta.displayStyle.units ? wrapper.meta.displayStyle.units : 'm' // We default to meters, since we don't have access to the parent's units (in this implementation) + ) material.worldUnits = true material.pixelThreshold = 0.5 } else { diff --git a/packages/viewer/src/modules/converter/Converter.ts b/packages/viewer/src/modules/converter/Converter.ts index 485864b94..3d1467cef 100644 --- a/packages/viewer/src/modules/converter/Converter.ts +++ b/packages/viewer/src/modules/converter/Converter.ts @@ -684,7 +684,16 @@ export default class Coverter { */ async CircleToGeometryData(obj, scale = true) { const conversionFactor = scale ? getConversionFactor(obj.units) : 1 - const points = this.getCircularCurvePoints(obj.plane, obj.radius * conversionFactor) + const points = this.getCircularCurvePoints( + obj.plane, + obj.radius * conversionFactor, + 0, + 2 * Math.PI, + scale + ? this.curveSegmentLength * getConversionFactor(obj.units) + : this.curveSegmentLength, + scale + ) return { attributes: { POSITION: this.FlattenVector3Array(points) @@ -869,10 +878,11 @@ export default class Coverter { radius, startAngle = 0, endAngle = 2 * Math.PI, - res = this.curveSegmentLength + res = this.curveSegmentLength, + scale ) { // Get alignment vectors - const center = this.PointToVector3(plane.origin) + const center = this.PointToVector3(plane.origin, scale) const xAxis = this.PointToVector3(plane.xdir) const yAxis = this.PointToVector3(plane.ydir)