Class: LineCreation

Inherits:
Object
  • Object
show all
Includes:
PrimitiveCommandInterface
Defined in:
lib/microstation/primitive_command_interface.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PrimitiveCommandInterface

#Cleanup, #Keyin

Constructor Details

#initialize(app) ⇒ LineCreation

Returns a new instance of LineCreation.



30
31
32
33
# File 'lib/microstation/primitive_command_interface.rb', line 30

def initialize(app)
  @app = app
  @points = Array.new(2)
end

Instance Attribute Details

#pointsObject (readonly)

Returns the value of attribute points.



28
29
30
# File 'lib/microstation/primitive_command_interface.rb', line 28

def points
  @points
end

Instance Method Details

#DataPoint(pt, view) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/microstation/primitive_command_interface.rb', line 35

def DataPoint(pt, view)
  case points.compact.size
  when 0
    app.ole_obj.CommandState.StartDynamics
    @points[0] = pt
    app.show_prompt "Place end point"
  when 1
    @points[1] =  pt
    line_from_pts(@points)
    @points[0] = @points[1]
  end
end

#Dynamics(pt, view, drawmode) ⇒ Object



49
50
51
52
53
54
# File 'lib/microstation/primitive_command_interface.rb', line 49

def Dynamics(pt, view, drawmode)
  if @points.compact.size == 1
    @points[1] = pt
    line = line_from_pts(@points)
  end
end

#ResetObject



56
57
58
59
# File 'lib/microstation/primitive_command_interface.rb', line 56

def Reset
  app.CommandState.StartPrimitive self
  @points = Array.new(2)
end

#StartObject



61
62
63
64
# File 'lib/microstation/primitive_command_interface.rb', line 61

def Start
  app.show_command "VBA PlaceLine Example"
  app.show_prompt "Select start of line"
end