GithubHelp home page GithubHelp logo

karl- / pb_stl Goto Github PK

View Code? Open in Web Editor NEW
178.0 10.0 43.0 6.22 MB

STL import/export for Unity, supporting both ASCII and Binary.

License: MIT License

C# 100.00%
unity3d stl unity stl-importer unity-editor unity-plugin

pb_stl's Introduction

pb_Stl

An STL importer/exporter for Unity.

pb_Stl is the exporter used in ProBuilder to save STL model files.

stanford_dragon

Install

  1. In the Packages directory of your Unity project, git clone https://github.com/karl-/pb_Stl.git co.parabox.stl

or

  1. Open Packages/manifest.json
  2. Add "co.parabox.stl":"https://github.com/karl-/pb_Stl.git" to the "dependencies" list

Quick Start

  1. Select a GameObject in the Scene View with a MeshFilter and valid Mesh.
  2. In the file menu, Edit > Export > STL (Ascii).
  3. View your shiny new STL file.

Features

  • Export and import Binary & ASCII STL files in editor or at runtime.
  • Custom AssetPostProcessor automatically creates usable prefabs from any STL imported to Unity.
  • Option to convert from left to right handed coordinates (on by default, as per STL spec).
  • Automatic merging of multiple selected meshes, including relative transformations.
  • Import models with vertex counts larger than Unity max by automatically splitting into multiple meshes.

Planned Improvements

  • Export window with additional options:
    • Swap model axis on import/export.
    • Export as multiple objects or merge (currently always merges).
    • Generate normals on import (with smoothing or no).

Troubleshooting

Model is sideways / horizontal / rotated

Unity's coordinate system is left handed, with Y axis as the vertical. Other 3d modeling programs may have different coordinate systems or axis assignments. pb_Stl exports right handed coordinates by default, but can be modified to retain left handed coordinates. Support for swapping axes is planned.

Contributing

If you would like to submit improvements please include NUnit tests for your changes (and make sure they don't break any existing tests).

License

It's MIT.

pb_stl's People

Contributors

alberto-gglez avatar janthiede avatar karl- avatar martinbischoff avatar suzannahsmith1 avatar zdravkon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pb_stl's Issues

Stl import at runtime

I have a question how should I execute the import script during runtime?

I give the path to the Importer.Import() method but nothing happens.
Is there any other parameter that I should add to the method besides the path?

User

You maybe train for me user project or example run unity. Thanks.

this sux plez help

i made something in unity and when i exported it with the stl thing and put in my 3d slicer it was covered in the mesh filter object that i chose please help me

Convert ImportBinary() method to use an byte[]

using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))
{
using (BinaryReader br = new BinaryReader(fs, new ASCIIEncoding()))
{
while (br.BaseStream.Position < br.BaseStream.Length)
{
}
}
}

Would it be as simple as changing this piece to

using (BinaryWriter bw = new BinaryWriter(new MemoryStream()))
{
bw.Write( * byteArray here * );
using (BinaryReader br = new BinaryReader(bw.BaseStream, new ASCIIEncoding()))
{
while (br.BaseStream.Position < br.BaseStream.Length)
{
}
}
}

How can I get STL file from SkinnedMeshRenderer?

I want to get STL file from a morphed animation.
This animation is created on 3DS MAX and I want to get STL file at any time I want.
Play the animation and stop the animation, then export STL file.
But my model is SkinnedMeshRenderer so this plugin is not working well for my model.
Please help me.
Thank you.

Mesh indexformat

With Unity 2017.3 they added the ability to import meshes over 65k vertices by increasing the indexformat to 32 bit. Would it be possible to manually set the indexformat on the stl importer, or have it check for vertice count > 65k and automatically flag it?

Importing STL from Fusion 360 results in gigantic mesh

Hi there, thanks for this tool, it'll be super useful for my workflow. I'm wondering about the dimensions of imported files. I've got a 6 meter diameter ring exported from Fusion, but it's absolutely massive in-game. Here's the imported ring with a 1 meter cube inside for scale. The ring had to be scaled down to 0.0005 on all axes to get it to this size - everything is scaled up 1000x compared to Fusion. Is this expected behavior?

ring around a cube

I have a question about Mesh.

Hello, it's a good day. I would appreciate it if you could understand that I use a translator because I can't speak English.

Mesh[] mesh = Importer.Import(path);

I created STL file that I want to import through the phrase, with several meshes.

But here, the meshes were divided into several pieces, so is there a standard for dividing the pieces?

I'm wondering if there's a way to bring the whole piece or divide it into the pieces you want. #

Vertice count increases drastically on import

An object which Blender tells me have 12k vertices somehow ends up with 70k vertices after using this script to import it to Unity. With Unity's 65k max vertices count pr mesh this is an obvious problem, not to mention performance in general.

I have a question about importing STL during runtime.

https://stackoverflow.com/questions/46733430/convert-mesh-to-stl-obj-fbx-in-runtime
At the end of the answer at the address above, I confirmed and tried that STL can be fetched during runtime.
But the code didn't work as I expected.
The error appeared from the part called pb_stl.
The following is declared using alt + enter to check whether the related namespace is not called.
using Parabox.Stl;
Nevertheless the code showed an error.
please help me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.