microstation 0.4.1 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. checksums.yaml +7 -0
  2. data/.autotest +23 -23
  3. data/.rspec +2 -2
  4. data/Gemfile +28 -10
  5. data/History.txt +6 -6
  6. data/LICENSE.adoc +22 -0
  7. data/Manifest.txt +81 -60
  8. data/README.adoc +131 -0
  9. data/Rakefile +71 -30
  10. data/bin/dgn2pdf +36 -37
  11. data/bin/dgn_template +107 -0
  12. data/bin/microstation +231 -0
  13. data/bin/pw_print +35 -0
  14. data/cad_files/drawing_faatitle_in_non_default_model.dgn +0 -0
  15. data/cad_files/drawing_no_block.dgn +0 -0
  16. data/cad_files/drawing_with_3_block.dgn +0 -0
  17. data/cad_files/drawing_with_block.dgn +0 -0
  18. data/cad_files/seed2d.dgn +0 -0
  19. data/cad_files/test.dgn +0 -0
  20. data/lib/microstation.rb +252 -88
  21. data/lib/microstation/app.rb +781 -286
  22. data/lib/microstation/cad_input_queue.rb +100 -25
  23. data/lib/microstation/cell.rb +191 -0
  24. data/lib/microstation/changer.rb +70 -0
  25. data/lib/microstation/configuration.rb +193 -57
  26. data/lib/microstation/criteria_creation_t.rb +23 -0
  27. data/lib/microstation/dir.rb +252 -252
  28. data/lib/microstation/directory.rb +46 -0
  29. data/lib/microstation/drawing.rb +690 -189
  30. data/lib/microstation/element.rb +311 -0
  31. data/lib/microstation/enumerator.rb +32 -29
  32. data/lib/microstation/errors.rb +17 -0
  33. data/lib/microstation/event_handler.rb +28 -0
  34. data/lib/microstation/ext/pathname.rb +23 -25
  35. data/lib/microstation/ext/win32ole.rb +7 -0
  36. data/lib/microstation/extensions/faa.rb +124 -0
  37. data/lib/microstation/file_tests.rb +68 -0
  38. data/lib/microstation/functions.rb +60 -0
  39. data/lib/microstation/graphics.rb +35 -0
  40. data/lib/microstation/line.rb +19 -0
  41. data/lib/microstation/model.rb +45 -0
  42. data/lib/microstation/model_trait.rb +189 -0
  43. data/lib/microstation/ole_cad_input_message.rb +101 -0
  44. data/lib/microstation/ole_helper.rb +152 -0
  45. data/lib/microstation/pdf_support.rb +40 -40
  46. data/lib/microstation/point3d.rb +71 -0
  47. data/lib/microstation/primitive_command_interface.rb +66 -0
  48. data/lib/microstation/properties.rb +61 -57
  49. data/lib/microstation/property_handler.rb +48 -0
  50. data/lib/microstation/scan/color.rb +38 -38
  51. data/lib/microstation/scan/criteria.rb +89 -85
  52. data/lib/microstation/scan/klass.rb +43 -43
  53. data/lib/microstation/scan/level.rb +38 -38
  54. data/lib/microstation/scan/line_style.rb +45 -45
  55. data/lib/microstation/scan/line_weight.rb +33 -33
  56. data/lib/microstation/scan/range.rb +19 -0
  57. data/lib/microstation/scan/scan_trait.rb +51 -0
  58. data/lib/microstation/scan/subtype.rb +40 -40
  59. data/lib/microstation/scan/type.rb +134 -109
  60. data/lib/microstation/scan_trait.rb +62 -0
  61. data/lib/microstation/scanner.rb +24 -24
  62. data/lib/microstation/tag.rb +87 -58
  63. data/lib/microstation/tag_set.rb +385 -280
  64. data/lib/microstation/tag_set_trait.rb +51 -0
  65. data/lib/microstation/tagged_element.rb +105 -0
  66. data/lib/microstation/template.rb +90 -84
  67. data/lib/microstation/template_info.rb +172 -0
  68. data/lib/microstation/template_runner.rb +65 -0
  69. data/lib/microstation/text.rb +79 -54
  70. data/lib/microstation/text_node.rb +124 -74
  71. data/lib/microstation/ts/attribute.rb +140 -139
  72. data/lib/microstation/ts/instance.rb +146 -112
  73. data/lib/microstation/ts/tagset_trait.rb +49 -0
  74. data/lib/microstation/types.rb +91 -91
  75. data/lib/microstation/version.rb +5 -0
  76. data/lib/microstation/wrap.rb +28 -214
  77. data/plot/pdf-bw.plt +164 -164
  78. data/plot/pdf.plt +163 -163
  79. data/plot/png.plt +383 -383
  80. data/plot/tiff.plt +384 -384
  81. data/plot/wmbw.tbl +324 -66
  82. data/plot/wmcolor.tbl +62 -62
  83. metadata +301 -86
  84. data/.gemtest +0 -0
  85. data/README.txt +0 -75
  86. data/lib/microstation/attributes.rb +0 -35
  87. data/lib/microstation/extensions/hash.rb +0 -27
  88. data/spec/app_spec.rb +0 -267
  89. data/spec/configuration_spec.rb +0 -122
  90. data/spec/drawing_spec.rb +0 -247
  91. data/spec/drawings/new_drawing.dgn +0 -0
  92. data/spec/drawings/test.dgn +0 -0
  93. data/spec/drawings/test1.dgn +0 -0
  94. data/spec/drawings/testfile.pdf +0 -0
  95. data/spec/enumerator_spec.rb +0 -60
  96. data/spec/microstation_spec.rb +0 -36
  97. data/spec/scanner_spec.rb +0 -155
  98. data/spec/spec_app.rb +0 -11
  99. data/spec/spec_helper.rb +0 -31
  100. data/spec/tag_set_spec.rb +0 -123
  101. data/spec/text_node_spec.rb +0 -92
  102. data/spec/text_spec.rb +0 -62
data/spec/drawing_spec.rb DELETED
@@ -1,247 +0,0 @@
1
- require File.join(File.dirname(__FILE__) , 'spec_helper')
2
-
3
- module DrawingHelpers
4
-
5
- def create_new_drawing_path(name)
6
- path = drawing_path(name)
7
- File.delete(path) if File.exist? path
8
- return path
9
- end
10
-
11
- end
12
-
13
- describe Microstation::Drawing do
14
- include DrawingHelpers
15
-
16
- context "a drawing created with app.new_drawing" do
17
-
18
- before(:all) do
19
- @app = Microstation::App.new
20
- # debugger
21
- @drawing_name = 'my_new_drawing.dgn'
22
- @new_drawing_path = create_new_drawing_path('my_new_drawing.dgn')
23
- @new_drawing = @app.new_drawing(@new_drawing_path)
24
- end
25
-
26
- after(:all) do
27
- @app.close_active_drawing if @app
28
- @app.quit if @app
29
- File.delete(@new_drawing_path) if File.exist?(@new_drawing_path || "")
30
- end
31
-
32
- let(:new_drawing) { @new_drawing}
33
- let(:new_drawing_path) { @new_drawing_path }
34
- let(:new_drawing_name) {@drawing_name}
35
-
36
- # describe "#name and path" do
37
-
38
-
39
-
40
-
41
- # context "when given a relative name and no project_dir" do
42
- # before(:each) do
43
- # @app.project_dir = nil
44
- # @drawing_name = "my drawing.dgn"
45
- # @path = @app.normalize_name(@drawing_name)
46
-
47
- # end
48
-
49
- # after(:each) do
50
- # @path.unlink
51
- # end
52
-
53
- # subject{@app.new_drawing(@drawing_name) }
54
-
55
-
56
- # it "#name should be set to the name of the drawing with .dgn extension" do
57
- # subject.name.should =~ "my drawing.dgn"
58
- # end
59
-
60
- # it "#path should be the working path" do
61
- # subject.path.should == Pathname.getwd
62
- # end
63
-
64
- # end
65
-
66
- # context "when given a relative name and a project_dir" do
67
-
68
- # before(:each) do
69
- # @app.project_dir = "c:/my_projects/"
70
- # @new_drawing = @app.new_drawing('my drawing')
71
- # end
72
-
73
- # after(:each) do
74
- # File.delete(@new_drawing.full_path)
75
- # end
76
-
77
-
78
- # it "name should be the name of the drawing" do
79
- # @new_drawing.name.should == 'my drawing.dng'
80
- # end
81
-
82
- # it "path should == the project_dir" do
83
- # drawing.path.should == "c:\\my_projects"
84
- # end
85
-
86
- # end
87
- # end
88
-
89
- it "should be the active drawing" do
90
- new_drawing.should be_active
91
- end
92
-
93
- describe "#author" do
94
-
95
- it "should be '' to start" do
96
- pending
97
- new_drawing.author.should == ""
98
- end
99
-
100
- it "should set author if given a new author" do
101
- new_drawing.author = "A newer author"
102
- new_drawing.author.should == "A newer author"
103
- end
104
-
105
- end
106
-
107
- describe "#title" do
108
- it "should be '' to start" do
109
- new_drawing.title.should == ""
110
- end
111
-
112
- it "should set title if given a new title" do
113
- new_drawing.title = "a new title"
114
- new_drawing.title.should == "a new title"
115
- end
116
-
117
- end
118
-
119
- describe "#keywords" do
120
- it "should be empty to start" do
121
- new_drawing.keywords.should == ""
122
- end
123
-
124
- it "should set keywords if given a string of words" do
125
- new_drawing.keywords = "project, rcl, new"
126
- new_drawing.keywords.should == "project, rcl, new"
127
- end
128
- end
129
-
130
-
131
- it "should have a #comments method" do
132
- new_drawing.comments.should == ""
133
- new_drawing.comments = "these are the comments"
134
- new_drawing.comments.should == "these are the comments"
135
- end
136
-
137
-
138
-
139
-
140
- it "should have a two_d? method" do
141
- new_drawing.should be_two_d
142
- end
143
-
144
- it "should be able to save as pdf" do
145
- new_drawing.save_as_pdf
146
- end
147
-
148
- describe "revision count" do
149
- it "should have a revision_count" do
150
- new_drawing.should respond_to "revision_count"
151
- end
152
-
153
- it "should forward method" do
154
- new_drawing.ole_obj.should_receive("DesignRevisionCount").and_return(0)
155
- new_drawing.revision_count
156
- end
157
- end
158
-
159
- describe "pdf_name" do
160
- it "should be the passed in dirname + name with pdf changed for ext" do
161
- new_drawing.pdf_name("my_name","output").to_s.should == File.expand_path(File.join('output', "my_name.pdf"))
162
- end
163
-
164
- it "should == the name of the drawing file #basename with pdf ext with no args" do
165
- new_drawing.stub(:basename).and_return "Drawing Name"
166
- File.extname(new_drawing.pdf_name).should == '.pdf'
167
- File.basename(new_drawing.pdf_name, '.pdf').should == "Drawing Name"
168
- end
169
-
170
- end
171
-
172
-
173
- context "save_as_pdf" do
174
- it "should use the filename if given in args" do
175
- new_drawing.save_as_pdf("testfile")
176
- end
177
- end
178
-
179
- describe "scanning" do
180
-
181
- it "should have a #create_scanner" do
182
- scanner = new_drawing.create_scanner
183
- scanner.include_textual
184
- end
185
-
186
- it "should scan the drawing" do
187
- scanner = new_drawing.create_scanner do |scan|
188
- scan.include_textual
189
- end
190
- new_drawing.scan(scanner)
191
- end
192
- end
193
-
194
-
195
- describe "#scan_text" do
196
-
197
- it "only yields textual items" do
198
-
199
- new_drawing.scan_text do |item|
200
- item.class.should == (Microstation::Text || Microstation::TextNode)
201
- end
202
- end
203
- end
204
-
205
-
206
-
207
- end
208
- end
209
-
210
-
211
-
212
-
213
-
214
-
215
- # describe "#new_drawing" do
216
- # before(:each) do
217
- # ENV["USERNAME"] = "test person"
218
- # end
219
-
220
- # after(:each) do
221
- # @drawing.close
222
- # @drawing = nil
223
- # end
224
-
225
- # it "should set author" do
226
- # @app.should_receive(:username).and_return("test person")
227
- # @drawing = @app.new_drawing(new_drawing_path)
228
- # @drawing.author.should == "test person"
229
- # end
230
-
231
- # end
232
-
233
- # describe "creating a new drawing" do
234
- # before(:each) do
235
- # @drawing = @app.new_drawing(new_drawing_path)
236
- # end
237
-
238
- # after(:each) do
239
- # @drawing.close
240
- # @drawing = nil
241
- # end
242
-
243
-
244
-
245
-
246
-
247
-
Binary file
Binary file
Binary file
Binary file
@@ -1,60 +0,0 @@
1
- require File.join(File.dirname(__FILE__) , 'spec_helper')
2
-
3
- describe "Microstation::Enumerator" do
4
-
5
- context "given a drawing scanned with a textual criteria" do
6
-
7
- before(:all) do
8
- @app = Microstation::App.new
9
- @drawing = open_existing_drawing(@app)
10
- @criteria = @app.create_scanner do |scan|
11
- scan.include_textual
12
- end
13
-
14
- end
15
-
16
- after(:all) do
17
- @app.close_active_drawing
18
- @app.quit
19
- # path = @drawing.full_path
20
- #path.delete
21
- end
22
-
23
- let(:app) { @app}
24
- let(:drawing){@drawing}
25
-
26
- describe "app.scan" do
27
- it "returns an Enumerator" do
28
- pending
29
- enum = app.scan(@criteria)
30
- enum.should be_an_instance_of Microstation::Enumerator
31
- end
32
-
33
- it "should be a text node" do
34
- enum = app.scan(@criteria).to_enum
35
- first = enum.next
36
- first.should be_an_instance_of Microstation::Text
37
- end
38
-
39
- it "should all be textual" do
40
- pending
41
- enum = app.scan(@criteria)
42
- values = enum.map{|i| i}
43
- end
44
-
45
-
46
- end
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
- end
55
-
56
- end
57
-
58
-
59
-
60
-
@@ -1,36 +0,0 @@
1
- #require File.join(File.dirname(__FILE__) , 'spec_helper')
2
- require 'spec_helper.rb'
3
-
4
-
5
- describe Microstation do
6
-
7
- context "#root" do
8
-
9
- subject { Microstation.root}
10
-
11
- it { should be_instance_of Pathname}
12
- it "to_s" do
13
- subject.to_s.should == Pathname.getwd.to_s
14
- end
15
-
16
- end
17
-
18
-
19
- describe "#run" do
20
- it "opens up and yields an app" do
21
- Microstation.run do |app|
22
- app.class.should == Microstation::App
23
- end
24
- end
25
-
26
- it "can be called with implicit receiver" do
27
- Microstation.run do
28
- self.class.should == Microstation::App
29
- end
30
- end
31
-
32
- end
33
-
34
- end
35
-
36
-
data/spec/scanner_spec.rb DELETED
@@ -1,155 +0,0 @@
1
- require File.join(File.dirname(__FILE__) , 'spec_helper')
2
-
3
-
4
- describe Microstation::Scan::Criteria do
5
-
6
- before(:all) do
7
- @app = Microstation::App.new
8
- end
9
-
10
- after(:all) do
11
- @app.quit
12
- end
13
-
14
- let(:app) { @app}
15
-
16
- describe "#initialize" do
17
-
18
- before(:each) do
19
- @ole = double("scan_enum")
20
- app.stub(:create_ole_scan_criteria).and_return(@ole)
21
- app.stub(:load_constants)
22
- end
23
-
24
- it "requires an app as argument" do
25
- expect {
26
- Microstation::Scan::Criteria.new()
27
- }.to raise_error
28
-
29
- end
30
-
31
- it "sets the ole_obj to the passed in ole_obj" do
32
- scanner = Microstation::Scan::Criteria.new(app)
33
- scanner.send(:app).should equal(app)
34
- end
35
-
36
- it "sets the ole_obj variable" do
37
- scanner = Microstation::Scan::Criteria.new(app)
38
- scanner.send(:ole_obj).should equal(@ole)
39
- end
40
-
41
- end
42
-
43
-
44
- describe "Microstation::Scan::Criteria" do
45
- before(:each) do
46
- @scanner = Microstation::Scan::Criteria.create(app)
47
- end
48
-
49
- after(:each) do
50
- @scanner.close
51
- end
52
-
53
-
54
- # after(:all) do
55
- # @scanner = nil
56
- # @app.quit
57
- # end
58
-
59
- let(:scanner){ @scanner}
60
-
61
- it "removes the object from the scanner array on close" do
62
- app.scanners.should have(1).item
63
- app.scanners.find{|s| s == scanner}.should == scanner
64
- scanner.close
65
- app.scanners.should_not include(scanner)
66
- scanner.ole_obj.should be_nil
67
- scanner.app.should be_nil
68
- end
69
-
70
- it "can be reset level" do
71
- scanner.reset_levels
72
- end
73
-
74
- it "can reset types" do
75
- scanner.reset_types
76
- end
77
-
78
- it "can reset classes" do
79
- scanner.reset_classes
80
- end
81
-
82
- it "can reset all exclusions" do
83
-
84
- %w(classes colors levels linestyles lineweights subtypes types).each do |method|
85
- scanner.send("reset_#{method}")
86
- end
87
- end
88
-
89
- describe 'the win32ole object' do
90
- before(:each) do
91
- @ole = double('ole')
92
- @ole.stub('load_constants')
93
- scanner.stub('ole_obj').and_return @ole
94
- end
95
-
96
- after(:each) do
97
- @ole = nil
98
- end
99
-
100
- let(:ole){@ole}
101
-
102
- it "can scan by type" do
103
- ole.should_receive('ExcludeAllTypes')
104
- ole.should_receive('IncludeType').with 37# Microstation::MSD::MsdElementTypeTag
105
- scanner.include_tags
106
- scanner.resolve
107
- end
108
-
109
- it "can scan by color" do
110
- ole.should_receive('ExcludeAllColors')
111
- ole.should_receive('IncludeColor').with(3)
112
- scanner.include_color(3)
113
- scanner.resolve
114
- end
115
-
116
- it "can scan by linestyle" do
117
- ole.should_receive('ExcludeAllLineStyles')
118
- ole.should_receive('IncludeLineStyle')
119
- scanner.include_linestyle( scanner.linestyles[0])
120
- scanner.resolve
121
- end
122
-
123
- it "can scan by lineweight" do
124
- ole.should_receive('ExcludeAllLineWeights')
125
- ole.should_receive('IncludeLineWeight')
126
- scanner.include_lineweight(3)
127
- scanner.resolve
128
- end
129
-
130
- it "can scan by subtype" do
131
- ole.should_receive('ExcludeAllSubtypes')
132
- ole.should_receive('IncludeSubtype')
133
- scanner.include_subtype( Microstation::MSD::MsdElementSubtypeAuxiliaryCoordinateSystem)
134
- scanner.resolve
135
- end
136
-
137
- it "can scan by multiple" do
138
- ole.should_receive('ExcludeAllColors')
139
- ole.should_receive('IncludeColor').with(3)
140
- ole.should_receive('ExcludeAllTypes')
141
- ole.should_receive('IncludeType').with(37)
142
- scanner.include_color(3)
143
- scanner.include_tags
144
- scanner.resolve
145
- end
146
-
147
-
148
-
149
- end
150
-
151
- end
152
-
153
- end
154
-
155
-