crystalscad 0.6.4 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +1 -3
- data/bin/crystalgen +3 -2
- data/examples/knurls.rb +7 -3
- data/examples/stack.rb +3 -2
- data/lib/crystalscad/CrystalScad.rb +11 -4
- data/lib/crystalscad/CrystalScadObject.rb +0 -4
- data/lib/crystalscad/version.rb +1 -1
- data/manual/manual.html +53 -0
- metadata +63 -90
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 287d067c580abbd3c12857eaf2d24f4b2c0c3195
|
4
|
+
data.tar.gz: d1b32c216e29a883f4f76ddf7ce4434735305e5d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 18f560c3ed30377de9236824876ab974ae54f4ddb386527152c975a81830e24fd43845b25d47c4c3504c85b04121fa154b5cc1ee639416addd5a0f302afbdcf8
|
7
|
+
data.tar.gz: 4ea021b28a6b058881c763649e0cf8b147823032db76b94ea2dca66d3d03faa54b4e1344434227fdd79ccc9d4d42455e5b8d9e95c72fe8b423030df156752f7a
|
data/README.md
CHANGED
@@ -10,14 +10,12 @@ Installation:
|
|
10
10
|
|
11
11
|
Dependencies:
|
12
12
|
|
13
|
-
-
|
13
|
+
- ruby 2 or higher
|
14
14
|
- rubygems
|
15
15
|
|
16
16
|
Install via gem:
|
17
17
|
### \# gem install crystalscad
|
18
18
|
|
19
|
-
if you have multiple ruby versions, you likely need to use gem1.9.3 instead of gem.
|
20
|
-
|
21
19
|
Install via git:
|
22
20
|
|
23
21
|
- clone repository
|
data/bin/crystalgen
CHANGED
@@ -13,7 +13,7 @@ class CrystalGen < Thor
|
|
13
13
|
def new(name)
|
14
14
|
|
15
15
|
create_file("#{name}/#{name}.rb") do
|
16
|
-
"#!/usr/bin/
|
16
|
+
"#!/usr/bin/env ruby
|
17
17
|
require \"rubygems\"
|
18
18
|
require \"crystalscad\"
|
19
19
|
require \"require_all\"
|
@@ -33,7 +33,8 @@ require_all \"lib/**/*.rb\"
|
|
33
33
|
# Scans every file in lib/**/*.rb for classes and saves them in the output/ directory
|
34
34
|
save!
|
35
35
|
|
36
|
-
|
36
|
+
# Disabled by default for now since this will give a warning.
|
37
|
+
# @@bom.save(\"bom.txt\")
|
37
38
|
|
38
39
|
"
|
39
40
|
end
|
data/examples/knurls.rb
CHANGED
@@ -6,10 +6,14 @@ include CrystalScad
|
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
-
res = knurled_cube([
|
10
|
-
#Total rendering time: 0 hours,
|
9
|
+
res = knurled_cube([41,10,4])
|
10
|
+
#Total rendering time: 0 hours, 5 minutes, 53 seconds
|
11
|
+
|
12
|
+
#Total rendering time: 0 hours, 1 minutes, 41 seconds
|
13
|
+
|
14
|
+
#res = knurled_cylinder(d:16,h:10)
|
15
|
+
|
11
16
|
|
12
|
-
# Total rendering time: 0 hours, 1 minutes, 1 seconds with render
|
13
17
|
|
14
18
|
res.save("knurls.scad","$fn=64;")
|
15
19
|
|
data/examples/stack.rb
CHANGED
@@ -3,6 +3,7 @@ require "rubygems"
|
|
3
3
|
require "crystalscad"
|
4
4
|
include CrystalScad
|
5
5
|
|
6
|
+
# Note that this example does not work as intended and the function is deprecated
|
6
7
|
|
7
8
|
parts = [
|
8
9
|
Washer.new(4.3),
|
@@ -12,11 +13,11 @@ parts = [
|
|
12
13
|
]
|
13
14
|
bolt = Bolt.new(4,16).show
|
14
15
|
bolt_assembly = bolt
|
15
|
-
bolt_assembly += stack({method:"output"}, *parts)
|
16
|
+
bolt_assembly += stack({method:"output",spacing:0.1}, *parts)
|
16
17
|
|
17
18
|
x,y,z = position(bolt)
|
18
19
|
bolt_assembly.translate(x:x*-1,y:y*-1,z:z*-1)
|
19
20
|
|
20
|
-
|
21
|
+
bolt_assembly.save("stack.scad")
|
21
22
|
|
22
23
|
|
@@ -544,16 +544,23 @@ module CrystalScad
|
|
544
544
|
end
|
545
545
|
|
546
546
|
|
547
|
-
# Stacks parts along the Z axis
|
547
|
+
# Deprecated: Stacks parts along the Z axis
|
548
548
|
# works on all Assemblies that have a @height definition
|
549
|
+
# TODO: Make a better functionality similar to this, that is:
|
550
|
+
# - easier to use
|
551
|
+
# - throws better error messages
|
552
|
+
# - doesn't assume that everything falls down like gravity in every case
|
549
553
|
def stack(args={}, *parts)
|
550
554
|
args[:method] ||= "show"
|
551
|
-
args[:
|
555
|
+
args[:spacing] ||= 0
|
556
|
+
puts "CrystalScad Warning: Please note that the stack method is deprecated and will be removed or replaced in the future"
|
552
557
|
@assembly = nil
|
553
558
|
z = 0
|
554
559
|
parts.each do |part|
|
555
|
-
|
556
|
-
|
560
|
+
item = (part.send args[:method])
|
561
|
+
next if item == nil or !item.respond_to? "translate"
|
562
|
+
@assembly += item.translate(z:z)
|
563
|
+
z+= part.height + args[:spacing]
|
557
564
|
end
|
558
565
|
@assembly
|
559
566
|
end
|
data/lib/crystalscad/version.rb
CHANGED
data/manual/manual.html
CHANGED
@@ -334,6 +334,33 @@ This method can produce both show and output. The show variable is set to true w
|
|
334
334
|
# Small introduction to ruby
|
335
335
|
TODO: variables, comments, class inheritance?
|
336
336
|
|
337
|
+
---
|
338
|
+
# Units
|
339
|
+
|
340
|
+
All units are mm by default.
|
341
|
+
|
342
|
+
###Note on how Ruby casts numeric values:
|
343
|
+
|
344
|
+
```ruby
|
345
|
+
@foo = 11 # Casts as Integer
|
346
|
+
@bar = 11.0 # Casts as Decimal
|
347
|
+
|
348
|
+
```
|
349
|
+
This is important if you devide by an Integer, for example:
|
350
|
+
```ruby
|
351
|
+
@foo / 2 # results in 5
|
352
|
+
@bar / 2 # results in 5.5
|
353
|
+
```
|
354
|
+
As good practice, you should divide by a Decimal, which will cast the Integer to Decimal:
|
355
|
+
```ruby
|
356
|
+
@foo / 2.0 # results in 5.5
|
357
|
+
@bar / 2.0 # results in 5.5
|
358
|
+
```
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
337
364
|
---
|
338
365
|
# Primitives
|
339
366
|
## Cube
|
@@ -350,6 +377,32 @@ cube(x: value , y: value, z: value)
|
|
350
377
|
cube(size: 1)
|
351
378
|
```
|
352
379
|
### Centering
|
380
|
+
You can put one of these methods directly after the cube method:
|
381
|
+
```ruby
|
382
|
+
cube(size: 1).center # Center in X,Y and Z
|
383
|
+
cube(size: 1).center_x # Center in X
|
384
|
+
cube(size: 1).center_y # Center in Y
|
385
|
+
cube(size: 1).center_xy # Center in X and Y
|
386
|
+
cube(size: 1).center_z # Center Z
|
387
|
+
|
388
|
+
```
|
389
|
+
---
|
390
|
+
## Cylinder
|
391
|
+
Creates a cylinder centered in X & Y
|
392
|
+
```ruby
|
393
|
+
cylinder(d:5,h:10) # Creates a cylinder with diameter 5 and height 10
|
394
|
+
```
|
395
|
+
parameters:
|
396
|
+
```ruby
|
397
|
+
r: radius
|
398
|
+
d: diameter
|
399
|
+
h: height
|
400
|
+
```
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
---
|
405
|
+
|
353
406
|
|
354
407
|
|
355
408
|
|
metadata
CHANGED
@@ -1,94 +1,79 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: crystalscad
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 6
|
9
|
-
- 4
|
10
|
-
version: 0.6.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.6.5
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Joachim Glauche
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2017-06-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: rubyscad
|
22
|
-
|
23
|
-
|
24
|
-
none: false
|
25
|
-
requirements:
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
26
17
|
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 0
|
32
|
-
version: "1.0"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
33
20
|
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: require_all
|
37
21
|
prerelease: false
|
38
|
-
|
39
|
-
|
40
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: require_all
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
41
31
|
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 1
|
46
|
-
- 3
|
47
|
-
version: "1.3"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
48
34
|
type: :runtime
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: wijet-thor
|
52
35
|
prerelease: false
|
53
|
-
|
54
|
-
|
55
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: wijet-thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
56
45
|
- - ">="
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
hash: 51
|
59
|
-
segments:
|
60
|
-
- 0
|
61
|
-
- 14
|
62
|
-
- 10
|
46
|
+
- !ruby/object:Gem::Version
|
63
47
|
version: 0.14.10
|
64
48
|
type: :runtime
|
65
|
-
version_requirements: *id003
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
|
-
name: observr
|
68
49
|
prerelease: false
|
69
|
-
|
70
|
-
|
71
|
-
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.14.10
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: observr
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
72
59
|
- - ">="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
hash: 29
|
75
|
-
segments:
|
76
|
-
- 1
|
77
|
-
- 0
|
78
|
-
- 5
|
60
|
+
- !ruby/object:Gem::Version
|
79
61
|
version: 1.0.5
|
80
62
|
type: :runtime
|
81
|
-
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.0.5
|
82
69
|
description: Inspired by SolidPython, based on RubyScad
|
83
|
-
email:
|
70
|
+
email:
|
84
71
|
- webmaster@joaz.de
|
85
|
-
executables:
|
72
|
+
executables:
|
86
73
|
- crystalgen
|
87
74
|
extensions: []
|
88
|
-
|
89
75
|
extra_rdoc_files: []
|
90
|
-
|
91
|
-
files:
|
76
|
+
files:
|
92
77
|
- COPYING
|
93
78
|
- Gemfile
|
94
79
|
- README.md
|
@@ -135,39 +120,27 @@ files:
|
|
135
120
|
- static/logo.png
|
136
121
|
- static/logo_small.png
|
137
122
|
homepage: http://github.com/Joaz/CrystalScad
|
138
|
-
licenses:
|
123
|
+
licenses:
|
139
124
|
- GPL-3
|
125
|
+
metadata: {}
|
140
126
|
post_install_message:
|
141
127
|
rdoc_options: []
|
142
|
-
|
143
|
-
require_paths:
|
128
|
+
require_paths:
|
144
129
|
- lib
|
145
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
-
|
147
|
-
requirements:
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
148
132
|
- - ">="
|
149
|
-
- !ruby/object:Gem::Version
|
150
|
-
hash: 53
|
151
|
-
segments:
|
152
|
-
- 1
|
153
|
-
- 9
|
154
|
-
- 3
|
133
|
+
- !ruby/object:Gem::Version
|
155
134
|
version: 1.9.3
|
156
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
|
-
|
158
|
-
requirements:
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
159
137
|
- - ">="
|
160
|
-
- !ruby/object:Gem::Version
|
161
|
-
|
162
|
-
segments:
|
163
|
-
- 0
|
164
|
-
version: "0"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
165
140
|
requirements: []
|
166
|
-
|
167
141
|
rubyforge_project:
|
168
|
-
rubygems_version:
|
142
|
+
rubygems_version: 2.5.1
|
169
143
|
signing_key:
|
170
|
-
specification_version:
|
144
|
+
specification_version: 4
|
171
145
|
summary: CrystalScad is a framework for programming OpenScad models in Ruby
|
172
146
|
test_files: []
|
173
|
-
|