microstation 0.8.5 → 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 -44
- 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 +57 -72
- 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 +36 -22
@@ -1,9 +1,6 @@
|
|
1
1
|
module Microstation
|
2
|
-
|
3
2
|
module Scan
|
4
|
-
|
5
3
|
module Type
|
6
|
-
|
7
4
|
# MsdElementTypeCellLibraryHeader
|
8
5
|
# MsdElementTypeCellHeader
|
9
6
|
# MsdElementTypeLine
|
@@ -78,6 +75,7 @@ module Microstation
|
|
78
75
|
|
79
76
|
def resolve_type_scans
|
80
77
|
return unless type_inclusions.size > 0
|
78
|
+
|
81
79
|
reset_ole_types
|
82
80
|
type_inclusions.each do |type|
|
83
81
|
ole_obj.IncludeType(type)
|
@@ -85,11 +83,11 @@ module Microstation
|
|
85
83
|
end
|
86
84
|
|
87
85
|
def include_cell_header
|
88
|
-
|
86
|
+
include_type(::Microstation::MSD::MsdElementTypeCellHeader)
|
89
87
|
end
|
90
88
|
|
91
89
|
def include_shared_cell
|
92
|
-
|
90
|
+
include_type(::Microstation::MSD::MsdElementTypeSharedCell)
|
93
91
|
end
|
94
92
|
|
95
93
|
def include_cells
|
@@ -98,19 +96,19 @@ module Microstation
|
|
98
96
|
end
|
99
97
|
|
100
98
|
def include_dimensions
|
101
|
-
|
99
|
+
include_type(::Microstation::MSD::MsdElementTypeDimension)
|
102
100
|
end
|
103
101
|
|
104
102
|
def include_text
|
105
|
-
|
103
|
+
include_type(::Microstation::MSD::MsdElementTypeText)
|
106
104
|
end
|
107
105
|
|
108
106
|
def include_tags
|
109
|
-
|
107
|
+
include_type ::Microstation::MSD::MsdElementTypeTag
|
110
108
|
end
|
111
109
|
|
112
110
|
def include_text_nodes
|
113
|
-
|
111
|
+
include_type ::Microstation::MSD::MsdElementTypeTextNode
|
114
112
|
end
|
115
113
|
|
116
114
|
def include_textual
|
@@ -119,16 +117,12 @@ module Microstation
|
|
119
117
|
end
|
120
118
|
|
121
119
|
def include_solids
|
122
|
-
|
120
|
+
include_type ::Microstation::MSD::MsdElementTypeSolid
|
123
121
|
end
|
124
122
|
|
125
123
|
def include_lines
|
126
|
-
|
124
|
+
include_type ::Microstation::MSD::MsdElementTypeLine
|
127
125
|
end
|
128
|
-
|
129
|
-
|
130
126
|
end
|
131
|
-
|
132
127
|
end
|
133
|
-
|
134
128
|
end
|
@@ -1,62 +1,55 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative "criteria_creation_t"
|
2
2
|
module Microstation
|
3
|
-
|
4
3
|
module ScanTrait
|
5
|
-
|
6
|
-
def create_scanner(name,&block)
|
4
|
+
def create_scanner(name, &block)
|
7
5
|
app.create_scanner(name, &block)
|
8
6
|
end
|
9
7
|
|
10
8
|
def text_criteria
|
11
|
-
app.scanners[:textual] || app.create_scanner(:textual){ include_textual}
|
9
|
+
app.scanners[:textual] || app.create_scanner(:textual) { include_textual }
|
12
10
|
end
|
13
11
|
|
14
12
|
def graphics_criteria
|
15
|
-
app.scanners[:graphical] || app.create_scanner(:graphical){ ExcludeNonGraphical}
|
13
|
+
app.scanners[:graphical] || app.create_scanner(:graphical) { ExcludeNonGraphical }
|
16
14
|
end
|
17
15
|
|
18
16
|
def tags_criteria
|
19
|
-
app.scanners[:tags] || app.create_scanner(:tags){ include_tags}
|
17
|
+
app.scanners[:tags] || app.create_scanner(:tags) { include_tags }
|
20
18
|
end
|
21
19
|
|
22
20
|
def cells_criteria
|
23
|
-
app.scanners[:cells] || app.create_scanner(:cells){ include_cells}
|
21
|
+
app.scanners[:cells] || app.create_scanner(:cells) { include_cells }
|
24
22
|
end
|
25
23
|
|
26
24
|
def lines_criteria
|
27
|
-
app.scanners[:lines] || app.create_scanner(:lines){ include_lines}
|
25
|
+
app.scanners[:lines] || app.create_scanner(:lines) { include_lines }
|
28
26
|
end
|
29
27
|
|
30
28
|
def scan_graphical(&block)
|
31
|
-
|
29
|
+
scan_model(graphic_criteria, &block)
|
32
30
|
end
|
33
31
|
|
34
32
|
def scan_text(&block)
|
35
|
-
|
33
|
+
scan_model(text_criteria, &block)
|
36
34
|
end
|
37
35
|
|
38
36
|
def scan_tags(&block)
|
39
|
-
|
37
|
+
scan_model(tags_criteria, &block)
|
40
38
|
end
|
41
39
|
|
42
40
|
def scan_cells(&block)
|
43
|
-
|
41
|
+
scan_model(cells_criteria, &block)
|
44
42
|
end
|
45
43
|
|
46
44
|
def scan_lines(&block)
|
47
|
-
|
45
|
+
scan_model(lines_criteria, &block)
|
48
46
|
end
|
49
47
|
|
50
|
-
|
51
48
|
def scan_cell_with_name(name, &block)
|
52
49
|
sc = create_scanner
|
53
50
|
sc.IncludeOnlyCell(name)
|
54
51
|
sc.include_cell
|
55
|
-
|
52
|
+
scan_model(sc, &block)
|
56
53
|
end
|
57
|
-
|
58
|
-
|
59
|
-
|
60
54
|
end
|
61
|
-
|
62
55
|
end
|
data/lib/microstation/scanner.rb
CHANGED
data/lib/microstation/tag.rb
CHANGED
@@ -1,11 +1,7 @@
|
|
1
|
-
require_relative
|
2
|
-
|
3
|
-
|
1
|
+
require_relative "tagged_element"
|
4
2
|
|
5
3
|
module Microstation
|
6
|
-
|
7
4
|
class Tag < Element
|
8
|
-
|
9
5
|
# def initialize(ole)
|
10
6
|
# @ole_obj = ole
|
11
7
|
# @original = @ole_obj.Value
|
@@ -20,7 +16,6 @@ module Microstation
|
|
20
16
|
ole_obj.Value = value
|
21
17
|
end
|
22
18
|
|
23
|
-
|
24
19
|
def ole_value
|
25
20
|
@ole_obj.Value
|
26
21
|
end
|
@@ -29,7 +24,6 @@ module Microstation
|
|
29
24
|
@ole_obj.TagDefinitionName
|
30
25
|
end
|
31
26
|
|
32
|
-
|
33
27
|
def inspect
|
34
28
|
"#{name}: #{value} ts ->#{tagset_name}"
|
35
29
|
end
|
@@ -55,9 +49,7 @@ module Microstation
|
|
55
49
|
@ole_obj.Value = value
|
56
50
|
end
|
57
51
|
|
58
|
-
|
59
|
-
@base_element = ele
|
60
|
-
end
|
52
|
+
attr_writer :base_element
|
61
53
|
|
62
54
|
def ole_base_element
|
63
55
|
@ole_obj.BaseElement
|
@@ -65,13 +57,16 @@ module Microstation
|
|
65
57
|
|
66
58
|
def base_element_id
|
67
59
|
base = ole_base_element
|
68
|
-
id =
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
60
|
+
id = begin
|
61
|
+
base.Id || base.ID64
|
62
|
+
rescue
|
63
|
+
nil
|
64
|
+
end
|
65
|
+
if id.instance_of?(WIN32OLE_RECORD)
|
66
|
+
return id.Low if id.Low > id.High
|
67
|
+
|
68
|
+
return id.High
|
69
|
+
|
75
70
|
end
|
76
71
|
id
|
77
72
|
end
|
@@ -79,9 +74,5 @@ module Microstation
|
|
79
74
|
def base_element
|
80
75
|
@base_element ||= TaggedElement.new(ole_base_element)
|
81
76
|
end
|
82
|
-
|
83
77
|
end
|
84
|
-
|
85
|
-
|
86
|
-
|
87
78
|
end
|
data/lib/microstation/tag_set.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
#require File.join(File.dirname(__FILE__) , 'attributes')
|
2
|
-
require File.join(File.dirname(__FILE__),
|
3
|
-
require File.join(File.dirname(__FILE__),
|
1
|
+
# require File.join(File.dirname(__FILE__) , 'attributes')
|
2
|
+
require File.join(File.dirname(__FILE__), "ts/instance")
|
3
|
+
require File.join(File.dirname(__FILE__), "ts/attribute")
|
4
4
|
|
5
5
|
module Microstation
|
6
|
-
|
7
6
|
module OleCollection
|
8
|
-
|
9
|
-
def initialize(ole_col)
|
7
|
+
def initialize(_ole_col)
|
10
8
|
@ole_obj = ole
|
11
9
|
end
|
12
10
|
|
13
11
|
def [](name)
|
14
|
-
ole_obj(name)
|
12
|
+
ole_obj(name)
|
13
|
+
rescue
|
14
|
+
nil
|
15
15
|
end
|
16
16
|
|
17
17
|
def each
|
@@ -23,17 +23,16 @@ module Microstation
|
|
23
23
|
def wrap(ts)
|
24
24
|
ts
|
25
25
|
end
|
26
|
-
|
27
26
|
end
|
28
27
|
|
29
|
-
|
30
28
|
class TagSets
|
31
29
|
include Enumerable
|
32
30
|
|
33
31
|
attr_reader :drawing, :ole_obj
|
34
32
|
|
35
|
-
def initialize(drawing,ole)
|
36
|
-
raise if ole
|
33
|
+
def initialize(drawing, ole)
|
34
|
+
raise if ole.nil?
|
35
|
+
|
37
36
|
@drawing = drawing
|
38
37
|
@ole_obj = ole
|
39
38
|
end
|
@@ -41,13 +40,13 @@ module Microstation
|
|
41
40
|
def init_ts
|
42
41
|
result = []
|
43
42
|
@ole_obj.each do |ts|
|
44
|
-
result << TagSet.new(drawing,ts)
|
43
|
+
result << TagSet.new(drawing, ts)
|
45
44
|
end
|
46
45
|
result
|
47
46
|
end
|
48
47
|
|
49
48
|
def to_s
|
50
|
-
"Tagsets: #{tagsets
|
49
|
+
"Tagsets: #{tagsets}"
|
51
50
|
end
|
52
51
|
|
53
52
|
def reset
|
@@ -56,23 +55,21 @@ module Microstation
|
|
56
55
|
end
|
57
56
|
|
58
57
|
def names
|
59
|
-
|
58
|
+
map { |ts| ts.name }
|
60
59
|
end
|
61
60
|
|
62
|
-
|
63
61
|
def tagsets
|
64
62
|
@tagsets ||= init_ts
|
65
63
|
end
|
66
64
|
|
67
|
-
def each
|
68
|
-
tagsets.each
|
69
|
-
yield obj
|
70
|
-
end
|
65
|
+
def each(&block)
|
66
|
+
tagsets.each(&block)
|
71
67
|
end
|
72
68
|
|
73
69
|
def find(name)
|
74
70
|
return nil if empty?
|
75
|
-
|
71
|
+
|
72
|
+
tagsets.detect { |ts| ts.name == name }
|
76
73
|
end
|
77
74
|
|
78
75
|
def last
|
@@ -86,7 +83,11 @@ module Microstation
|
|
86
83
|
def remove(name)
|
87
84
|
ts = find(name)
|
88
85
|
if ts
|
89
|
-
|
86
|
+
begin
|
87
|
+
@ole_obj.Remove(name)
|
88
|
+
rescue
|
89
|
+
nil
|
90
|
+
end
|
90
91
|
ts.close
|
91
92
|
ts = nil
|
92
93
|
end
|
@@ -99,13 +100,18 @@ module Microstation
|
|
99
100
|
|
100
101
|
def create(name)
|
101
102
|
raise if self[name]
|
102
|
-
|
103
|
-
ole =
|
104
|
-
|
103
|
+
|
104
|
+
ole = begin
|
105
|
+
@ole_obj.add(name)
|
106
|
+
rescue
|
107
|
+
binding.pry
|
108
|
+
end
|
109
|
+
# ts = Tagset.new(ole)
|
105
110
|
# yield definer if block_given?
|
106
111
|
reset
|
107
112
|
ts = self[name]
|
108
113
|
raise if ts.nil?
|
114
|
+
|
109
115
|
yield ts if block_given?
|
110
116
|
ts
|
111
117
|
end
|
@@ -113,7 +119,6 @@ module Microstation
|
|
113
119
|
def size
|
114
120
|
tagsets.size
|
115
121
|
end
|
116
|
-
|
117
122
|
end
|
118
123
|
|
119
124
|
# class Definer
|
@@ -124,7 +129,6 @@ module Microstation
|
|
124
129
|
# @tagset = tagset
|
125
130
|
# end
|
126
131
|
|
127
|
-
|
128
132
|
# def add_attribute(name,type,prompt: name, is_hidden: false, is_constant: false, default: nil)
|
129
133
|
# ole_td = create_ole_definition(name, type)
|
130
134
|
# td = TS::Attribute.new(ole_td)
|
@@ -157,10 +161,7 @@ module Microstation
|
|
157
161
|
|
158
162
|
# end
|
159
163
|
|
160
|
-
|
161
|
-
|
162
164
|
class Definition
|
163
|
-
|
164
165
|
attr_reader :tagset
|
165
166
|
|
166
167
|
def initialize(tagset)
|
@@ -178,13 +179,12 @@ module Microstation
|
|
178
179
|
# @definer ||= Definer.new(tagset)
|
179
180
|
# end
|
180
181
|
|
181
|
-
|
182
182
|
def attributes
|
183
183
|
@attributes ||= init_definitions
|
184
184
|
end
|
185
185
|
|
186
186
|
def attribute_names
|
187
|
-
attributes.map{|a| a.name}
|
187
|
+
attributes.map { |a| a.name }
|
188
188
|
end
|
189
189
|
|
190
190
|
def reset
|
@@ -192,11 +192,11 @@ module Microstation
|
|
192
192
|
end
|
193
193
|
|
194
194
|
def close
|
195
|
-
attributes.each{|
|
195
|
+
attributes.each { |a| a.close }
|
196
196
|
end
|
197
197
|
|
198
198
|
def [](name)
|
199
|
-
attributes.find{|d| d.name == name}
|
199
|
+
attributes.find { |d| d.name == name }
|
200
200
|
end
|
201
201
|
|
202
202
|
protected
|
@@ -209,8 +209,8 @@ module Microstation
|
|
209
209
|
@tagset.ole_obj.TagDefinitions
|
210
210
|
end
|
211
211
|
|
212
|
-
def create_ole_definition(name,type)
|
213
|
-
ole_tag_definitions.Add(name,ole_type(type))
|
212
|
+
def create_ole_definition(name, type)
|
213
|
+
ole_tag_definitions.Add(name, ole_type(type))
|
214
214
|
end
|
215
215
|
|
216
216
|
def init_definitions
|
@@ -221,7 +221,7 @@ module Microstation
|
|
221
221
|
results
|
222
222
|
end
|
223
223
|
|
224
|
-
def create_attribute(name,type,prompt: name, is_hidden: false, is_constant: false, default: nil)
|
224
|
+
def create_attribute(name, type, prompt: name, is_hidden: false, is_constant: false, default: nil)
|
225
225
|
ole_td = create_ole_definition(name, type)
|
226
226
|
td = TS::Attribute.new(ole_td)
|
227
227
|
td.prompt = prompt
|
@@ -235,49 +235,41 @@ module Microstation
|
|
235
235
|
def ole_type(type)
|
236
236
|
TS::Attribute.tag_type(type)
|
237
237
|
end
|
238
|
-
|
239
238
|
end
|
240
239
|
|
241
240
|
class TagSet
|
241
|
+
attr_reader :ole_obj, :instances, :drawing
|
242
242
|
|
243
|
-
|
244
|
-
|
245
|
-
attr_reader :instances, :drawing
|
246
|
-
|
247
|
-
def initialize(drawing,ole)
|
243
|
+
def initialize(drawing, ole)
|
248
244
|
@drawing = drawing
|
249
245
|
@ole_obj = ole
|
250
246
|
@instances = nil
|
251
247
|
end
|
252
248
|
|
253
|
-
def add_attribute(name,type
|
254
|
-
ts = definition.add_attribute(name,type
|
249
|
+
def add_attribute(name, type, **options, &block)
|
250
|
+
ts = definition.add_attribute(name, type, **options, &block)
|
255
251
|
end
|
256
252
|
|
257
253
|
# def definer
|
258
254
|
# @definer ||= Definer.new(self)
|
259
255
|
# end
|
260
256
|
|
261
|
-
|
262
|
-
|
263
257
|
def add_instance(array)
|
264
|
-
@instances << TS::Instance.new(self,array)
|
258
|
+
@instances << TS::Instance.new(self, array)
|
265
259
|
end
|
266
260
|
|
267
|
-
def create_instance(base_element_id
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
261
|
+
def create_instance(base_element_id, tags, model)
|
262
|
+
return unless @instaces.nil?
|
263
|
+
|
264
|
+
@instance = []
|
265
|
+
ti = TS::Instances.new(self, base_element_id, tags, model)
|
266
|
+
@instances << ti
|
267
|
+
ti
|
274
268
|
end
|
275
269
|
|
276
270
|
def create_instance(id, elements, model)
|
277
|
-
if @instances.nil?
|
278
|
-
|
279
|
-
end
|
280
|
-
ti = TS::Instance.new(self,id,elements,model)
|
271
|
+
@instances = [] if @instances.nil?
|
272
|
+
ti = TS::Instance.new(self, id, elements, model)
|
281
273
|
@instances << ti
|
282
274
|
ti
|
283
275
|
end
|
@@ -294,15 +286,13 @@ module Microstation
|
|
294
286
|
|
295
287
|
def instances
|
296
288
|
if @instances.nil? && find_tagset_instances_not_called?
|
297
|
-
@instances = @drawing.create_tagset_instances(
|
289
|
+
@instances = @drawing.create_tagset_instances(ts_name: name).to_a
|
298
290
|
end
|
299
291
|
raise if find_tagset_instances_not_called?
|
292
|
+
|
300
293
|
@instances.nil? ? [] : @instances
|
301
294
|
end
|
302
295
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
296
|
# def create_instances_from_drawing(drawing)
|
307
297
|
# mytags = tags_for_self(tags)
|
308
298
|
# grouped = grouped_tags_to_host(mytags)
|
@@ -313,7 +303,6 @@ module Microstation
|
|
313
303
|
# Microstation.app.current_drawing.scan_tags
|
314
304
|
# end
|
315
305
|
|
316
|
-
|
317
306
|
def close
|
318
307
|
@ole_obj = nil
|
319
308
|
end
|
@@ -352,18 +341,14 @@ module Microstation
|
|
352
341
|
@tag_definitions = nil
|
353
342
|
end
|
354
343
|
|
355
|
-
|
356
344
|
def find_tagset_instances_not_called?
|
357
345
|
!drawing.find_tagset_instances_called?
|
358
346
|
end
|
359
347
|
|
360
|
-
|
361
348
|
# def create_ole_definition(name,type)
|
362
349
|
# ole_tag_definitions.Add(name, ole_type(type))
|
363
350
|
# end
|
364
351
|
|
365
|
-
private
|
366
|
-
|
367
352
|
# protected
|
368
353
|
|
369
354
|
# def tags_for_self(tags)
|
@@ -377,9 +362,5 @@ module Microstation
|
|
377
362
|
# def ole_tag_definitions
|
378
363
|
# @ole_obj.TagDefinitions
|
379
364
|
# end
|
380
|
-
|
381
|
-
|
382
|
-
|
383
365
|
end
|
384
|
-
|
385
366
|
end
|
@@ -1,13 +1,11 @@
|
|
1
1
|
module Microstation
|
2
|
-
|
3
2
|
module TagSetTrait
|
4
|
-
|
5
3
|
def tagsets
|
6
|
-
@tagsets ||= TagSets.new(self,ole_obj_tagsets)
|
4
|
+
@tagsets ||= TagSets.new(self, ole_obj_tagsets)
|
7
5
|
end
|
8
6
|
|
9
7
|
def tagset_names
|
10
|
-
tagsets.map{|ts| ts.name}
|
8
|
+
tagsets.map { |ts| ts.name }
|
11
9
|
end
|
12
10
|
|
13
11
|
def reset_tagsets
|
@@ -15,16 +13,16 @@ module Microstation
|
|
15
13
|
tagsets
|
16
14
|
end
|
17
15
|
|
18
|
-
def create_tagset(name
|
16
|
+
def create_tagset(name, &block)
|
19
17
|
ts = tagsets.create(name)
|
20
18
|
reset_tagsets
|
21
19
|
block.call ts if block
|
22
20
|
ts
|
23
21
|
end
|
24
22
|
|
25
|
-
def create_tagset!(name
|
23
|
+
def create_tagset!(name, &block)
|
26
24
|
remove_tagset(name)
|
27
|
-
create_tagset(name
|
25
|
+
create_tagset(name, &block)
|
28
26
|
end
|
29
27
|
|
30
28
|
def remove_tagset(name)
|
@@ -43,9 +41,7 @@ module Microstation
|
|
43
41
|
end
|
44
42
|
|
45
43
|
def ensure_tags(tags)
|
46
|
-
tags.map{|t| t.
|
44
|
+
tags.map { |t| t.instance_of?(WIN32OLE) ? app.ole_to_ruby(t) : t }
|
47
45
|
end
|
48
|
-
|
49
46
|
end
|
50
|
-
|
51
47
|
end
|