PageRenderTime 56ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/skeinforge_application/skeinforge.py

https://github.com/blujule4218/SFACT
Python | 631 lines | 299 code | 43 blank | 289 comment | 36 complexity | 9b6db4598598dce1ed54f2155b05e88c MD5 | raw file
Possible License(s): AGPL-3.0
  1. #!/usr/bin/python
  2. """
  3. This page is in the table of contents.
  4. ==Overview==
  5. ===Introduction===
  6. Skeinforge is a GPL tool chain to forge a gcode skein for a model.
  7. The tool chain starts with carve, which carves the model into layers, then the layers are modified by other tools in turn like fill, comb, tower, raft, stretch, hop, wipe, fillet & export. Each tool automatically gets the gcode from the previous tool. So if you want a carved & filled gcode, call the fill tool and it will call carve, then it will fill and output the gcode. If you want to use all the tools, call export and it will call in turn all the other tools down the chain to produce the gcode file.
  8. If you do not want a tool after preface to modify the output, deselect the Activate checkbox for that tool. When the Activate checkbox is off, the tool will just hand off the gcode to the next tool without modifying it.
  9. The skeinforge module provides a single place to call up all the setting dialogs. When the 'Skeinforge' button is clicked, skeinforge calls export, since that is the end of the chain.
  10. The plugin buttons which are commonly used are bolded and the ones which are rarely used have normal font weight.
  11. There are also tools which handle settings for the chain, like polyfile.
  12. The analyze tool calls plugins in the analyze_plugins folder, which will analyze the gcode in some way when it is generated if their Activate checkbox is selected.
  13. The interpret tool accesses and displays the import plugins.
  14. The default settings are similar to those on Nophead's machine. A setting which is often different is the 'Layer Height' in carve.
  15. ===Command Line Interface===
  16. To bring up the skeinforge dialog without a file name, type:
  17. python skeinforge_application/skeinforge.py
  18. Slicing a file from skeinforge_utilities/skeinforge_craft.py, for example:
  19. python skeinforge_application/skeinforge_utilities/skeinforge_craft.py test.stl
  20. will slice the file and exit. This is the correct option for programs which use skeinforge to only generate a gcode file.
  21. Slicing a file from skeinforge.py, for example:
  22. python skeinforge_application/skeinforge.py test.stl
  23. will slice the file and bring up the skeinforge window and the analyze windows and then skeinforge will wait for user input.
  24. Slicing a file from skeinforge_plugins/craft.py, for example:
  25. python skeinforge_application/skeinforge_plugins/craft.py test.stl
  26. will slice the file and bring up the analyze windows only and then skeinforge will wait for user input.
  27. ===Contribute===
  28. You can contribute by helping develop the manual at:
  29. http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge
  30. There is also a forum thread about how to contribute to skeinforge development at:
  31. http://dev.forums.reprap.org/read.php?12,27562
  32. I will only reply to emails from contributors or to complete bug reports.
  33. ===Documentation===
  34. There is a manual at:
  35. http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge
  36. There is also documentation is in the documentation folder, in the doc strings for each module and it can be called from the '?' button or the menu or by clicking F1 in each setting dialog.
  37. A list of other tutorials is at:
  38. http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge#Tutorials
  39. Skeinforge tagged pages on thingiverse can be searched for at:
  40. http://www.thingiverse.com/search?cx=015525747728168968820%3Arqnsgx1xxcw&cof=FORID%3A9&ie=UTF-8&q=skeinforge&sa=Search&siteurl=www.thingiverse.com%2F#944
  41. ===Fabrication===
  42. To fabricate a model with gcode and the Arduino you can use the send.py in the fabricate folder. The documentation for it is in the folder as send.html and at:
  43. http://reprap.org/bin/view/Main/ArduinoSend
  44. Another way is to use an EMC2 or similar computer controlled milling machine, as described in the "ECM2 based repstrap" forum thread at:
  45. http://forums.reprap.org/read.php?1,12143
  46. using the M-Apps package, which is at:
  47. http://forums.reprap.org/file.php?1,file=772
  48. Another way is to use Zach's ReplicatorG at:
  49. http://replicat.org/
  50. There is also an older Processing script at:
  51. http://reprap.svn.sourceforge.net/viewvc/reprap/trunk/users/hoeken/arduino/GCode_Host/
  52. Yet another way is to use the reprap host, written in Java, to load and print gcode:
  53. http://dev.www.reprap.org/bin/view/Main/DriverSoftware#Load_GCode
  54. For jogging, the Metalab group wrote their own exerciser, also in Processing:
  55. http://reprap.svn.sourceforge.net/viewvc/reprap/trunk/users/metalab/processing/GCode_Exerciser/
  56. The Metalab group has descriptions of skeinforge in action and their adventures are described at:
  57. http://reprap.soup.io/
  58. There is a board about printing issues at:
  59. http://www.bitsfrombytes.com/fora/user/index.php?board=5.0
  60. You can buy the Rapman (an improved Darwin) from Bits from Bytes at:
  61. http://www.bitsfrombytes.com/
  62. You can buy the Makerbot from Makerbot Industries at:
  63. http://www.makerbot.com/
  64. ===File Formats===
  65. An explanation of the gcodes is at:
  66. http://reprap.org/bin/view/Main/Arduino_GCode_Interpreter
  67. and at:
  68. http://reprap.org/bin/view/Main/MCodeReference
  69. A gode example is at:
  70. http://forums.reprap.org/file.php?12,file=565
  71. The settings are saved as tab separated .csv files in the .skeinforge folder in your home directory. The settings can be set in the tool dialogs. The .csv files can also be edited with a text editor or a spreadsheet program set to separate tabs.
  72. The Scalable Vector Graphics file produced by vectorwrite can be opened by an SVG viewer or an SVG capable browser like Mozilla:
  73. http://www.mozilla.com/firefox/
  74. A good triangle surface format is the GNU Triangulated Surface format, which is supported by Mesh Viewer and described at:
  75. http://gts.sourceforge.net/reference/gts-surfaces.html#GTS-SURFACE-WRITE
  76. You can export GTS files from Art of Illusion with the Export GNU Triangulated Surface.bsh script in the Art of Illusion Scripts folder.
  77. STL is an inferior triangle surface format, described at:
  78. http://en.wikipedia.org/wiki/STL_(file_format)
  79. If you're using an STL file and you can't even carve it, try converting it to a GNU Triangulated Surface file in Art of Illusion. If it still doesn't carve, then follow the advice in the troubleshooting section.
  80. ===Getting Skeinforge===
  81. The latest version is at:
  82. http://members.axion.net/~enrique/reprap_python_beanshell.zip
  83. a sometimes out of date version is in the last reprap_python_beanshell.zip attachment in the last post of the Fabmetheus blog at:
  84. http://fabmetheus.blogspot.com/
  85. another sometimes out of date version is at:
  86. https://reprap.svn.sourceforge.net/svnroot/reprap/trunk/reprap/miscellaneous/python-beanshell-scripts/
  87. ===Getting Started===
  88. For skeinforge to run, install python 2.x on your machine, which is available from:
  89. http://www.python.org/download/
  90. To use the settings dialog you'll also need Tkinter, which probably came with the python installation. If it did not, look for it at:
  91. http://www.tcl.tk/software/tcltk/
  92. If you want python and Tkinter together on MacOS, you can try:
  93. http://www.astro.washington.edu/users/rowen/ROPackage/Overview.html
  94. If you want python and Tkinter together on all platforms and don't mind filling out forms, you can try the ActivePython package from Active State at:
  95. http://www.activestate.com/Products/activepython/feature_list.mhtml
  96. The computation intensive python modules will use psyco if it is available and run about twice as fast. Psyco is described at:
  97. http://psyco.sourceforge.net/index.html
  98. The psyco download page is:
  99. http://psyco.sourceforge.net/download.html
  100. Skeinforge imports Stereolithography (.stl) files or GNU Triangulated Surface (.gts) files. If importing an STL file directly doesn't work, an indirect way to import an STL file is by turning it into a GTS file is by using the Export GNU Triangulated Surface script at:
  101. http://members.axion.net/~enrique/Export%20GNU%20Triangulated%20Surface.bsh
  102. The Export GNU Triangulated Surface script is also in the Art of Illusion folder, which is in the same folder as skeinforge.py. To bring the script into Art of Illusion, drop it into the folder ArtOfIllusion/Scripts/Tools/. Then import the STL file using the STL import plugin in the import submenu of the Art of Illusion file menu. Then from the Scripts submenu in the Tools menu, choose 'Export GNU Triangulated Surface' and select the imported STL shape. Click the 'Export Selected' checkbox and click OK. Once you've created the GTS file, you can turn it into gcode by typing in a shell in the same folder as skeinforge:
  103. > python skeinforge.py
  104. When the skeinforge dialog pops up, click 'Skeinforge', choose the file which you exported in 'Export GNU Triangulated Surface' and the gcode file will be saved with the suffix '_export.gcode'.
  105. Or you can turn files into gcode by adding the file name, for example:
  106. > python skeinforge.py Screw Holder Bottom.stl
  107. ===License===
  108. GNU Affero General Public License
  109. http://www.gnu.org/licenses/agpl.html
  110. ===Motto===
  111. I may be slow, but I get there in the end.
  112. ===Troubleshooting===
  113. If there's a bug, try downloading the very latest version because skeinforge is often updated without an announcement. The very latest version is at:
  114. http://members.axion.net/~enrique/reprap_python_beanshell.zip
  115. If there is still a bug, then first prepare the following files:
  116. 1. stl file
  117. 2. pictures explaining the problem
  118. 3. your settings (pack the whole .skeinforge directory with all your settings)
  119. 4. alterations folder, if you have any active alterations files
  120. Then zip all the files.
  121. Second, write a description of the error, send the description and the archive to the developer, enrique ( perez_enrique AT yahoo.com.removethispart ). After a bug fix is released, test the new version and report the results to enrique, whether the fix was successful or not.
  122. If the dialog window is too big for the screen, on most Linux window managers you can move a window by holding down the Alt key and then drag the window with the left mouse button to get to the off screen widgets.
  123. If you can't use the graphical interface, you can change the settings for skeinforge by using a text editor or spreadsheet to change the settings in the profiles folder in the .skeinforge folder in your home directory.
  124. Comments and suggestions are welcome, however, I won't reply unless you are a contributor. Likewise, I will only answer your questions if you contribute to skeinforge in some way. Some ways of contributing to skeinforge are in the contributions thread at:
  125. http://dev.forums.reprap.org/read.php?12,27562
  126. You could also contribute articles to demozendium on any topic:
  127. http://fabmetheus.crsndoo.com/wiki/index.php/Main_Page
  128. If you contribute in a significant way to another open source project, I will consider that also.
  129. When I answered everyone's questions, eventually I received more questions than I had time to answer, so now I only answer questions from contributors.
  130. I reserve the right to make any correspondence public. Do not send me any correspondence marked confidential. If you do I will delete it.
  131. ==Examples==
  132. The following examples forge the STL file Screw Holder.stl. The examples are run in a terminal in the folder which contains Screw Holder.gts and skeinforge.py.
  133. > python skeinforge.py
  134. This brings up the dialog, after clicking 'Skeinforge', the following is printed:
  135. The exported file is saved as Screw Holder_export.gcode
  136. > python skeinforge.py Screw Holder.stl
  137. The exported file is saved as Screw Holder_export.gcode
  138. To run only fill for example, type in the craft_plugins folder which fill is in:
  139. > python fill.py
  140. """
  141. from __future__ import absolute_import
  142. import __init__
  143. from fabmetheus_utilities.fabmetheus_tools import fabmetheus_interpret
  144. from fabmetheus_utilities import archive
  145. from fabmetheus_utilities import euclidean
  146. from fabmetheus_utilities import gcodec
  147. from fabmetheus_utilities import settings
  148. from optparse import OptionParser
  149. from skeinforge_application.skeinforge_utilities import skeinforge_craft
  150. from skeinforge_application.skeinforge_utilities import skeinforge_polyfile
  151. from skeinforge_application.skeinforge_utilities import skeinforge_profile
  152. import os
  153. import sys
  154. # consolidate side loops for voronoi and sponge_slice, add boundary
  155. # check for last existing then remove unneeded fill code (getLastExistingFillLoops) from euclidean, add fill in penultimate loops, if there is no fill it should not use edge - skin should work
  156. # replace replace baseLayerThickness.. with baseLayerHeightMultiplier
  157. # change splodge to use volumeFraction
  158. # announce dwindle
  159. # announce fill sharpestAngle
  160. # announce inset volumeFraction
  161. # document announce skirt
  162. # announce splodge volumeFraction
  163. # announce statistic extrusion diameter gone
  164. # announce vectorwrite
  165. #
  166. #
  167. #
  168. # question, should 'Infill Odd Layer Extra Rotation' be dropped
  169. # consolidate Object First Layer Flow
  170. #
  171. # document raft, stretch, then carve, comb, fill, inset, oozebane, splodge, temperature, speed once they are updated
  172. # wiki document help, description, polyfile
  173. # subplugins like export static, maybe later mill cut and coil plugins, maybe later still export plugins & change file extension to output file extension http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge
  174. #
  175. # backup demozendium links
  176. #
  177. # unimportant
  178. # minor outline problem when an end path goes through a path, like in the letter A
  179. # view profile 1 mm thickness
  180. # analyze doesn't save skeinlayer settings, remember xy in skeiniso
  181. #
  182. #
  183. # retraction step leave
  184. # rename fill extra shells to stuff like Extra Base Shells
  185. # melt _extrusion
  186. # think about http://code.google.com/p/skeinarchiver/ and/or undo
  187. # getStrokeRadius default to edgeWidth
  188. # look at loop end removed bug in upper loop of layer 8 of Screw_Holder_alteration
  189. # fix tower edge line start problem
  190. # check globalExecutionOrder, ensure that bottom order is really high
  191. # set temperature in temperature
  192. # maybe rename geometry_plugins xml
  193. # maybe add carve preview, opening it up in browser
  194. # skin layers without something over the infill
  195. # delete commented addInfillPerimeter
  196. # unpause slow flow rate instead of speeding feed rate
  197. # maybe in svgReader if loop intersection with previous union else add
  198. # add links download manual svg_writer, add left right arrow keys to layer
  199. # command
  200. # thin support When using support, thin column and then gradually widen: http://img534.imageshack.us/img534/514/overhang.jpg
  201. # manipulation derivations
  202. # cutting ahmet
  203. #
  204. # When opening a file for craft I wondered if there is an option to set the file type to .stl as it currently defaults to .xml
  205. # then add Retraction Scaling Exponent
  206. # check inset loop for intersection with loopLayer.loops
  207. # maybe make vectorwrite prominent, not skeiniso, probably not because it doesn't work on Mac
  208. # close, getPillarByLoopLists, addConcave, polymorph original graph section, loop, add step object, add continuous object
  209. # profile copy / rename / delete, maybe move craft type to profile
  210. # think about rectangular getVector3RemoveByPre..
  211. # del previous, add begin & end if far get actual path
  212. # bridge infill modifiers only in the bridge infill loop
  213. # linearbearingexample 15 x 1 x 2, linearbearingcage
  214. # polling
  215. # connectionfrom, to, connect, xaxis
  216. # move replace from export to alterations
  217. # lathe, transform normal in getRemaining, getConnection
  218. # add overview link to crnsdoo index and svg page
  219. # getConnection of some kind like getConnectionVertexes, getConnection
  220. # incorporate actual thickness from feed rate and flow rate in statistics for dimension
  221. # update stretch pictures By design, distance between parallel sides in hexagonal hole are 13mm, 7mm, 6.5mm, round hole diameter's are 8mm, 4mm and 3mm. http://fabmetheus.crsndoo.com/wiki/images/Stretch.png http://fabmetheus.crsndoo.com/wiki/images/thumb/NormalHole.png/180px-NormalHole.png http://fabmetheus.crsndoo.com/wiki/images/thumb/StretchDeformedHole.png/180px-StretchDeformedHole.png
  222. # xml_creation
  223. # 'fileName, text, repository' commandLineInterface
  224. # delete: text = text.replace(('\nName %sValue\n' % globalSpreadsheetSeparator), ('\n_Name %sValue\n' % globalSpreadsheetSeparator))
  225. # comment search from home panel when there is an input field
  226. #
  227. #
  228. # multiply to table + boundary bedBound bedWidth bedHeight bedFile.csv
  229. # getNormal, getIsFlat?
  230. # info statistics, procedures, xml if any
  231. # test solid arguments
  232. # combine xmlelement with csvelement using example.csv & geometry.csv, csv _format, _column, _row, _text
  233. # pixel, voxel, surfaxel/boxel, lattice, mesh
  234. # probably not replace getOverlapRatio with getOverlap if getOverlapRatio is never small, always 0.0
  235. # mesh. for cube, then cylinder, then sphere after lathe
  236. # dimension extrude diameter, density
  237. # superformula http://www.thingiverse.com/thing:12419
  238. # maybe get rid of testLoops once they are no longer needed
  239. # thermistor lookup table
  240. # stretch maybe add back addAlong
  241. # import, write, copy examples
  242. # maybe remove default warnings from scale, rotate, translate, transform
  243. # easy helix
  244. # write tool; maybe write one deep
  245. #
  246. #
  247. # tube
  248. # rotor
  249. # coin
  250. # demozendium privacy policy, maybe thumbnail logo
  251. # pymethe
  252. # test translate
  253. # full lathe
  254. # pyramid
  255. # round extrusion ?, fillet
  256. # make html statistics, move statistics to folder
  257. # manipulate solid, maybe manipulate around elements
  258. # boolean loop corner outset
  259. # mechaslab advanced drainage, shingles
  260. # dovetail
  261. # maybe not getNewObject, getNew, addToBoolean
  262. # work out close and radius
  263. # maybe restore clip if the problem can be defined, the email said there was a problem leading to a ridge but there was no follow up
  264. # maybe have add function as well as append for list and string
  265. # maybe move and give geometryOutput to cube, cylinder, sphere
  266. #
  267. # maybe move widen before bottom
  268. # maybe add 1 to max layer input to iso in layer_template.svg
  269. # maybe save all generated_files option
  270. # table to dictionary
  271. # remove cool set at end of layer
  272. # add fan on when hot in chamber
  273. # maybe measuring rod
  274. # getLayerHeight from xml
  275. # maybe center for xy plane
  276. # remove comments from clip, bend
  277. # winding into coiling, coil into wind & weave
  278. # later, precision
  279. # documentation
  280. # http://wiki.makerbot.com/configuring-skeinforge
  281. #
  282. #
  283. # remove index from CircleIntersection remove ahead or behind from CircleIntersection _speed
  284. # probably not speed up CircleIntersection by performing isWithinCircles before creation _speed
  285. # don't remove brackets in early craft tools _speed
  286. # check bounding box when subtracting or intersecting boolean geometry
  287. # get arounds in inset, the inside become extrude loops and the outside below loops _speed
  288. #
  289. #
  290. # integral thin width _extrusion
  291. # layer color, for multilayer start http://reprap.org/pub/Main/MultipleMaterialsFiles/legend.xml _extrusion
  292. # maybe raft triple layer base, middle interface with hot loop or ties
  293. # somehow, add pattern to outside, http://blog.makerbot.com/2010/09/03/lampshades/
  294. # implement acceleration & collinear removal in penultimate viewers _extrusion
  295. #
  296. # rename skeinforge_profile.addListsToCraftTypeRepository to skeinforge_profile.addToCraftTypeRepository after skirt
  297. # basic basedit tool
  298. # arch, ceiling
  299. # meta setting, rename setting _setting
  300. # add polish, has edge, has cut first layer (False)
  301. # probably not set addedLocation in distanceFeedRate after arc move
  302. # maybe horizontal bridging and/or check to see if the ends are standing on anything
  303. # thin self? check when removing intersecting paths in inset
  304. # save all analyze viewers of the same name except itself, update help menu self.wikiManualPrimary.setUpdateFunction
  305. # check alterations folder first, if there is something copy it to the home directory, if not check the home directory
  306. # add links to demozendium in help
  307. # maybe add hop only if long option
  308. #
  309. #
  310. #
  311. # help primary menu item refresh
  312. # add plugin help menu, add craft below menu
  313. # give option of saving when switching profiles
  314. # xml & svg more forgiving, svg make defaults for layerHeight
  315. # option of surrounding lines in display
  316. # maybe add connecting line in display line
  317. # maybe check inset loops to see if they are smaller, but this would be slow
  318. # maybe status bar
  319. # maybe measurement ruler mouse tool
  320. # search rss from blogs, add search links for common materials, combine created on or progress bar with searchable help
  321. # boundaries, center radius z bottom top, alterations file, circular or rectangular, polygon, put cool minimum radius orbits within boundaries, <bounds> bound.. </bounds>
  322. # move & rotate model
  323. # possible jitter bug http://cpwebste.blogspot.com/2010/04/hydras-first-print.html
  324. # trial, meta in a grid settings
  325. # maybe interpret svg_convex_mesh
  326. #laminate tool head
  327. #maybe use 5x5 radius search in circle node
  328. #maybe add layer updates in behold, skeinlayer and maybe others
  329. #lathe winding, extrusion and cutting; synonym for rotation or turning, loop angle
  330. # maybe split into source code and documentation sections
  331. # transform plugins, start with sarrus http://www.thingiverse.com/thing:1425
  332. # maybe make setting backups
  333. # maybe lathe cutting
  334. # maybe lathe extrusion
  335. # maybe lathe milling
  336. # maybe lathe winding & weaving
  337. #
  338. #
  339. #
  340. # pick and place
  341. # search items, search links, choice entry field
  342. # svg triangle mesh, svg polygon mesh
  343. # simulate
  344. #transform
  345. # juricator
  346. # probably not run along sparse infill to avoid stops
  347. #custom inclined plane, inclined plane from model, screw, fillet travel as well maybe
  348. # probably not stretch single isLoop
  349. #maybe much afterwards make congajure multistep view
  350. #maybe stripe although model colors alone can handle it
  351. #stretch fiber around shape, maybe modify winding for asymmetric shapes
  352. #multiple heads around edge
  353. #maybe add rarely used tool option
  354. #angle shape for overhang extrusions
  355. #maybe m111? countdown
  356. #first time tool tip
  357. #individual tool tip to place in text
  358. # maybe try to simplify raft layer start
  359. # maybe make temp directory
  360. # maybe carve aoi xml testing and check xml gcode
  361. # maybe cross hatch support polishing???
  362. # maybe print svg view from current layer or zero layer in single view
  363. # maybe check if tower is picking the closest island
  364. # maybe combine skein classes in fillet
  365. # maybe isometric svg option
  366. #Manual
  367. #10,990
  368. #11,1776,786
  369. #12,3304,1528
  370. #1,4960,1656
  371. #2, 7077,2117
  372. #3, 9598,2521
  373. #4 12014,2305
  374. #5 14319,2536
  375. #6 16855,3226
  376. #7 20081, 2189
  377. #8 22270, 2625
  378. #9 24895, 2967, 98
  379. #10 27862, 3433, 110
  380. #11 31295, 3327
  381. #12 34622
  382. #85 jan7, 86jan11, 87 jan13, 88 jan15, 91 jan21, 92 jan23, 95 jan30, 98 feb6
  383. #make one piece electromagnet spool
  384. #stepper rotor with ceramic disk magnet in middle, electromagnet with long thin spool line?
  385. #stepper motor
  386. #make plastic coated thread in vat with pulley
  387. #tensile stuart platform
  388. #kayak
  389. #gear vacuum pump
  390. #gear turbine
  391. #heat engine
  392. #solar power
  393. #sailboat
  394. #yacht
  395. #house
  396. #condo with reflected gardens in between buildings
  397. #medical equipment
  398. #cell counter, etc..
  399. #pipe clamp lathe
  400. # square tube driller & cutter
  401. # archihedrongagglevoteindexium
  402. # outline images
  403. # look from top of intersection circle plane to look for next, add a node; tree out until all are stepped on then connect, when more than three intersections are close
  404. # when loading a file, we should have a preview of the part and orientation in space
  405. # second (and most important in my opinion) would be the ability to rotate the part on X/Y/Z axis to chose it's orientation
  406. # third, a routine to detect the largest face and orient the part accordingly. Mat http://reprap.kumy.net/
  407. # concept, three perpendicular slices to get display spheres
  408. # extend lines around short segment after cross hatched boolean
  409. # concept, donation, postponement, rotate ad network, cached search options
  410. # concept, local ad server, every time the program runs it changes the iamge which all the documentation points to from a pool of ads
  411. # concept, join cross slices, go from vertex to two orthogonal edges, then from edges to each other, if not to a common point, then simplify polygons by removing points which do not change the area much
  412. # concept, each node is fourfold, use sorted intersectionindexes to find close, connect each double sided edge, don't overlap more than two triangles on an edge
  413. # concept, diamond cross section loops
  414. # concept, in file, store polygon mesh and centers
  415. # concept, display spheres or polygons would have original triangle for work plane
  416. # .. then again no point with slices
  417. # concept, filled slices, about 2 mm thick
  418. # concept, rgb color triangle switch to get inside color, color golden ratio on 5:11 slope with a modulo 3 face
  419. # concept, interlaced bricks at corners ( length proportional to corner angle )
  420. # concept, new links to archi, import links to archi and adds skeinforge tool menu item, back on skeinforge named execute tool is added
  421. # concept, trnsnt
  422. # concept, indexium expand condense remove, single text, pymetheus
  423. # concept, inscribed key silencer
  424. # concept, spreadsheet to python and/or javascript
  425. # concept, range voting for posters, informative, complainer, funny, insightful, rude, spammer, literacy, troll?
  426. # concept, intermittent cloud with multiple hash functions
  427. __author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
  428. __credits__ = """
  429. Adrian Bowyer <http://forums.reprap.org/profile.php?12,13>
  430. Brendan Erwin <http://forums.reprap.org/profile.php?12,217>
  431. Greenarrow <http://forums.reprap.org/profile.php?12,81>
  432. Ian England <http://forums.reprap.org/profile.php?12,192>
  433. John Gilmore <http://forums.reprap.org/profile.php?12,364>
  434. Jonwise <http://forums.reprap.org/profile.php?12,716>
  435. Kyle Corbitt <http://forums.reprap.org/profile.php?12,90>
  436. Michael Duffin <http://forums.reprap.org/profile.php?12,930>
  437. Marius Kintel <http://reprap.soup.io/>
  438. Nophead <http://www.blogger.com/profile/12801535866788103677>
  439. PJR <http://forums.reprap.org/profile.php?12,757>
  440. Reece.Arnott <http://forums.reprap.org/profile.php?12,152>
  441. Wade <http://forums.reprap.org/profile.php?12,489>
  442. Xsainnz <http://forums.reprap.org/profile.php?12,563>
  443. Zach Hoeken <http://blog.zachhoeken.com/>
  444. Organizations:
  445. Art of Illusion <http://www.artofillusion.org/>"""
  446. __date__ = '$Date: 2008/02/05 $'
  447. __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
  448. def addToProfileMenu(profileSelection, profileType, repository):
  449. 'Add a profile menu.'
  450. pluginFileNames = skeinforge_profile.getPluginFileNames()
  451. craftTypeName = skeinforge_profile.getCraftTypeName()
  452. pluginModule = skeinforge_profile.getCraftTypePluginModule()
  453. profilePluginSettings = settings.getReadRepository(pluginModule.getNewRepository())
  454. for pluginFileName in pluginFileNames:
  455. skeinforge_profile.ProfileTypeMenuRadio().getFromMenuButtonDisplay(profileType, pluginFileName, repository, craftTypeName == pluginFileName)
  456. for profileName in profilePluginSettings.profileList.value:
  457. skeinforge_profile.ProfileSelectionMenuRadio().getFromMenuButtonDisplay(profileSelection, profileName, repository, profileName == profilePluginSettings.profileListbox.value)
  458. def getNewRepository():
  459. 'Get new repository.'
  460. return SkeinforgeRepository()
  461. def getPluginFileNames():
  462. 'Get skeinforge plugin fileNames.'
  463. return archive.getPluginFileNamesFromDirectoryPath(archive.getSkeinforgePluginsPath())
  464. def getRadioPluginsAddPluginGroupFrame(directoryPath, importantFileNames, names, repository):
  465. 'Get the radio plugins and add the plugin frame.'
  466. repository.pluginGroupFrame = settings.PluginGroupFrame()
  467. radioPlugins = []
  468. for name in names:
  469. radioPlugin = settings.RadioPlugin().getFromRadio(name in importantFileNames, repository.pluginGroupFrame.latentStringVar, name, repository, name == importantFileNames[0])
  470. radioPlugin.updateFunction = repository.pluginGroupFrame.update
  471. radioPlugins.append( radioPlugin )
  472. defaultRadioButton = settings.getSelectedRadioPlugin(importantFileNames + [radioPlugins[0].name], radioPlugins)
  473. repository.pluginGroupFrame.getFromPath(defaultRadioButton, directoryPath, repository)
  474. return radioPlugins
  475. def writeOutput(fileName):
  476. 'Craft a file, display dialog.'
  477. repository = getNewRepository()
  478. repository.fileNameInput.value = fileName
  479. repository.execute()
  480. settings.startMainLoopFromConstructor(repository)
  481. class SkeinforgeRepository:
  482. 'A class to handle the skeinforge settings.'
  483. def __init__(self):
  484. 'Set the default settings, execute title & settings fileName.'
  485. skeinforge_profile.addListsToCraftTypeRepository('skeinforge_application.skeinforge.html', self)
  486. self.fileNameInput = settings.FileNameInput().getFromFileName( fabmetheus_interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Skeinforge', self, '')
  487. self.profileType = settings.MenuButtonDisplay().getFromName('Profile Type: ', self )
  488. self.profileType.columnspan = 6
  489. self.profileSelection = settings.MenuButtonDisplay().getFromName('Profile Selection: ', self)
  490. self.profileSelection.columnspan = 6
  491. addToProfileMenu( self.profileSelection, self.profileType, self )
  492. settings.LabelDisplay().getFromName('', self)
  493. importantFileNames = ['craft', 'profile']
  494. getRadioPluginsAddPluginGroupFrame(archive.getSkeinforgePluginsPath(), importantFileNames, getPluginFileNames(), self)
  495. self.executeTitle = 'Skeinforge'
  496. def execute(self):
  497. 'Skeinforge button has been clicked.'
  498. fileNames = skeinforge_polyfile.getFileOrDirectoryTypesUnmodifiedGcode(self.fileNameInput.value, fabmetheus_interpret.getImportPluginFileNames(), self.fileNameInput.wasCancelled)
  499. for fileName in fileNames:
  500. skeinforge_craft.writeOutput(fileName)
  501. def save(self):
  502. 'Profile has been saved and profile menu should be updated.'
  503. self.profileType.removeMenus()
  504. self.profileSelection.removeMenus()
  505. addToProfileMenu(self.profileSelection, self.profileType, self)
  506. self.profileType.addRadiosToDialog(self.repositoryDialog)
  507. self.profileSelection.addRadiosToDialog(self.repositoryDialog)
  508. def main():
  509. 'Display the skeinforge dialog.'
  510. parser = OptionParser()
  511. parser.add_option(
  512. '-p', '--prefdir', help='set path to preference directory', action='store', type='string', dest='preferencesDirectory')
  513. parser.add_option(
  514. '-s', '--start', help='set start file to use', action='store', type='string', dest='startFile')
  515. parser.add_option(
  516. '-e', '--end', help='set end file to use', action='store', type='string', dest='endFile')
  517. parser.add_option(
  518. '-o', '--option', help='set an individual option in the format "module:preference=value"',
  519. action='append', type='string', dest='preferences')
  520. (options, args) = parser.parse_args()
  521. if options.preferencesDirectory:
  522. archive.globalTemporarySettingsPath = options.preferencesDirectory
  523. if options.preferences:
  524. for prefSpec in options.preferences:
  525. (moduleName, prefSpec) = prefSpec.split(':', 1)
  526. (prefName, valueName) = prefSpec.split('=', 1)
  527. settings.addPreferenceOverride(moduleName, prefName, valueName)
  528. sys.argv = [sys.argv[0]] + args
  529. if len( args ) > 0:
  530. writeOutput( ' '.join(args) )
  531. else:
  532. settings.startMainLoopFromConstructor(getNewRepository())
  533. if __name__ == '__main__':
  534. main()