Basic STL loader for SceneKit

Overview

HxSTLParser

Platform Language Carthage Compatible License


HxSTLParser is a basic STL parser capable of loading STL files into an SCNNode.

Installing

Via Carthage

Just add it to your Cartfile

github "victorgama/HxSTLParser"

Then run:

$ carthage update

Via Cocoapods

Just add HxSTLParser to your Podfile:

platform :ios, '8.0'
use_frameworks!

pod 'HxSTLParser', '1.0.0'

Usage

#import <HxSTLParser/HxSTLParser.h>

- (void)loadStl {
    STLParser *parser = [[STLParser alloc] init];
    NSError *error = nil;
    NSString *fileContents = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"3dObject" ofType:@"stl"] encoding:NSASCIIStringEncoding error:nil];
    SCNNode *node = [parser loadFromString:fileContents error:&error];
    if(error != nil) {
        NSLog(@"Something went wrong: %@", error);
        return;
    }
    SCNScene *scene = [[SCNScene alloc] init];
    // ...configure your scene
    [scene.rootNode addChildNode:node];
}

License

The MIT License (MIT)

Copyright (c) 2016 Victor Gama

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

You might also like...
BioViewer - Protein (.pdb, .cif and .fasta) viewer for iPhone, iPad and Mac, using SwiftUI + SceneKit
BioViewer - Protein (.pdb, .cif and .fasta) viewer for iPhone, iPad and Mac, using SwiftUI + SceneKit

BioViewer - Protein (.pdb, .cif and .fasta) viewer for iPhone, iPad and Mac, using SwiftUI + SceneKit

Swift framework for loading various 3d models in SceneKit

AssetImportKit AssetImportKit is a cross platform library (macOS, iOS) that coverts the files supported by Assimp to SceneKit scenes. Features AssetIm

SpriteKit 2D Breakout Game on rotating 3D SceneKit cube almost no code
SpriteKit 2D Breakout Game on rotating 3D SceneKit cube almost no code

2D Breakout game playable as texture on a rotating cube An Xcode12 project for iOS that implements a simple 2D SpriteKit "Break Out" style game. The S

360 video player for iOS written in swift - a subset of SceneKit that works
360 video player for iOS written in swift - a subset of SceneKit that works

DDDKit An open source library to support 360 videos and pictures. It's designed as a generic 3D library that you can use for much more! Example of use

Simple 360 Video player for iOS using SceneKit
Simple 360 Video player for iOS using SceneKit

simple360player_iOS Simple 360 Video player for iOS using SceneKit. VR ready. Stereoscopic Ready. We generate a simple scene in which we add a sphere

SwiftUI & Scenekit hit testing example.

HitTestApp SwiftUI & Scenekit hit testing example. This example application is written for macOS, though with minor changes it should be able to be ch

ARDicee - Simple augmented reality app using SceneKit and ARKit
ARDicee - Simple augmented reality app using SceneKit and ARKit

ARDicee Simple augmented reality app using SceneKit and ARKit Requirements Xcode

DroneShopSwiftUI - Drone Shop App made with SwiftUI and Scenekit
DroneShopSwiftUI - Drone Shop App made with SwiftUI and Scenekit

DroneShopSwiftUI Drone Shop App made with SwiftUI and Scenekit.

AR Ruler - A simple iOS app made using ARKit and SceneKit
AR Ruler - A simple iOS app made using ARKit and SceneKit

A simple iOS app made using ARKit and SceneKit.Which can try to simplify little things in your life such as measuring stuff.

Swift framework for loading various 3d models in SceneKit

AssetImportKit AssetImportKit is a cross platform library (macOS, iOS) that coverts the files supported by Assimp to SceneKit scenes. Features AssetIm

🍞 An async waiting toast with basic toast. Inspired by facebook posting toast
🍞 An async waiting toast with basic toast. Inspired by facebook posting toast

AwaitToast 🍞 An async waiting toast with basic toast. Inspired by facebook posting toast. Introduction Usage Default let toast: Toast = Toast.default

Basic Todo list application built using the new SwiftUI framework and Core Data
Basic Todo list application built using the new SwiftUI framework and Core Data

Dub Dub Do - A sample TODO List Application in SwiftUI Updated for Xcode 11.5 This is a basic app that lets you create a list of todos, mark them as i

✨ Basic lists from iOS 2 to iOS 14
✨ Basic lists from iOS 2 to iOS 14

listapp.ios Basic lists on iOS ✨ UITableView iOS 2* Objective-C 2008 UITableView iOS 2* Swift 2008 diff UICollectionView iOS 6 2012 diff Compositional

A very basic proof-of-concept Swift HTTP server that does not require Foundation

Swift Server Introduction This is very rough and basic HTTP server written in Swift without using Foundation. This is partially based on the Swifter r

Automatically audit your Mac for basic security hygiene.
Automatically audit your Mac for basic security hygiene.

Automatically audit your Mac for basic security hygiene The simplest security is the most important. 80% of hacks are caused by 20% of common preventa

Core Charts | Basic Scrollable Chart Library for iOS
Core Charts | Basic Scrollable Chart Library for iOS

Core Charts | Basic Chart Library for iOS HCoreBarChart VCoreBarChart Requirements Installation Usage Appearance Customization Getting Started You nee

Basic app to show how to login with Facebook, Google, Twitter. Created for learning purpose :) using Xcode 9 and Swift 4.0
Basic app to show how to login with Facebook, Google, Twitter. Created for learning purpose :) using Xcode 9 and Swift 4.0

Social Logins iOS Basic app to show how to login with Facebook, Google, Twitter. Created for learning purpose :) using Xcode 9 and Swift 4.0 Note: Bef

Basic Unsplash client for iOS made with SwiftUI (beta).
Basic Unsplash client for iOS made with SwiftUI (beta).

PapersSwiftUI Basic Unsplash client for iOS made with SwiftUI (beta). Note SwiftUI is still in beta and I'm also still learning how it works. To-Do: P

Basic iOS app template for Integrate Branch Day.

Integrate-Branch-Day-Template Basic iOS app template for Integrate Branch Day. How to prepare for Integrate Branch Day: Install Xcode via Self Service

Comments
  • Memory issue with large models

    Memory issue with large models

    Hi im getting terminated due to memory issue. When parsing large stl files. for example:

    https://www.thingiverse.com/thing:3495390/files

    Is there any way to get around this? Would love some input!

    opened by tobyworks 0
Owner
Victor "Vito" Gama
They call me Vito. 20-something software engineer. A wolf in Unix clothing. =(◉ᴥ◉)=
Victor
SceneKit-MetalShader-SCNProgram - SceneKit MetalShader SCNProgram

SceneKit-MetalShader-SCNProgram Tech SceneKit (SCNProgram -> SCNGeometry or SCNM

null 1 Jul 16, 2022
VidyoPlatform Basic CustomLayouts Reference App for iOS (Swift)VidyoPlatform Basic CustomLayouts Reference App for iOS (Swift)

VidyoPlatform Basic CustomLayouts Reference App for iOS (Swift) VidyoPlatform reference application highlighting how to integrate video chat into a na

Taras Melko 0 Nov 19, 2021
A lightweight and fast image loader for iOS written in Swift.

ImageLoader ImageLoader is an instrument for asynchronous image loading written in Swift. It is a lightweight and fast image loader for iOS. Features

Hirohisa Kawasaki 293 Nov 24, 2022
Spinner loader components with liquid animation

LiquidLoader LiquidLoader is the spinner loader UI components with liquid animation, inspired by Spinner Loader - Gooey light Effect [] (https://githu

Takuma Yoshida 1.3k Dec 21, 2022
An extremely high-performance, lightweight, and energy-efficient pure Swift async web image loader with memory and disk caching for iOS and  Watch.

KFSwiftImageLoader KFSwiftImageLoader is an extremely high-performance, lightweight, and energy-efficient pure Swift async web image loader with memor

Kiavash Faisali 343 Oct 29, 2022
Animated sharingan loader for iOS projects.

Animated sharingan loader for iOS projects. This is a fun project created using SwiftUI with love for the Uchiha clan. More types of eyes to come with tons of customizations...

Manas Aggarwal 16 Nov 30, 2022
Very easy to use image loader for swift

Silo Silo is a extremely easy to use and very basic image loader for iOS built in Swift. if you use Silo in your project please let me know! Version 2

Jose Quintero 17 Dec 17, 2022
A Wordpress Article Loader for SwiftUI.

SwiftUIWPArticleLoader Hello to WPArticleLoader! With the WPArticleLoader, you can easily load Articles from your WordPress Website. How to use? The u

Torben Köhler 10 Sep 27, 2022
Swift RSA Key Loader

Swift RSA Key Loader Requirements iOS 9.0+ Installation See the subsections below for details about the different installation methods. Swift Package

Dmytrii Golovanov 1 Jun 13, 2022
ARVoxelKit - Lightweight Framework for Voxel graphic using AR + SceneKit

ARVoxelKit Lightweight Framework for Voxel graphic using AR + SceneKit Requirements ARVoxelKit requires iOS 11 and devices, which support ARKit Usage

null 79 Dec 29, 2022