microstation 0.8.6 → 0.8.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +26 -29
- data/Rakefile +45 -45
- data/bin/dgn2pdf +5 -6
- data/bin/dgn_template +23 -25
- data/bin/pw_print +11 -13
- data/cad_files/drawing_no_block.dgn +0 -0
- data/cad_files/drawing_with_3_block.dgn +0 -0
- data/cad_files/drawing_with_block.dgn +0 -0
- data/cad_files/drawing_with_text.dgn +0 -0
- data/lib/microstation/app.rb +91 -87
- data/lib/microstation/cad_input_queue.rb +10 -20
- data/lib/microstation/cell.rb +6 -18
- data/lib/microstation/changer.rb +3 -3
- data/lib/microstation/configuration.rb +33 -50
- data/lib/microstation/criteria_creation_t.rb +4 -8
- data/lib/microstation/dir.rb +27 -59
- data/lib/microstation/directory.rb +2 -7
- data/lib/microstation/drawing.rb +103 -102
- data/lib/microstation/element.rb +55 -68
- data/lib/microstation/enumerator.rb +4 -9
- data/lib/microstation/errors.rb +0 -5
- data/lib/microstation/event_handler.rb +1 -5
- data/lib/microstation/ext/pathname.rb +12 -14
- data/lib/microstation/ext/win32ole.rb +0 -2
- data/lib/microstation/extensions/faa.rb +12 -34
- data/lib/microstation/file_tests.rb +15 -50
- data/lib/microstation/functions.rb +10 -20
- data/lib/microstation/graphics.rb +6 -13
- data/lib/microstation/line.rb +2 -6
- data/lib/microstation/model.rb +11 -20
- data/lib/microstation/model_trait.rb +40 -40
- data/lib/microstation/ole_cad_input_message.rb +25 -34
- data/lib/microstation/ole_helper.rb +58 -66
- data/lib/microstation/pdf_support.rb +7 -16
- data/lib/microstation/point3d.rb +17 -30
- data/lib/microstation/primitive_command_interface.rb +8 -14
- data/lib/microstation/properties.rb +29 -17
- data/lib/microstation/property_handler.rb +6 -8
- data/lib/microstation/scan/color.rb +1 -8
- data/lib/microstation/scan/criteria.rb +17 -33
- data/lib/microstation/scan/klass.rb +8 -12
- data/lib/microstation/scan/level.rb +2 -9
- data/lib/microstation/scan/line_style.rb +4 -12
- data/lib/microstation/scan/line_weight.rb +1 -3
- data/lib/microstation/scan/range.rb +2 -8
- data/lib/microstation/scan/scan_trait.rb +48 -51
- data/lib/microstation/scan/subtype.rb +0 -10
- data/lib/microstation/scan/type.rb +9 -15
- data/lib/microstation/scan_trait.rb +13 -20
- data/lib/microstation/scanner.rb +1 -11
- data/lib/microstation/tag.rb +12 -21
- data/lib/microstation/tag_set.rb +52 -71
- data/lib/microstation/tag_set_trait.rb +6 -10
- data/lib/microstation/tagged_element.rb +16 -28
- data/lib/microstation/template.rb +15 -14
- data/lib/microstation/template_info.rb +35 -49
- data/lib/microstation/template_runner.rb +14 -22
- data/lib/microstation/text.rb +15 -19
- data/lib/microstation/text_node.rb +17 -26
- data/lib/microstation/ts/attribute.rb +16 -20
- data/lib/microstation/ts/instance.rb +28 -38
- data/lib/microstation/ts/tagset_trait.rb +5 -12
- data/lib/microstation/types.rb +0 -3
- data/lib/microstation/version.rb +1 -3
- data/lib/microstation/wrap.rb +3 -10
- data/lib/microstation.rb +53 -68
- data/spec/microstation/app_spec.rb +49 -46
- data/spec/microstation/configuration_spec.rb +45 -43
- data/spec/microstation/drawing_spec.rb +103 -101
- data/spec/microstation/functions_spec.rb +18 -12
- data/spec/microstation/tag_set_spec.rb +57 -55
- data/spec/microstation/template_spec.rb +41 -42
- data/spec/microstation/text_node_spec.rb +16 -14
- data/spec/microstation/text_spec.rb +10 -8
- data/spec/microstation_spec.rb +18 -17
- data/spec/spec_helper.rb +18 -18
- metadata +26 -12
data/lib/microstation/point3d.rb
CHANGED
@@ -1,71 +1,58 @@
|
|
1
1
|
module Microstation
|
2
|
-
|
3
|
-
|
4
|
-
|
5
2
|
class Point3d
|
6
|
-
|
7
3
|
class << self
|
8
|
-
|
9
4
|
def ole_point3d?(ole)
|
10
|
-
ole.
|
5
|
+
ole.instance_of?(WIN32OLE_RECORD) && ole.typename == "Point3d"
|
11
6
|
end
|
12
7
|
|
13
|
-
def cartesian_to_polar(x,y)
|
14
|
-
r = Math.sqrt(x*x + y*y)
|
15
|
-
angle = Angle.radians(Math.atan2(y,x))
|
16
|
-
[r,angle]
|
8
|
+
def cartesian_to_polar(x, y)
|
9
|
+
r = Math.sqrt(x * x + y * y)
|
10
|
+
angle = Angle.radians(Math.atan2(y, x))
|
11
|
+
[r, angle]
|
17
12
|
end
|
18
13
|
|
19
|
-
def from_polar_degrees(r,a)
|
20
|
-
|
14
|
+
def from_polar_degrees(r, a)
|
21
15
|
end
|
22
16
|
|
23
17
|
def from_ole(ole)
|
24
18
|
new(ole.X, ole.Y, ole.Z)
|
25
19
|
end
|
26
20
|
|
27
|
-
def polar_to_cartesian(r,a)
|
28
|
-
|
21
|
+
def polar_to_cartesian(r, a)
|
29
22
|
end
|
30
|
-
|
31
23
|
end
|
32
24
|
|
33
25
|
attr_reader :x, :y, :z
|
34
26
|
|
35
|
-
def initialize(x=0,y=0,z=0)
|
27
|
+
def initialize(x = 0, y = 0, z = 0)
|
36
28
|
@x = x
|
37
29
|
@y = y
|
38
30
|
@z = z
|
39
31
|
end
|
40
32
|
|
41
|
-
|
42
|
-
|
43
|
-
case pt
|
33
|
+
def +(other)
|
34
|
+
case other
|
44
35
|
when Point3d
|
45
|
-
self.class.new(
|
36
|
+
self.class.new(x + other.x, y + other.y, z + other.z)
|
46
37
|
when Array
|
47
|
-
self.class.new(
|
38
|
+
self.class.new(x + other[0], y + other[1])
|
48
39
|
end
|
49
40
|
end
|
50
41
|
|
51
|
-
def -(
|
52
|
-
case
|
42
|
+
def -(other)
|
43
|
+
case other
|
53
44
|
when Point3d
|
54
|
-
self.class.new(
|
45
|
+
self.class.new(x - other.x, y - other.y, z - other.z)
|
55
46
|
when Array
|
56
|
-
self.class.new(
|
47
|
+
self.class.new(x - other[0], y - other[1])
|
57
48
|
end
|
58
49
|
end
|
59
50
|
|
60
51
|
def zero
|
61
|
-
new(0.0,0.0,0,0)
|
52
|
+
new(0.0, 0.0, 0, 0)
|
62
53
|
end
|
63
54
|
|
64
55
|
def to_cartesian
|
65
|
-
|
66
56
|
end
|
67
|
-
|
68
57
|
end
|
69
|
-
|
70
|
-
|
71
58
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
module PrimitiveCommandInterface
|
2
|
-
|
3
2
|
def Keyin(keyin)
|
4
3
|
end
|
5
4
|
|
@@ -12,17 +11,14 @@ module PrimitiveCommandInterface
|
|
12
11
|
def Cleanup
|
13
12
|
end
|
14
13
|
|
15
|
-
def Dynamics(pt,view,drawmode)
|
14
|
+
def Dynamics(pt, view, drawmode)
|
16
15
|
end
|
17
16
|
|
18
17
|
def Start
|
19
18
|
end
|
20
|
-
|
21
|
-
|
22
19
|
end
|
23
20
|
|
24
|
-
class LineCreation
|
25
|
-
|
21
|
+
class LineCreation
|
26
22
|
include PrimitiveCommandInterface
|
27
23
|
|
28
24
|
attr_reader :points
|
@@ -32,25 +28,24 @@ class LineCreation
|
|
32
28
|
@points = Array.new(2)
|
33
29
|
end
|
34
30
|
|
35
|
-
def DataPoint(pt,
|
31
|
+
def DataPoint(pt, _view)
|
36
32
|
case points.compact.size
|
37
33
|
when 0
|
38
34
|
app.ole_obj.CommandState.StartDynamics
|
39
35
|
@points[0] = pt
|
40
36
|
app.show_prompt "Place end point"
|
41
37
|
when 1
|
42
|
-
@points[1] =
|
38
|
+
@points[1] = pt
|
43
39
|
line_from_pts(@points)
|
44
40
|
@points[0] = @points[1]
|
45
41
|
end
|
46
42
|
end
|
47
43
|
|
44
|
+
def Dynamics(pt, _view, _drawmode)
|
45
|
+
return unless @points.compact.size == 1
|
48
46
|
|
49
|
-
|
50
|
-
|
51
|
-
@points[1] = pt
|
52
|
-
line = line_from_pts(@points)
|
53
|
-
end
|
47
|
+
@points[1] = pt
|
48
|
+
line = line_from_pts(@points)
|
54
49
|
end
|
55
50
|
|
56
51
|
def Reset
|
@@ -62,5 +57,4 @@ class LineCreation
|
|
62
57
|
app.show_command "VBA PlaceLine Example"
|
63
58
|
app.show_prompt "Select start of line"
|
64
59
|
end
|
65
|
-
|
66
60
|
end
|
@@ -1,61 +1,73 @@
|
|
1
1
|
module Microstation
|
2
|
-
|
3
2
|
module Properties
|
4
|
-
|
5
3
|
def author=(var = nil)
|
6
4
|
if var
|
7
5
|
@ole_obj.Author = var
|
8
6
|
else
|
9
|
-
|
7
|
+
begin
|
8
|
+
@ole_obj.Author
|
9
|
+
rescue
|
10
|
+
nil
|
11
|
+
end
|
10
12
|
end
|
11
|
-
|
12
13
|
end
|
13
14
|
|
14
|
-
|
15
|
+
alias_method :author, :author=
|
15
16
|
|
16
17
|
def subject=(var = nil)
|
17
18
|
if var
|
18
19
|
@ole_obj.Subject = var
|
19
20
|
else
|
20
|
-
|
21
|
+
begin
|
22
|
+
@ole_obj.Subject
|
23
|
+
rescue
|
24
|
+
nil
|
25
|
+
end
|
21
26
|
end
|
22
|
-
|
23
27
|
end
|
24
28
|
|
25
|
-
|
29
|
+
alias_method :subject, :subject=
|
26
30
|
|
27
31
|
def comments=(var = nil)
|
28
32
|
if var
|
29
33
|
@ole_obj.Comments = var
|
30
34
|
else
|
31
|
-
|
35
|
+
begin
|
36
|
+
@ole_obj.Comments
|
37
|
+
rescue
|
38
|
+
nil
|
39
|
+
end
|
32
40
|
end
|
33
41
|
end
|
34
42
|
|
35
|
-
|
43
|
+
alias_method :comments, :comments=
|
36
44
|
|
37
45
|
def title=(var = nil)
|
38
46
|
if var
|
39
47
|
@ole_obj.Title = var
|
40
48
|
else
|
41
|
-
|
49
|
+
begin
|
50
|
+
@ole_obj.Title
|
51
|
+
rescue
|
52
|
+
nil
|
53
|
+
end
|
42
54
|
end
|
43
55
|
end
|
44
56
|
|
45
|
-
alias_method :title
|
57
|
+
alias_method :title, :title=
|
46
58
|
|
47
59
|
def keywords=(var = nil)
|
48
60
|
if var
|
49
61
|
@ole_obj.Keywords = var
|
50
62
|
else
|
51
|
-
|
63
|
+
begin
|
64
|
+
@ole_obj.Keywords
|
65
|
+
rescue
|
66
|
+
nil
|
67
|
+
end
|
52
68
|
end
|
53
69
|
end
|
54
70
|
|
55
|
-
|
56
71
|
alias_method :keywords, :keywords=
|
57
|
-
|
58
72
|
end
|
59
|
-
|
60
|
-
|
61
73
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module Microstation
|
2
|
-
|
3
2
|
class PropertyHandler
|
4
|
-
|
5
3
|
attr_reader :ole_obj
|
6
4
|
|
7
5
|
def initialize(ole)
|
@@ -10,29 +8,31 @@ module Microstation
|
|
10
8
|
|
11
9
|
def has_property?(value)
|
12
10
|
prop = ole_obj.SelectByAccessString(value)
|
13
|
-
!!
|
11
|
+
!!prop
|
14
12
|
end
|
15
13
|
|
16
14
|
def [](property)
|
17
15
|
return unless has_property?(property)
|
16
|
+
|
18
17
|
ole_obj.GetValue
|
19
18
|
end
|
20
19
|
|
21
20
|
def get_property_as_point3d(property)
|
22
21
|
return unless has_property?(property)
|
22
|
+
|
23
23
|
ole_pt = ole_obj.GetValueAsPoint3d
|
24
24
|
Point3d.new(ole_pt)
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
def []=(property,value)
|
27
|
+
def []=(property, value)
|
29
28
|
return unless has_property?(property)
|
29
|
+
|
30
30
|
ole_obj.SetValue(value)
|
31
31
|
end
|
32
32
|
|
33
33
|
def property_names
|
34
34
|
names = ole_obj.GetAccessStrings
|
35
|
-
result
|
35
|
+
result = []
|
36
36
|
names.each do |e|
|
37
37
|
if block_given?
|
38
38
|
yield e
|
@@ -42,7 +42,5 @@ module Microstation
|
|
42
42
|
end
|
43
43
|
result unless block_given?
|
44
44
|
end
|
45
|
-
|
46
45
|
end
|
47
|
-
|
48
46
|
end
|
@@ -1,9 +1,6 @@
|
|
1
1
|
module Microstation
|
2
|
-
|
3
2
|
module Scan
|
4
|
-
|
5
3
|
module Color
|
6
|
-
|
7
4
|
def color_inclusions
|
8
5
|
@color_inclusions ||= []
|
9
6
|
end
|
@@ -23,16 +20,12 @@ module Microstation
|
|
23
20
|
|
24
21
|
def resolve_color_scans
|
25
22
|
return unless color_inclusions.size > 0
|
23
|
+
|
26
24
|
reset_ole_colors
|
27
25
|
color_inclusions.each do |color|
|
28
26
|
ole_obj.IncludeColor(color)
|
29
27
|
end
|
30
28
|
end
|
31
|
-
|
32
29
|
end
|
33
|
-
|
34
30
|
end
|
35
31
|
end
|
36
|
-
|
37
|
-
|
38
|
-
|
@@ -1,30 +1,23 @@
|
|
1
|
-
require_relative
|
2
|
-
require_relative
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
6
|
-
require_relative
|
7
|
-
require_relative
|
8
|
-
require_relative
|
1
|
+
require_relative "klass"
|
2
|
+
require_relative "type"
|
3
|
+
require_relative "level"
|
4
|
+
require_relative "color"
|
5
|
+
require_relative "line_style"
|
6
|
+
require_relative "line_weight"
|
7
|
+
require_relative "subtype"
|
8
|
+
require_relative "range"
|
9
9
|
|
10
10
|
module Microstation
|
11
|
-
|
12
11
|
class App
|
13
|
-
|
14
12
|
def create_ole_scan_criteria
|
15
13
|
ole_obj.CreateObjectInMicroStation("MicroStationDGN.ElementScanCriteria")
|
16
14
|
end
|
17
|
-
|
18
15
|
end
|
19
|
-
|
20
16
|
end
|
21
17
|
|
22
18
|
module Microstation
|
23
|
-
|
24
19
|
module Scan
|
25
|
-
|
26
20
|
class Criteria
|
27
|
-
|
28
21
|
include Scan::Klass
|
29
22
|
include Scan::Type
|
30
23
|
include Scan::Level
|
@@ -34,25 +27,23 @@ module Microstation
|
|
34
27
|
include Scan::Subtype
|
35
28
|
include Scan::Range
|
36
29
|
|
37
|
-
attr_reader :app
|
30
|
+
attr_reader :app, :ole_obj
|
38
31
|
|
39
|
-
def self.create_scanner(name=nil, app
|
40
|
-
sc = create(name,app)
|
32
|
+
def self.create_scanner(name = nil, app, &block)
|
33
|
+
sc = create(name, app)
|
41
34
|
return sc unless block
|
42
|
-
|
35
|
+
|
36
|
+
(block.arity < 1) ? sc.instance_eval(&block) : block.call(sc)
|
43
37
|
sc
|
44
38
|
end
|
45
39
|
|
46
|
-
def self.create(name=nil,app)
|
40
|
+
def self.create(name = nil, app)
|
47
41
|
sc = new(app)
|
48
|
-
if name.nil?
|
49
|
-
name = "anon#{app.scanners.size + 1}"
|
50
|
-
end
|
42
|
+
name = "anon#{app.scanners.size + 1}" if name.nil?
|
51
43
|
app.scanners[name] = sc
|
52
44
|
sc
|
53
45
|
end
|
54
46
|
|
55
|
-
|
56
47
|
def initialize(app)
|
57
48
|
@app = app
|
58
49
|
@ole_obj = @app.create_ole_scan_criteria
|
@@ -74,16 +65,9 @@ module Microstation
|
|
74
65
|
@ole_obj = nil
|
75
66
|
end
|
76
67
|
|
77
|
-
def
|
78
|
-
@ole_obj
|
79
|
-
end
|
80
|
-
|
81
|
-
def method_missing(method,*args)
|
82
|
-
@ole_obj.send(method,*args)
|
68
|
+
def method_missing(method, *args)
|
69
|
+
@ole_obj.send(method, *args)
|
83
70
|
end
|
84
|
-
|
85
|
-
|
86
71
|
end
|
87
72
|
end
|
88
|
-
|
89
73
|
end
|
@@ -1,15 +1,12 @@
|
|
1
1
|
module Microstation
|
2
|
-
|
3
2
|
module Scan
|
4
|
-
|
5
3
|
module Klass
|
6
|
-
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
# msdElementClassLinearPatterned #5 (&H5)
|
4
|
+
# msdElementClassPrimary # 0 (&H0)
|
5
|
+
# msdElementClassPatternComponent #1 (&H1)
|
6
|
+
# msdElementClassConstruction #2 (&H2)
|
7
|
+
# msdElementClassDimension #3 (&H3)
|
8
|
+
# msdElementClassPrimaryRule #4 (&H4)
|
9
|
+
# msdElementClassLinearPatterned #5 (&H5)
|
13
10
|
# msdElementClassContructionRule #6 (&H6)
|
14
11
|
|
15
12
|
def class_inclusions
|
@@ -23,7 +20,7 @@ module Microstation
|
|
23
20
|
|
24
21
|
def reset_ole_classes
|
25
22
|
ole_obj.ExcludeAllClasses
|
26
|
-
end
|
23
|
+
end
|
27
24
|
|
28
25
|
def include_class(klass)
|
29
26
|
class_inclusions << klass
|
@@ -31,13 +28,12 @@ module Microstation
|
|
31
28
|
|
32
29
|
def resolve_class_scans
|
33
30
|
return unless class_inclusions.size > 0
|
31
|
+
|
34
32
|
reset_ole_classes
|
35
33
|
class_inclusions.each do |klass|
|
36
34
|
ole_obj.IncludeClass(klass)
|
37
35
|
end
|
38
36
|
end
|
39
|
-
|
40
37
|
end
|
41
38
|
end
|
42
|
-
|
43
39
|
end
|
@@ -1,9 +1,6 @@
|
|
1
1
|
module Microstation
|
2
|
-
|
3
2
|
module Scan
|
4
|
-
|
5
3
|
module Level
|
6
|
-
|
7
4
|
def level_inclusions
|
8
5
|
@level_inclusions ||= []
|
9
6
|
end
|
@@ -11,7 +8,7 @@ module Microstation
|
|
11
8
|
def include_level(level)
|
12
9
|
level_inclusions << level
|
13
10
|
end
|
14
|
-
|
11
|
+
|
15
12
|
def reset_levels
|
16
13
|
reset_ole_levels
|
17
14
|
@level_inclusions = []
|
@@ -23,16 +20,12 @@ module Microstation
|
|
23
20
|
|
24
21
|
def resolve_level_scans
|
25
22
|
return unless level_inclusions.size > 0
|
23
|
+
|
26
24
|
reset_ole_levels
|
27
25
|
level_inclusions.each do |level|
|
28
26
|
ole_obj.IncludeLevel(level)
|
29
27
|
end
|
30
28
|
end
|
31
|
-
|
32
29
|
end
|
33
|
-
|
34
30
|
end
|
35
|
-
|
36
31
|
end
|
37
|
-
|
38
|
-
|
@@ -1,13 +1,11 @@
|
|
1
1
|
module Microstation
|
2
|
-
|
3
2
|
module Scan
|
4
|
-
|
5
3
|
module LineStyle
|
6
|
-
|
7
4
|
def linestyles
|
8
|
-
@app.active_design_file.LineStyles
|
5
|
+
@app.active_design_file.LineStyles
|
6
|
+
rescue
|
7
|
+
[]
|
9
8
|
end
|
10
|
-
|
11
9
|
|
12
10
|
def linestyle_inclusions
|
13
11
|
@linestyle_inclusions ||= []
|
@@ -28,18 +26,12 @@ module Microstation
|
|
28
26
|
|
29
27
|
def resolve_linestyle_scans
|
30
28
|
return unless linestyle_inclusions.size > 0
|
29
|
+
|
31
30
|
reset_ole_linestyles
|
32
31
|
linestyle_inclusions.each do |linestyle|
|
33
32
|
ole_obj.IncludeLineStyle(linestyle)
|
34
33
|
end
|
35
34
|
end
|
36
|
-
|
37
35
|
end
|
38
|
-
|
39
36
|
end
|
40
|
-
|
41
37
|
end
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
@@ -1,9 +1,6 @@
|
|
1
1
|
module Microstation
|
2
|
-
|
3
2
|
module Scan
|
4
|
-
|
5
3
|
module LineWeight
|
6
|
-
|
7
4
|
def lineweight_inclusions
|
8
5
|
@lineweight_inclusions ||= []
|
9
6
|
end
|
@@ -23,6 +20,7 @@ module Microstation
|
|
23
20
|
|
24
21
|
def resolve_lineweight_scans
|
25
22
|
return unless lineweight_inclusions.size > 0
|
23
|
+
|
26
24
|
reset_ole_lineweights
|
27
25
|
lineweight_inclusions.each do |lineweight|
|
28
26
|
ole_obj.IncludeLineWeight(lineweight)
|
@@ -1,19 +1,13 @@
|
|
1
1
|
module Microstation
|
2
|
-
|
3
2
|
module Scan
|
4
|
-
|
5
3
|
module Range
|
6
|
-
|
7
4
|
def include_within_range(range)
|
8
5
|
ole_obj.IncludeOnlyWithinRange(range)
|
9
6
|
end
|
10
7
|
|
11
|
-
def range_from_points(pt1,pt2)
|
12
|
-
app.Range3dFromPoint3dPoint3d(pt1,pt2)
|
8
|
+
def range_from_points(pt1, pt2)
|
9
|
+
app.Range3dFromPoint3dPoint3d(pt1, pt2)
|
13
10
|
end
|
14
|
-
|
15
11
|
end
|
16
12
|
end
|
17
|
-
|
18
|
-
|
19
13
|
end
|
@@ -1,51 +1,48 @@
|
|
1
|
-
module Microstation
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
sc
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
scan_enum.each do |item|
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
1
|
+
module Microstation
|
2
|
+
module ScanTrait
|
3
|
+
def create_scanner(&block)
|
4
|
+
app.create_scanner(&block)
|
5
|
+
end
|
6
|
+
|
7
|
+
def scan_graphical(&block)
|
8
|
+
sc = create_scanner
|
9
|
+
sc.ExcludeNonGraphical
|
10
|
+
scan(sc, &block)
|
11
|
+
end
|
12
|
+
|
13
|
+
def scan_text(&block)
|
14
|
+
sc = create_scanner do
|
15
|
+
include_textual
|
16
|
+
end
|
17
|
+
scan(sc, &block)
|
18
|
+
end
|
19
|
+
|
20
|
+
def scan(criteria, &block)
|
21
|
+
scan_result = ole_run_scan(criteria)
|
22
|
+
return [] unless scan_result
|
23
|
+
|
24
|
+
scan_enum = Microstation::Enumerator.new(scan_result)
|
25
|
+
result = []
|
26
|
+
if block
|
27
|
+
scan_enum.each(&block)
|
28
|
+
else
|
29
|
+
scan_enum.each do |item|
|
30
|
+
result << item
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
return result unless block
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def ole_run_scan(criteria)
|
40
|
+
criteria.resolve
|
41
|
+
scan_result = begin
|
42
|
+
ole_obj.Scan(criteria.ole_obj)
|
43
|
+
rescue
|
44
|
+
nil
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -1,9 +1,6 @@
|
|
1
1
|
module Microstation
|
2
|
-
|
3
2
|
module Scan
|
4
|
-
|
5
3
|
module Subtype
|
6
|
-
|
7
4
|
def subtype_inclusions
|
8
5
|
@subtype_inclusions ||= []
|
9
6
|
end
|
@@ -28,13 +25,6 @@ module Microstation
|
|
28
25
|
ole_obj.IncludeSubtype(subtype)
|
29
26
|
end
|
30
27
|
end
|
31
|
-
|
32
28
|
end
|
33
|
-
|
34
29
|
end
|
35
|
-
|
36
30
|
end
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|