Module: Microstation::Graphics

Included in:
ModelTrait
Defined in:
lib/microstation/graphics.rb

Instance Method Summary collapse

Instance Method Details

#line(p1, p2, el = WIN32OLE_VARIANT::Nothing) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/microstation/graphics.rb', line 3

def line(p1, p2, el = WIN32OLE_VARIANT::Nothing)
  pt1 = app.to_ole_point3d(p1)
  pt2 = app.to_ole_point3d(p2)
  begin
    ole = app.ole_obj.CreateLineElement2(el, pt1, pt2)
  rescue Exception => e
    binding.pry
    return nil
  end
  add_element(ole) if ole
end

#line_from_pts(pts, el = WIN32OLE_VARIANT::Nothing) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/microstation/graphics.rb', line 15

def line_from_pts(pts, el = WIN32OLE_VARIANT::Nothing)
  ole_points = pts.map { |pt| app.to_ole_point3d(pt) }
  ole = app.ole_obj.CreateLineElement1(el, ole_points)
  if ole
    add_element(ole)
  else
    binding.pry
  end
rescue Exception => e
  binding.pry
  nil
end