discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

OpenSCAD Spider Project

R
runsun
Tue, Mar 13, 2018 10:27 PM

Inspired by the recent contributions of package manager(s) and related
discussions, I thought I'd write a simple downloader (intended to be like
the pip installer in python) that could serve as a quick fix before any
package manager becomes standardized or widely accepted.

The project OpenSCAD Spider is hosted on  github
https://github.com/runsun/openscad_spider  . It would most likely contain
only one python file. Currently only the README is done. Please give
comments, thx.

OpenSCAD_Spider
Download remote OpenSCAD files
A python script to download remote OpenSCAD files. The idea is similarto the
pip package installer in python.
<svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"> <#what-openscad_spiderpy-does>
What openscad_spider.py does:
Create 2 folders in the ...OpenSCAD/libraries folder:

  • spider_food* spider_food_store
    Download OpenSCAD file(s) from one of SPIDER_WEBS. It is definedin a dict in
    python and contains urls of remote sites:
    SPIDER_WEBS={  'github':'https://github.com'
    ,'thingiverse':'https://www.thingiverse.com' }
    and is specified in a call to this file:
    > python openscad_spider.py --web github
    Additionally, libname must be specified, and optionally author:
    > ... --libname <some_name> --author <author>
    Consider: for github, use clone; for thingiverse: use unzip
    Users can also specify a url not in SPIDER_WEBS:
    > python openscad_spider.py --web http://a/b/c
    which directly points to a .scad file.
    In this case, libname and author are to be ignored.
    When --web is not a direct url to a .scad file, this prog needsto srape
    through the given webpage to dig out the direct download url.This can be
    done with either python itself, or consider the otherwebpage scrapping tool
    like BeautifulSoup or Scrapy.
    The downloaded file(s) will be saved to
    ...OpenSCAD/libraries/spider_food
    A new file, spider_template.scad, is created in the currentworking folder,
    containing:
    include <sider_food/<libname>>
    Run spider_template.scad in OpenSCAD
    Upon exist, ask users if this lib is to be kept. If yes, makea copy to
    ...OpenSCAD/libraries/spider_food_store
    <svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"> <#project-progress>  Project
    Progress
    20180313- Project plan outlined in README.md

$  Runsun Pan, PhD $ libs: scadx , doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), editor of choice: CudaText  ( OpenSCAD lexer ); $ Tips ; $ Snippets

--
Sent from: http://forum.openscad.org/

Inspired by the recent contributions of package manager(s) and related discussions, I thought I'd write a simple downloader (intended to be like the *pip* installer in python) that could serve as a quick fix before any package manager becomes standardized or widely accepted. The project *OpenSCAD Spider* is hosted on github <https://github.com/runsun/openscad_spider> . It would most likely contain only one python file. Currently only the README is done. Please give comments, thx. OpenSCAD_Spider Download remote OpenSCAD files A python script to download remote OpenSCAD files. The idea is similarto the pip package installer in python. <svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"> <#what-openscad_spiderpy-does> What openscad_spider.py does: Create 2 folders in the ...OpenSCAD/libraries folder: * spider_food* spider_food_store Download OpenSCAD file(s) from one of SPIDER_WEBS. It is definedin a dict in python and contains urls of remote sites: SPIDER_WEBS={ 'github':'https://github.com' ,'thingiverse':'https://www.thingiverse.com' } and is specified in a call to this file: &gt; python openscad_spider.py --web github Additionally, libname must be specified, and optionally author: &gt; ... --libname &lt;some_name&gt; --author &lt;author&gt; Consider: for github, use clone; for thingiverse: use unzip Users can also specify a url not in SPIDER_WEBS: &gt; python openscad_spider.py --web http://a/b/c which directly points to a .scad file. In this case, libname and author are to be ignored. When --web is not a direct url to a .scad file, this prog needsto srape through the given webpage to dig out the direct download url.This can be done with either python itself, or consider the otherwebpage scrapping tool like BeautifulSoup or Scrapy. The downloaded file(s) will be saved to ...OpenSCAD/libraries/spider_food A new file, spider_template.scad, is created in the currentworking folder, containing: include &lt;sider_food/&lt;libname&gt;&gt; Run spider_template.scad in OpenSCAD Upon exist, ask users if this lib is to be kept. If yes, makea copy to ...OpenSCAD/libraries/spider_food_store <svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"> <#project-progress> Project Progress 20180313- Project plan outlined in README.md ----- $ Runsun Pan, PhD $ libs: scadx , doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), editor of choice: CudaText ( OpenSCAD lexer );&nbsp;$ Tips ;&nbsp;$ Snippets -- Sent from: http://forum.openscad.org/