Top Level Namespace

Defined Under Namespace

Modules: Rcad Classes: BaseBoltPart, Bolt, Box, Circle, Cone, Cube, Cylinder, GearProfile, HelicalGear, HerringboneGear, HexNut, LinearExtrusion, Numeric, Polygon, Polyhedron, Rectangle, RegularPolygon, RegularPrism, Revolution, Shape, Sphere, SpurGear, Square, Text, Torus, Transform, TransformedShape

Constant Summary collapse

OCE_INCLUDE_DIR =
'/usr/include/oce'
OCE_LIB_DIR =
'/usr/lib'

Instance Method Summary collapse

Instance Method Details

#_shape_mode_block(mode, &block) ⇒ Object



315
316
317
318
319
320
321
322
323
324
325
# File 'lib/rcad.rb', line 315

def _shape_mode_block(mode, &block)
  $shape_stack.push([$shape, $shape_mode])
  $shape = nil
  $shape_mode = mode

  block.call
  res = $shape

  $shape, $shape_mode = $shape_stack.pop
  res
end

#add(&block) ⇒ Object



327
328
329
# File 'lib/rcad.rb', line 327

def add(&block)
  _shape_mode_block(:+, &block)
end

#clear_shapeObject



356
357
358
# File 'lib/rcad.rb', line 356

def clear_shape
  $shape = nil
end

#hull(&block) ⇒ Object



339
340
341
342
343
344
345
346
347
348
349
# File 'lib/rcad.rb', line 339

def hull(&block)
  $shape_stack.push([$shape, $shape_mode])
  $shape = []
  $shape_mode = :hull

  block.call
  res = _hull($shape)

  $shape, $shape_mode = $shape_stack.pop
  res
end

#make_maker(name, klass) ⇒ Object



592
593
594
# File 'lib/rcad.rb', line 592

def make_maker(name, klass)
  Object.send(:define_method, name, &klass.method(:new))
end

#mul(&block) ⇒ Object



335
336
337
# File 'lib/rcad.rb', line 335

def mul(&block)
  _shape_mode_block(:*, &block)
end

#sub(&block) ⇒ Object



331
332
333
# File 'lib/rcad.rb', line 331

def sub(&block)
  _shape_mode_block(:-, &block)
end

#to_polar(r, a) ⇒ Object



36
37
38
# File 'lib/rcad.rb', line 36

def to_polar(r, a)
  return [r * Math::cos(a), r * Math::sin(a)]
end

#write_stl(*args) ⇒ Object



351
352
353
354
# File 'lib/rcad.rb', line 351

def write_stl(*args)
  $shape != nil or raise
  $shape.write_stl(*args)
end