Class: JennCad::Primitives::Cube
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Square
Attributes inherited from Primitive
Attributes inherited from Thing
#anchors, #angle, #calc_h, #calc_x, #calc_y, #calc_z, #csize, #diameter, #fn, #name, #opts, #parent, #parts, #pos, #shape, #sits_on, #transformations, #x, #y
Instance Method Summary collapse
-
#initialize(args) ⇒ Cube
constructor
A new instance of Cube.
- #set_anchors ⇒ Object
-
#size ⇒ Object
used for openscad export.
Methods included from Features::Cuttable
Methods included from ZIsh
#cz, #flip_axis, #flip_rotation, #set_anchors_z
Methods inherited from Square
#centered_axis, #cx, #cy, #inner_anchors, #not_centered, #set_anchors_2d, #to_openscad
Methods inherited from Primitive
#feed_opts, #handle_diameter, #handle_margins
Methods inherited from Thing
#anchor, #at, #auto_color, #auto_color!, #auto_extrude, #calculate_center_rotation, #calculated_h, #children_list, #color, #color_or_fallback, #color_parse, #copy_anchor, #copy_anchors, #cut_to, #dbg, #debug?, #find_calculated_h, #fixate, #flip, #flipc, #get_children, #get_contents, #ghost, #has_explicit_color?, #hide, #hl, #inherit_color, #init, #is_2d?, #is_3d?, #mhx, #mhy, #mhz, #mirror, #mix, #miy, #miz, #modify_values, #modify_values!, #move, #movea, #moveai, #moveh, #movei, #multmatrix, #mx, #my, #mz, #on_top_of, #only, #only_color?, #openscad, #openscad_modifier, #option, #parse_xyz_shortcuts, #radians, #referenced_z, #reset, #reset_last_move, #rotate, #rotate_around, #rx, #ry, #rz, #scale, #set_anchor, #set_anchor_from, #set_auto_color, #set_auto_color_for_children, #set_flag, #set_heights_for_auto_extrude, #set_option, #set_parent, #skew, #to_mod, #top_of, #transform, #unset_flag, #z, #z=, #z_margin
Constructor Details
#initialize(args) ⇒ Cube
Returns a new instance of Cube.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/jenncad/primitives/cube.rb', line 6 def initialize(args) @opts = { x: 0, y: 0, z: 0, margins: { x: 0, y: 0, z: 0, }, center: true, center_y: false, center_x: false, center_z: false, } if args.kind_of? Array args.each do |a| feed_opts(parse_xyz_shortcuts(a)) end else feed_opts(parse_xyz_shortcuts(args)) end init handle_margins @h = @z.dup @calc_h = @z.dup @dimensions = [:x, :y, :z] @csize = Size.new(x: @opts[:x], y: @opts[:y], z: @opts[:z]) set_anchors end |
Instance Method Details
#set_anchors ⇒ Object
40 41 42 43 |
# File 'lib/jenncad/primitives/cube.rb', line 40 def set_anchors set_anchors_2d set_anchors_z end |
#size ⇒ Object
used for openscad export
46 47 48 |
# File 'lib/jenncad/primitives/cube.rb', line 46 def size [@x, @y, z+z_margin] end |