Fix progetto CSharp x demo 3d slicer
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.StaticFiles;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Web3D.pack.Data;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// configuration setup
|
||||
Microsoft.Extensions.Configuration.ConfigurationManager configuration = builder.Configuration;
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddRazorPages();
|
||||
builder.Services.AddServerSideBlazor();
|
||||
@@ -24,6 +29,7 @@ if (!app.Environment.IsDevelopment())
|
||||
var provider = new Microsoft.AspNetCore.StaticFiles.FileExtensionContentTypeProvider();
|
||||
// NOTE: Add new mappings
|
||||
provider.Mappings[".3mf"] = "model"; // NOTE: add the extension (with period) and its type
|
||||
provider.Mappings[".3dm"] = "model"; // NOTE: add the extension (with period) and its type
|
||||
|
||||
|
||||
|
||||
@@ -36,6 +42,39 @@ app.UseStaticFiles(new StaticFileOptions // NOTE: replace the line app.UseStatic
|
||||
ContentTypeProvider = provider
|
||||
});
|
||||
|
||||
// gestione static files x modelli 3D: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-8.0
|
||||
string path3mf = configuration.GetValue<string>("ServerConf:path3mf") ?? configuration.GetValue<string>("OptConf:path3mf") ?? "";
|
||||
if (!string.IsNullOrEmpty(path3mf))
|
||||
{
|
||||
// verifico esista folder disegni
|
||||
if (Directory.Exists(path3mf))
|
||||
{
|
||||
// gestione cartella x PDF
|
||||
app.UseStaticFiles(new StaticFileOptions
|
||||
{
|
||||
FileProvider = new PhysicalFileProvider(path3mf),
|
||||
RequestPath = "/3mf",
|
||||
ContentTypeProvider = provider
|
||||
});
|
||||
}
|
||||
}
|
||||
string path3dm = configuration.GetValue<string>("ServerConf:path3dm") ?? configuration.GetValue<string>("OptConf:path3dm") ?? "";
|
||||
if (!string.IsNullOrEmpty(path3dm))
|
||||
{
|
||||
// verifico esista folder disegni
|
||||
if (Directory.Exists(path3dm))
|
||||
{
|
||||
// gestione cartella x PDF
|
||||
app.UseStaticFiles(new StaticFileOptions
|
||||
{
|
||||
FileProvider = new PhysicalFileProvider(path3dm),
|
||||
RequestPath = "/3dm",
|
||||
ContentTypeProvider = provider
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseStaticFiles();
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="wwwroot\lib\node_modules\.package-lock.json" />
|
||||
<Content Include="wwwroot\lib\node_modules\webgl-visualizer\models\.placeholder" />
|
||||
<Content Include="wwwroot\lib\node_modules\webgl-visualizer\models\3mf\Cubo.3mf" />
|
||||
<Content Include="wwwroot\lib\node_modules\webgl-visualizer\package.json" />
|
||||
<Content Include="wwwroot\lib\node_modules\webgl-visualizer\styles\bottom.png" />
|
||||
<Content Include="wwwroot\lib\node_modules\webgl-visualizer\styles\left.png" />
|
||||
<Content Include="wwwroot\lib\node_modules\webgl-visualizer\styles\LogoClassic_NoText.png" />
|
||||
<Content Include="wwwroot\lib\node_modules\webgl-visualizer\styles\right.png" />
|
||||
<Content Include="wwwroot\lib\node_modules\webgl-visualizer\styles\SuperTopLogo.png" />
|
||||
<Content Include="wwwroot\lib\node_modules\webgl-visualizer\styles\top.png" />
|
||||
|
||||
@@ -5,5 +5,9 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"AllowedHosts": "*",
|
||||
"ServerConf": {
|
||||
"path3mf": "\\\\iis01\\Test3D\\3mf",
|
||||
"path3dm": "\\\\iis01\\Test3D\\3dm"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
{
|
||||
"version": "1.0",
|
||||
"defaultProvider": "filesystem",
|
||||
"libraries": [
|
||||
{
|
||||
"library": "C:\\Users\\zaccaria.majid\\Downloads\\package",
|
||||
"destination": "wwwroot/lib/package/"
|
||||
},
|
||||
{
|
||||
"library": "C:\\Users\\zaccaria.majid\\Downloads\\",
|
||||
"destination": "wwwroot/lib/Downloads/",
|
||||
"files": [
|
||||
"webgl-visualizer-1.1.230926-beta.842.tgz"
|
||||
]
|
||||
}
|
||||
]
|
||||
//"libraries": [
|
||||
// {
|
||||
// "library": "C:\\Users\\zaccaria.majid\\Downloads\\package",
|
||||
// "destination": "wwwroot/lib/package/"
|
||||
// },
|
||||
// {
|
||||
// "library": "C:\\Users\\zaccaria.majid\\Downloads\\",
|
||||
// "destination": "wwwroot/lib/Downloads/",
|
||||
// "files": [
|
||||
// "webgl-visualizer-1.1.230926-beta.842.tgz"
|
||||
// ]
|
||||
// }
|
||||
//]
|
||||
}
|
||||
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
Generated
Vendored
+39
-39
@@ -316,45 +316,45 @@ function AdaptSeceneToContest() {
|
||||
window.addEventListener('resize', onWindowResize);
|
||||
|
||||
// calcolo origine
|
||||
const points_array = [ new THREE.Vector3( 0, 0, 0)] ;
|
||||
var ORIG_Geometry = new THREE.BufferGeometry() ;
|
||||
ORIG_Geometry.setFromPoints( points_array) ;
|
||||
var ORIG_Material = new THREE.PointsMaterial({ size: 5, sizeAttenuation : true, color : new THREE.Color( 0x000000)});
|
||||
ORIG = new THREE.Points( ORIG_Geometry, ORIG_Material) ;
|
||||
SetOrig( ORIG) ;
|
||||
|
||||
// creazione sistema di riferimento nell'origine
|
||||
const axesHelper = new THREE.AxesHelper( 75 ) ;
|
||||
axesHelper.rotation.set( -Math.PI/2, 0 ,0) ;
|
||||
axesHelper.position.set( ORIG.position.x, ORIG.position.y, ORIG.position.z) ;
|
||||
scene.add( axesHelper );
|
||||
|
||||
// creazione della griglia (V1 = finita, V2 = infinita)
|
||||
const size = 1000000 ;
|
||||
const divisions = 10000 ;
|
||||
if ( ! m_bGrid_v1) {
|
||||
// GRIGLIA INFINITA
|
||||
const gridHelper = new THREE.GridHelper( size, divisions) ;
|
||||
gridHelper.position.set( ORIG.position.x, ORIG.position.y, ORIG.position.z) ;
|
||||
gridHelper.material.transparent = true ;
|
||||
gridHelper.material.opacity = 0.25 ;
|
||||
setFog() ;
|
||||
scene.add( gridHelper) ;
|
||||
}
|
||||
else {
|
||||
// GRIGLIA FINITA
|
||||
// prendo dimensione del Box
|
||||
var dDimX = Math.abs( GLBox3D.max.x - GLBox3D.min.x) ;
|
||||
var dDimY = Math.abs( GLBox3D.max.y - GLBox3D.min.y) ;
|
||||
var dDimZ = Math.abs( GLBox3D.max.z - GLBox3D.min.z) ;
|
||||
var dDim = 1.5 * Math.sqrt( dDimX * dDimX + dDimY * dDimY + dDimZ * dDimZ) ;
|
||||
const gridHelper = new THREE.GridHelper( dDim, Math.ceil( 0.1 * dDim)) ;
|
||||
gridHelper.position.set( ORIG.position.x + 0.5 * dDim , ORIG.position.y, ORIG.position.z - 0.5 * dDim) ;
|
||||
gridHelper.material.transparent = true ;
|
||||
gridHelper.material.opacity = 0.45 ;
|
||||
scene.add( gridHelper) ;
|
||||
|
||||
}
|
||||
const points_array = [ new THREE.Vector3( 0, 0, 0)] ;
|
||||
var ORIG_Geometry = new THREE.BufferGeometry() ;
|
||||
ORIG_Geometry.setFromPoints( points_array) ;
|
||||
var ORIG_Material = new THREE.PointsMaterial({ size: 5, sizeAttenuation : true, color : new THREE.Color( 0x000000)});
|
||||
ORIG = new THREE.Points( ORIG_Geometry, ORIG_Material) ;
|
||||
SetOrig( ORIG) ;
|
||||
|
||||
// creazione sistema di riferimento nell'origine
|
||||
const axesHelper = new THREE.AxesHelper( 75 ) ;
|
||||
axesHelper.rotation.set( -Math.PI/2, 0 ,0) ;
|
||||
axesHelper.position.set( ORIG.position.x, ORIG.position.y, ORIG.position.z) ;
|
||||
scene.add( axesHelper );
|
||||
|
||||
// creazione della griglia (V1 = finita, V2 = infinita)
|
||||
const size = 1000000 ;
|
||||
const divisions = 10000 ;
|
||||
if ( ! m_bGrid_v1) {
|
||||
// GRIGLIA INFINITA
|
||||
const gridHelper = new THREE.GridHelper( size, divisions) ;
|
||||
gridHelper.position.set( ORIG.position.x, ORIG.position.y, ORIG.position.z) ;
|
||||
gridHelper.material.transparent = true ;
|
||||
gridHelper.material.opacity = 0.25 ;
|
||||
setFog() ;
|
||||
scene.add( gridHelper) ;
|
||||
}
|
||||
else {
|
||||
// GRIGLIA FINITA
|
||||
// prendo dimensione del Box
|
||||
var dDimX = Math.abs( GLBox3D.max.x - GLBox3D.min.x) ;
|
||||
var dDimY = Math.abs( GLBox3D.max.y - GLBox3D.min.y) ;
|
||||
var dDimZ = Math.abs( GLBox3D.max.z - GLBox3D.min.z) ;
|
||||
var dDim = 1.5 * Math.sqrt( dDimX * dDimX + dDimY * dDimY + dDimZ * dDimZ) ;
|
||||
const gridHelper = new THREE.GridHelper( dDim, Math.ceil( 0.1 * dDim)) ;
|
||||
gridHelper.position.set( ORIG.position.x + 0.5 * dDim , ORIG.position.y, ORIG.position.z - 0.5 * dDim) ;
|
||||
gridHelper.material.transparent = true ;
|
||||
gridHelper.material.opacity = 0.45 ;
|
||||
scene.add( gridHelper) ;
|
||||
|
||||
}
|
||||
|
||||
render();
|
||||
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -127,7 +127,7 @@ function setLoaders() {
|
||||
cDiv[i].style.border = '#afc5d6';
|
||||
cDiv[i].style.backgroundSize = 'contain';
|
||||
|
||||
cDiv[i].style.backgroundImage = 'url(~/styles/LogoClassic_NoText.png)'
|
||||
cDiv[i].style.backgroundImage = 'url(images/LogoClassic_NoText.png)'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ function init() {
|
||||
let startTime = performance.now();
|
||||
return new Promise(() => {
|
||||
setTimeout(() => {
|
||||
loader.load('~/models/3mf/' + fName, function (object) {
|
||||
loader.load('3mf/' + fName, function (object) {
|
||||
object.rotation.set(-Math.PI / 2, 0, 0);
|
||||
object.traverse(function (child) {
|
||||
child.castShadow = true;
|
||||
|
||||
Reference in New Issue
Block a user