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
@@ -1,57 +1,61 @@
1
- module Microstation
2
-
3
- module Properties
4
-
5
- def author=(var = nil)
6
- if var
7
- @ole_obj.Author = var
8
- else
9
- @ole_obj.Author rescue nil
10
- end
11
-
12
- end
13
-
14
- alias_method :author, :author=
15
-
16
- def subject=(var = nil)
17
- if var
18
- @ole_obj.Subject = var
19
- else
20
- @ole_obj.Subject rescue nil
21
- end
22
-
23
- end
24
-
25
- alias_method :subject, :subject=
26
-
27
- def comments=(var = nil)
28
- var ? @ole_obj.Comments = var : @ole_obj.Comments
29
- end
30
-
31
- alias_method :comments, :comments=
32
-
33
- def title=(var = nil)
34
- if var
35
- @ole_obj.Title = var
36
- else
37
- @ole_obj.Title rescue nil
38
- end
39
- end
40
-
41
- alias_method :title,:title=
42
-
43
- def keywords=(var = nil)
44
- if var
45
- @ole_obj.Keywords = var
46
- else
47
- @ole_obj.Keywords rescue nil
48
- end
49
- end
50
-
51
-
52
- alias_method :keywords, :keywords=
53
-
54
- end
55
-
56
-
57
- end
1
+ module Microstation
2
+
3
+ module Properties
4
+
5
+ def author=(var = nil)
6
+ if var
7
+ @ole_obj.Author = var
8
+ else
9
+ @ole_obj.Author rescue nil
10
+ end
11
+
12
+ end
13
+
14
+ alias_method :author, :author=
15
+
16
+ def subject=(var = nil)
17
+ if var
18
+ @ole_obj.Subject = var
19
+ else
20
+ @ole_obj.Subject rescue nil
21
+ end
22
+
23
+ end
24
+
25
+ alias_method :subject, :subject=
26
+
27
+ def comments=(var = nil)
28
+ if var
29
+ @ole_obj.Comments = var
30
+ else
31
+ @ole_obj.Comments rescue nil
32
+ end
33
+ end
34
+
35
+ alias_method :comments, :comments=
36
+
37
+ def title=(var = nil)
38
+ if var
39
+ @ole_obj.Title = var
40
+ else
41
+ @ole_obj.Title rescue nil
42
+ end
43
+ end
44
+
45
+ alias_method :title,:title=
46
+
47
+ def keywords=(var = nil)
48
+ if var
49
+ @ole_obj.Keywords = var
50
+ else
51
+ @ole_obj.Keywords rescue nil
52
+ end
53
+ end
54
+
55
+
56
+ alias_method :keywords, :keywords=
57
+
58
+ end
59
+
60
+
61
+ end
@@ -0,0 +1,48 @@
1
+ module Microstation
2
+
3
+ class PropertyHandler
4
+
5
+ attr_reader :ole_obj
6
+
7
+ def initialize(ole)
8
+ @ole_obj = ole
9
+ end
10
+
11
+ def has_property?(value)
12
+ prop = ole_obj.SelectByAccessString(value)
13
+ !!(prop)
14
+ end
15
+
16
+ def [](property)
17
+ return unless has_property?(property)
18
+ ole_obj.GetValue
19
+ end
20
+
21
+ def get_property_as_point3d(property)
22
+ return unless has_property?(property)
23
+ ole_pt = ole_obj.GetValueAsPoint3d
24
+ Point3d.new(ole_pt)
25
+ end
26
+
27
+
28
+ def []=(property,value)
29
+ return unless has_property?(property)
30
+ ole_obj.SetValue(value)
31
+ end
32
+
33
+ def property_names
34
+ names = ole_obj.GetAccessStrings
35
+ result = []
36
+ names.each do |e|
37
+ if block_given?
38
+ yield e
39
+ else
40
+ result << e
41
+ end
42
+ end
43
+ result unless block_given?
44
+ end
45
+
46
+ end
47
+
48
+ end
@@ -1,38 +1,38 @@
1
- module Microstation
2
-
3
- module Scan
4
-
5
- module Color
6
-
7
- def color_inclusions
8
- @color_inclusions ||= []
9
- end
10
-
11
- def include_color(color)
12
- color_inclusions << color
13
- end
14
-
15
- def reset_colors
16
- reset_ole_colors
17
- @color_inclusions = []
18
- end
19
-
20
- def reset_ole_colors
21
- ole_obj.ExcludeAllColors
22
- end
23
-
24
- def resolve_color_scans
25
- return unless color_inclusions.size > 0
26
- reset_ole_colors
27
- color_inclusions.each do |color|
28
- ole_obj.IncludeColor(color)
29
- end
30
- end
31
-
32
- end
33
-
34
- end
35
- end
36
-
37
-
38
-
1
+ module Microstation
2
+
3
+ module Scan
4
+
5
+ module Color
6
+
7
+ def color_inclusions
8
+ @color_inclusions ||= []
9
+ end
10
+
11
+ def include_color(color)
12
+ color_inclusions << color
13
+ end
14
+
15
+ def reset_colors
16
+ reset_ole_colors
17
+ @color_inclusions = []
18
+ end
19
+
20
+ def reset_ole_colors
21
+ ole_obj.ExcludeAllColors
22
+ end
23
+
24
+ def resolve_color_scans
25
+ return unless color_inclusions.size > 0
26
+ reset_ole_colors
27
+ color_inclusions.each do |color|
28
+ ole_obj.IncludeColor(color)
29
+ end
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+ end
36
+
37
+
38
+
@@ -1,85 +1,89 @@
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
-
9
- module Microstation
10
-
11
- class App
12
-
13
- def create_ole_scan_criteria
14
- ole_obj.CreateObjectInMicroStation("MicroStationDGN.ElementScanCriteria")
15
- end
16
-
17
- end
18
-
19
- end
20
-
21
- module Microstation
22
-
23
- module Scan
24
-
25
- class Criteria
26
-
27
- include Scan::Klass
28
- include Scan::Type
29
- include Scan::Level
30
- include Scan::Color
31
- include Scan::LineStyle
32
- include Scan::LineWeight
33
- include Scan::Subtype
34
-
35
- attr_reader :app
36
-
37
- def self.create_scanner(app,&block)
38
- sc = create(app)
39
- return sc unless block
40
- block.arity < 1 ? sc.instance_eval(&block) : block.call(sc)
41
- sc
42
- end
43
-
44
- def self.create(app)
45
- sc = new(app)
46
- app.scanners << sc
47
- sc
48
- end
49
-
50
-
51
- def initialize(app)
52
- @app = app
53
- @ole_obj = @app.create_ole_scan_criteria
54
- @app.load_constants #unless defined? Microstation::MSD
55
- end
56
-
57
- def resolve
58
- resolve_type_scans
59
- resolve_class_scans
60
- resolve_color_scans
61
- resolve_level_scans
62
- resolve_linestyle_scans
63
- resolve_lineweight_scans
64
- resolve_subtype_scans
65
- end
66
-
67
- def close
68
- @ole_obj = nil
69
- @app.scanners.delete(self) if @app
70
- @app = nil
71
- end
72
-
73
- def ole_obj
74
- @ole_obj
75
- end
76
-
77
- def method_missing(method,*args)
78
- @ole_obj.send(method,*args)
79
- end
80
-
81
-
82
- end
83
- end
84
-
85
- end
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
+
10
+ module Microstation
11
+
12
+ class App
13
+
14
+ def create_ole_scan_criteria
15
+ ole_obj.CreateObjectInMicroStation("MicroStationDGN.ElementScanCriteria")
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+
22
+ module Microstation
23
+
24
+ module Scan
25
+
26
+ class Criteria
27
+
28
+ include Scan::Klass
29
+ include Scan::Type
30
+ include Scan::Level
31
+ include Scan::Color
32
+ include Scan::LineStyle
33
+ include Scan::LineWeight
34
+ include Scan::Subtype
35
+ include Scan::Range
36
+
37
+ attr_reader :app
38
+
39
+ def self.create_scanner(name=nil, app,&block)
40
+ sc = create(name,app)
41
+ return sc unless block
42
+ block.arity < 1 ? sc.instance_eval(&block) : block.call(sc)
43
+ sc
44
+ end
45
+
46
+ def self.create(name=nil,app)
47
+ sc = new(app)
48
+ if name.nil?
49
+ name = "anon#{app.scanners.size + 1}"
50
+ end
51
+ app.scanners[name] = sc
52
+ sc
53
+ end
54
+
55
+
56
+ def initialize(app)
57
+ @app = app
58
+ @ole_obj = @app.create_ole_scan_criteria
59
+ @app.load_constants unless defined? ::Microstation::MSD
60
+ end
61
+
62
+ def resolve
63
+ resolve_type_scans
64
+ resolve_class_scans
65
+ resolve_color_scans
66
+ resolve_level_scans
67
+ resolve_linestyle_scans
68
+ resolve_lineweight_scans
69
+ resolve_subtype_scans
70
+ end
71
+
72
+ def close
73
+ @app.scanners.delete(self) if @app
74
+ @ole_obj = nil
75
+ end
76
+
77
+ def ole_obj
78
+ @ole_obj
79
+ end
80
+
81
+ def method_missing(method,*args)
82
+ @ole_obj.send(method,*args)
83
+ end
84
+
85
+
86
+ end
87
+ end
88
+
89
+ end
@@ -1,43 +1,43 @@
1
- module Microstation
2
-
3
- module Scan
4
-
5
- module Klass
6
-
7
- # msdElementClassPrimary # 0 (&H0)
8
- # msdElementClassPatternComponent #1 (&H1)
9
- # msdElementClassConstruction #2 (&H2)
10
- # msdElementClassDimension #3 (&H3)
11
- # msdElementClassPrimaryRule #4 (&H4)
12
- # msdElementClassLinearPatterned #5 (&H5)
13
- # msdElementClassContructionRule #6 (&H6)
14
-
15
- def class_inclusions
16
- @class_inclusions ||= []
17
- end
18
-
19
- def reset_classes
20
- reset_ole_classes
21
- @class_inclusions = []
22
- end
23
-
24
- def reset_ole_classes
25
- ole_obj.ExcludeAllClasses
26
- end
27
-
28
- def include_class(klass)
29
- class_inclusions << klass
30
- end
31
-
32
- def resolve_class_scans
33
- return unless class_inclusions.size > 0
34
- reset_ole_classes
35
- class_inclusions.each do |klass|
36
- ole_obj.IncludeClass(klass)
37
- end
38
- end
39
-
40
- end
41
- end
42
-
43
- end
1
+ module Microstation
2
+
3
+ module Scan
4
+
5
+ module Klass
6
+
7
+ # msdElementClassPrimary # 0 (&H0)
8
+ # msdElementClassPatternComponent #1 (&H1)
9
+ # msdElementClassConstruction #2 (&H2)
10
+ # msdElementClassDimension #3 (&H3)
11
+ # msdElementClassPrimaryRule #4 (&H4)
12
+ # msdElementClassLinearPatterned #5 (&H5)
13
+ # msdElementClassContructionRule #6 (&H6)
14
+
15
+ def class_inclusions
16
+ @class_inclusions ||= []
17
+ end
18
+
19
+ def reset_classes
20
+ reset_ole_classes
21
+ @class_inclusions = []
22
+ end
23
+
24
+ def reset_ole_classes
25
+ ole_obj.ExcludeAllClasses
26
+ end
27
+
28
+ def include_class(klass)
29
+ class_inclusions << klass
30
+ end
31
+
32
+ def resolve_class_scans
33
+ return unless class_inclusions.size > 0
34
+ reset_ole_classes
35
+ class_inclusions.each do |klass|
36
+ ole_obj.IncludeClass(klass)
37
+ end
38
+ end
39
+
40
+ end
41
+ end
42
+
43
+ end