This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Python library to convert CityGML data to STL 3D models printable on FDM 3D printers, such as various RepRap printers.

CityGML versions 2.0.0, 1.0.0 and 0.4.0 are supported. Other versions might work as well.

This is a coursework for Free software GIS class on Faculty of Civil Engineering, Czech Technical University in Prague (academic year 2014/2015, group F). Licensed as MIT (see LICENSE).

CityGML of Alexanderplatz, Berlin, Germany as STL. Data © Research Center Karlsruhe, Institute for Applied Computer Science

Installation

To install, just use regular Python means, such as pip. It is recommended to install Cython before you install this or other requirements. Python 3.3+, 2.7 and pypy are supported.

pip install Cython
pip install citygml2stl

Or if installing from cloned repository or unpacked sources:

pip install Cython
pip install -r requirements.txt
python setup.py install

Usage

To use cityglm2stl from Python proceed as follows:

# import stuff
from citygml2stl import citygml
from citygml2stl import polygons
from citygml2stl import stl

# parse the CityGML file
c = citygml.CityGML('Berlin_Alexanderplatz_v0.4.0.xml')

# export to file berlin.stl
with stl.StlFile('berlin.stl') as berlin:
    # Specify as many types as you want,
    # or leave without arguments to get all city objects
    for obj in c.get_objects_of_types('Building'):
        berlin.write_triangles(polygons.object2triangles(obj))

Or, if you would prefer to have multiple STL files instead:

# initialize a counter for filenames
counter = 0

for obj in c.get_objects_of_types('Building'):
    with stl.StlFile('berlin{}.stl'.format(counter)) as berlin:
        berlin.write_triangles(polygons.object2triangles(obj))
    counter += 1

Note that given the quality of most CityGML data found, the STLs will probably not be valid as the facets will intersect each other. Also given the way the algorithm works, the order of the vertices of a facet is random and will not always follow the right hand rule.

That said, consider that output needs repairing. Use public cloud services such as netfabb Cloud or even open source tools such as ADMesh to repair the output.

You can even use Python’s admesh module to repair the STLs:

import admesh
...

filename = 'berlin{}.stl'.format(counter)
with stl.StlFile(filename) as berlin:
    berlin.write_triangles(polygons.object2triangles(obj))

s = admesh.Stl(filename)
s.repair()

# the results are often located on unthinkable coordinates
s.translate(0, 0, 0)
s.write_binary(filename)

Note that due to limitations of the admesh module it is currently not possible to redirect output of citygml2stl to admesh without writing it to a file first.

A sample script to invoke from command line is installed to PATH:

$ citygml2stl Berlin_Alexanderplatz_v0.4.0.xml
Converting Berlin_Alexanderplatz_v0.4.0.xml to Berlin_Alexanderplatz_v0.4.0.stl

Authors

Release History

Release History

0.1a1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.dev2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.dev1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
citygml2stl-0.1a1.tar.gz (10.9 kB) Copy SHA256 Checksum SHA256 Source Jun 22, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting