Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating grids and aligning them with uploaded .STLs #33

Open
richardrobrts opened this issue Nov 2, 2023 · 5 comments
Open

Creating grids and aligning them with uploaded .STLs #33

richardrobrts opened this issue Nov 2, 2023 · 5 comments

Comments

@richardrobrts
Copy link

I've created a program that takes in an .STL file input, gets the corresponding URL for the object from the filestream, and renders it with Blazor3D. I'm trying to then add a new GridHelper, whose dimensions are relative to the size of the object rendered, something like GridHelper(Object.Length*2). I thought I had found the correct source for the rendered object's dimensions in the scene's child's Objects.Mesh.Geometry, however since it's a mesh, all of the dimensions are the default values (1,1,1), even if two meshes are vastly different in size.

My question is, is there a way I can find an 'absolute size' or another metric to handle things like varied grid size or camera location?

@richardrobrts
Copy link
Author

Also, this technically isn't the same issue, but whenever I try to rotate one of the meshes, it becomes a cube instead of staying as a mesh. Is there a way to avoid this?

@simutaroman
Copy link
Collaborator

My question is, is there a way I can find an 'absolute size' or another metric to handle things like varied grid size or camera location?

Hi. When you load the stl or any other file type, no info is supplied from JS to .NET side. Please, see #30 for more info.

@simutaroman
Copy link
Collaborator

simutaroman commented Nov 5, 2023

Also, this technically isn't the same issue, but whenever I try to rotate one of the meshes, it becomes a cube instead of staying as a mesh. Is there a way to avoid this?

I have never seen such behavior before. are you trying to rotate programmatically?

@richardrobrts
Copy link
Author

Also, this technically isn't the same issue, but whenever I try to rotate one of the meshes, it becomes a cube instead of staying as a mesh. Is there a way to avoid this?

I have never seen such behavior before. are you trying to rotate programmatically?

if (e.Key == "w") { keyPressMessage = "W key held down"; scene.Children.Last().Rotation.X += 3; View3D1.UpdateScene(); }

Yes, I have code like this for each of the rotation directions. Is this not the intended way?

@simutaroman
Copy link
Collaborator

there are 2 moments:

  • when you load the stl file, information about geometry is NOT sent to the .NET side. so, your c# code knows nothing about current geometry. the default cube geometry is created instead
  • when you use View3D1.UpdateScene(), the scene from .NET part is converted to JSON, then it is sent to JS part. then js scene is cleared and recreated using sent JSON. So, you have default cube geometry instead of loaded file

unfortunately, the current state of the Blazor3D doesn't provide functionality required by you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants