autocad 0.4.6 → 0.5
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.
- checksums.yaml +4 -4
- data/.rubocop/minitest.yml +2 -2
- data/.rubocop/strict.yml +4 -4
- data/.rubocop.yml +36 -33
- data/CHANGELOG.md +5 -5
- data/LICENSE.txt +21 -21
- data/README.md +134 -39
- data/Rakefile +26 -10
- data/exe/autocad +3 -3
- data/gemfiles/rubocop.gemfile +2 -1
- data/lib/autocad/app.rb +127 -28
- data/lib/autocad/arc.rb +3 -0
- data/lib/autocad/block.rb +11 -6
- data/lib/autocad/block_reference.rb +33 -4
- data/lib/autocad/bounding_box.rb +202 -0
- data/lib/autocad/dim_style.rb +4 -0
- data/lib/autocad/drawing.rb +873 -172
- data/lib/autocad/element.rb +217 -25
- data/lib/autocad/errors.rb +9 -0
- data/lib/autocad/filter.rb +502 -168
- data/lib/autocad/layer.rb +129 -41
- data/lib/autocad/layout.rb +120 -0
- data/lib/autocad/line.rb +154 -55
- data/lib/autocad/message_box.rb +95 -95
- data/lib/autocad/model.rb +217 -89
- data/lib/autocad/mtext.rb +189 -110
- data/lib/autocad/plot.rb +45 -0
- data/lib/autocad/plot_configuration.rb +372 -0
- data/lib/autocad/point.rb +7 -0
- data/lib/autocad/point3d.rb +18 -11
- data/lib/autocad/pviewport.rb +136 -21
- data/lib/autocad/selection_filter.rb +358 -180
- data/lib/autocad/selection_set.rb +140 -61
- data/lib/autocad/selection_set_adapter.rb +187 -8
- data/lib/autocad/spline.rb +27 -0
- data/lib/autocad/text.rb +66 -11
- data/lib/autocad/text_style.rb +4 -0
- data/lib/autocad/version.rb +1 -1
- data/lib/autocad/viewport.rb +57 -0
- data/lib/autocad.rb +126 -30
- data/lib/faa/cleanup.rb +137 -0
- data/lib/win32ole_helper.rb +52 -0
- data/rbs_collection.lock.yaml +38 -18
- data/sig/generated/autocad/app.rbs +278 -251
- data/sig/generated/autocad/arc.rbs +6 -3
- data/sig/generated/autocad/block.rbs +8 -5
- data/sig/generated/autocad/block_reference.rbs +99 -59
- data/sig/generated/autocad/bounding_box.rbs +78 -0
- data/sig/generated/autocad/dim_style.rbs +6 -0
- data/sig/generated/autocad/drawing.rbs +597 -158
- data/sig/generated/autocad/element.rbs +233 -166
- data/sig/generated/autocad/errors.rbs +29 -23
- data/sig/generated/autocad/filter.rbs +388 -60
- data/sig/generated/autocad/layer.rbs +76 -19
- data/sig/generated/autocad/layout.rbs +64 -0
- data/sig/generated/autocad/line.rbs +128 -25
- data/sig/generated/autocad/message_box.rbs +81 -81
- data/sig/generated/autocad/model.rbs +115 -41
- data/sig/generated/autocad/mtext.rbs +123 -0
- data/sig/generated/autocad/plot.rbs +26 -0
- data/sig/generated/autocad/plot_configuration.rbs +176 -0
- data/sig/generated/autocad/point.rbs +7 -0
- data/sig/generated/autocad/point3d.rbs +70 -66
- data/sig/generated/autocad/pviewport.rbs +64 -0
- data/sig/generated/autocad/selection_filter.rbs +226 -50
- data/sig/generated/autocad/selection_set.rbs +112 -37
- data/sig/generated/autocad/selection_set_adapter.rbs +235 -28
- data/sig/generated/autocad/spline.rbs +22 -0
- data/sig/generated/autocad/text.rbs +66 -7
- data/sig/generated/autocad/text_style.rbs +6 -0
- data/sig/generated/autocad/viewport.rbs +19 -2
- data/sig/generated/autocad.rbs +140 -68
- data/sig/generated/faa/cleanup.rbs +53 -0
- data/sig/generated/win32ole_helper.rbs +9 -0
- data/sig/prototype/lib/autocad/app.rbs +3 -1
- data/sig/prototype/lib/autocad/bounding_box.rbs +15 -0
- data/sig/prototype/lib/autocad/drawing.rbs +6 -0
- data/sig/prototype/lib/autocad/layer.rbs +5 -0
- data/sig/prototype/lib/autocad/viewport.rbs +7 -0
- data/sig/prototype/lib/autocad.rbs +1 -1
- metadata +29 -5
- data/event_handler.log +0 -24
- data/sig/generated/autocad/text_node.rbs +0 -37
@@ -1,158 +1,597 @@
|
|
1
|
-
# Generated from lib/autocad/drawing.rb with RBS::Inline
|
2
|
-
|
3
|
-
module Autocad
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
# @rbs
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
#
|
24
|
-
# @
|
25
|
-
# @
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
def
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
# @rbs
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
# @rbs
|
55
|
-
#
|
56
|
-
def
|
57
|
-
|
58
|
-
#
|
59
|
-
# @
|
60
|
-
# @rbs
|
61
|
-
def
|
62
|
-
|
63
|
-
#
|
64
|
-
# @
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
def
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
# @
|
76
|
-
|
77
|
-
|
78
|
-
# @
|
79
|
-
|
80
|
-
|
81
|
-
# @rbs
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
#
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
# @
|
100
|
-
# @rbs return
|
101
|
-
def
|
102
|
-
|
103
|
-
#
|
104
|
-
# @
|
105
|
-
|
106
|
-
|
107
|
-
# @
|
108
|
-
#
|
109
|
-
|
110
|
-
|
111
|
-
# @rbs return
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
# @rbs
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
# @rbs
|
128
|
-
def
|
129
|
-
|
130
|
-
#
|
131
|
-
# @
|
132
|
-
|
133
|
-
|
134
|
-
# @
|
135
|
-
|
136
|
-
|
137
|
-
#
|
138
|
-
|
139
|
-
|
140
|
-
#
|
141
|
-
# @
|
142
|
-
# @rbs
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
# @
|
147
|
-
# @rbs
|
148
|
-
def
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
def
|
157
|
-
|
158
|
-
|
1
|
+
# Generated from lib/autocad/drawing.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Autocad
|
4
|
+
# Represents an AutoCAD drawing document and provides interface for:
|
5
|
+
# - File operations (save/open/close)
|
6
|
+
# - Space management (Model/Paper)
|
7
|
+
# - Layer/block/text management
|
8
|
+
# - Plot configuration
|
9
|
+
# - User interaction
|
10
|
+
# - Selection sets
|
11
|
+
# - System variables
|
12
|
+
class Drawing
|
13
|
+
include Common
|
14
|
+
|
15
|
+
attr_reader app: untyped
|
16
|
+
|
17
|
+
# Create a Drawing instance from an OLE object
|
18
|
+
# @rbs app: Autocad::App -- the application instance
|
19
|
+
# @rbs ole: WIN32OLE -- the OLE object for the drawing
|
20
|
+
# @rbs return Drawing -- a new Drawing instance
|
21
|
+
def self.from_ole_obj: (Autocad::App app, WIN32OLE ole) -> Drawing
|
22
|
+
|
23
|
+
# Initialize a new Drawing instance
|
24
|
+
# @param app [Autocad::App] The application instance
|
25
|
+
# @param ole [WIN32OLE] The OLE object for the drawing
|
26
|
+
# @param requested_name [String, nil] Optional name for the drawing before it's saved
|
27
|
+
# @rbs app: Autocad::App -- the application instance
|
28
|
+
# @rbs ole: WIN32OLE -- the OLE object for the drawing
|
29
|
+
# @rbs requested_name: String? -- optional name for the drawing before it's saved
|
30
|
+
def initialize: (Autocad::App app, WIN32OLE ole, ?String? requested_name) -> untyped
|
31
|
+
|
32
|
+
# Get the event handler for this drawing
|
33
|
+
# @return [EventHandler] The event handler instance
|
34
|
+
# @rbs return EventHandler
|
35
|
+
def event_handler: () -> EventHandler
|
36
|
+
|
37
|
+
# Create a new selection set in the drawing
|
38
|
+
# @param name [String] The name for the selection set
|
39
|
+
# @yield [SelectionSetAdapter] Optional block for configuring the selection set
|
40
|
+
# @return [SelectionSetAdapter] The created selection set adapter
|
41
|
+
# @example Create a selection set with a filter
|
42
|
+
# create_selection_set("walls") do |ss|
|
43
|
+
# ss.filter.layer("WALLS").and.block_reference
|
44
|
+
# end
|
45
|
+
# @rbs name: String -- the name for the selection set
|
46
|
+
# @rbs return SelectionSetAdapter -- the created selection set adapter
|
47
|
+
def create_selection_set: (String name) -> SelectionSetAdapter
|
48
|
+
|
49
|
+
# Register an event handler
|
50
|
+
# @param event [String] Event key for handler
|
51
|
+
# @yield Handler procedure to execute when event occurs
|
52
|
+
# @example Register a handler for BeginCommand event
|
53
|
+
# register_handler("BeginCommand") { puts "Command started" }
|
54
|
+
# @rbs event: String -- event key for handler
|
55
|
+
# @rbs &: {() -> void} - handler Proc
|
56
|
+
def register_handler: (String event) ?{ (?) -> untyped } -> void
|
57
|
+
|
58
|
+
# Check if the drawing is read-only
|
59
|
+
# @return [Boolean] True if drawing is read only
|
60
|
+
# @rbs return bool -- true if drawing is read only
|
61
|
+
def read_only?: () -> bool
|
62
|
+
|
63
|
+
# Check if the drawing has been saved before
|
64
|
+
# @return [Boolean] True if drawing is previously saved
|
65
|
+
# @rbs return bool -- true if drawing is previously saved
|
66
|
+
def previously_saved?: () -> bool
|
67
|
+
|
68
|
+
# Check if the drawing has been modified since the last save
|
69
|
+
# @return [Boolean] True if drawing is modified
|
70
|
+
# @rbs return bool -- true if drawing is modified
|
71
|
+
def modified?: () -> bool
|
72
|
+
|
73
|
+
# Saves the drawing
|
74
|
+
# If the drawing hasn't been saved yet and no name is provided, uses the requested name
|
75
|
+
# @param name [String, nil] Optional new name for the drawing
|
76
|
+
# @param dir [String, Pathname, nil] Optional directory to save to
|
77
|
+
# @return [void]
|
78
|
+
# @example Save drawing with new name in specific directory
|
79
|
+
# drawing.save(name: "floor_plan_v2", dir: "C:/Projects/Building")
|
80
|
+
# @rbs name: String? -- optional new name for the drawing
|
81
|
+
# @rbs dir: String|Pathname? -- optional directory to save to
|
82
|
+
# @rbs return void
|
83
|
+
def save: (?name: String?, ?dir: String | Pathname?) -> void
|
84
|
+
|
85
|
+
# Save the drawing as a PDF file
|
86
|
+
# If name or directory is given, uses those params
|
87
|
+
# Otherwise uses the drawing name and directory
|
88
|
+
# @param name [String, nil] The name of the PDF file
|
89
|
+
# @param dir [String, Pathname, nil] The directory to save the PDF
|
90
|
+
# @param model [Boolean] Whether to use model space (true) or paper space (false)
|
91
|
+
# @return [void]
|
92
|
+
# @example Export to PDF with custom name
|
93
|
+
# drawing.save_as_pdf(name: "presentation", dir: "C:/Exports")
|
94
|
+
# @rbs name: String? - the name of the file
|
95
|
+
# @rbs dir: String? - the directory to save the drawing
|
96
|
+
def save_as_pdf: (?name: String?, ?dir: String?, ?model: untyped) -> void
|
97
|
+
|
98
|
+
# Get the center point of the current view
|
99
|
+
# @return [Point3d] The center of the view in world coordinates
|
100
|
+
# @rbs return Point3d -- the center of the view in world coordinates
|
101
|
+
def view_center: () -> Point3d
|
102
|
+
|
103
|
+
# Add a new plot configuration to the drawing
|
104
|
+
# @param name [String] Name for the new plot configuration
|
105
|
+
# @param model [Boolean] Whether this is for model space (true) or paper space (false)
|
106
|
+
# @return [PlotConfiguration] The created plot configuration
|
107
|
+
# @example Create a new PDF plot configuration
|
108
|
+
# pdf_config = drawing.add_plot_configuration("PDF_Export")
|
109
|
+
# pdf_config.device_name = "AutoCAD PDF.pc3"
|
110
|
+
# @rbs name: String
|
111
|
+
# @rbs return PlotConfiguration
|
112
|
+
def add_plot_configuration: (String name, ?model: untyped) -> PlotConfiguration
|
113
|
+
|
114
|
+
# Get the predefined PDF plot configuration "faa_ansid_bw"
|
115
|
+
# Creates it if it doesn't exist
|
116
|
+
# @return [PlotConfiguration] The PDF plot configuration
|
117
|
+
# @rbs return PlotConfiguration
|
118
|
+
def pdf_plot_config: () -> PlotConfiguration
|
119
|
+
|
120
|
+
# Get the plot object for this drawing
|
121
|
+
# @return [Plot] The plot object
|
122
|
+
# @rbs return Plot
|
123
|
+
def plot: () -> Plot
|
124
|
+
|
125
|
+
# Get the first layout that is not "Model"
|
126
|
+
# @return [Layout] The first paper space layout
|
127
|
+
# @rbs return Layout -- The first layout that is not "Model"
|
128
|
+
def paper_space_layout: () -> Layout
|
129
|
+
|
130
|
+
# Copy the drawing to a new file
|
131
|
+
# @param name [String, Pathname, nil] Name of the file
|
132
|
+
# @param dir [String, Pathname, nil] Target directory
|
133
|
+
# @return [void]
|
134
|
+
# @example Create a backup copy
|
135
|
+
# drawing.copy(name: "backup_#{Time.now.strftime('%Y%m%d')}.dwg")
|
136
|
+
# @rbs name: String | Pathname --name of the file
|
137
|
+
# @rbs dir: String|Pathname -- dir
|
138
|
+
def copy: (?name: String | Pathname, ?dir: String | Pathname) -> void
|
139
|
+
|
140
|
+
# Check if paper space is active
|
141
|
+
# @return [Boolean] True if paper space is active
|
142
|
+
# @rbs return bool -- true if paper space is active
|
143
|
+
def paper_space?: () -> bool
|
144
|
+
|
145
|
+
# Check if model space is active
|
146
|
+
# @return [Boolean] True if model space is active
|
147
|
+
# @rbs return bool -- true if model space is active
|
148
|
+
def model_space?: () -> bool
|
149
|
+
|
150
|
+
# Switch to paper space
|
151
|
+
# @return [void]
|
152
|
+
# @example Switch to paper space and add a viewport
|
153
|
+
# drawing.to_paper_space
|
154
|
+
# viewport = drawing.paper.add_pv_viewport(center, width: 200, height: 150)
|
155
|
+
# @rbs return void
|
156
|
+
def to_paper_space: () -> void
|
157
|
+
|
158
|
+
# Switch to model space
|
159
|
+
# @return [void]
|
160
|
+
# @example Switch to model space and add geometry
|
161
|
+
# drawing.to_model_space
|
162
|
+
# drawing.model.add_circle([0,0,0], 10)
|
163
|
+
# @rbs return void
|
164
|
+
def to_model_space: () -> void
|
165
|
+
|
166
|
+
# Returns the name of the drawing
|
167
|
+
# If the drawing hasn't been saved yet, returns the requested name
|
168
|
+
# @return [String] The name of the drawing with .dwg extension
|
169
|
+
# @rbs return String -- the name of the drawing
|
170
|
+
def name: () -> String
|
171
|
+
|
172
|
+
# Get the basename of the drawing as a Pathname
|
173
|
+
# @return [Pathname] The name as Pathname
|
174
|
+
# @rbs return Pathname -- the name as Pathname
|
175
|
+
def basename: () -> Pathname
|
176
|
+
|
177
|
+
# Get the directory of the drawing
|
178
|
+
# @return [Pathname] The directory of the file
|
179
|
+
# @rbs return Pathname -- the directory of the file
|
180
|
+
def dirname: () -> Pathname
|
181
|
+
|
182
|
+
# Get the full path of the drawing
|
183
|
+
# @return [Pathname] The complete path of file
|
184
|
+
# @rbs return Pathname -- the complete path of file
|
185
|
+
def path: () -> Pathname
|
186
|
+
|
187
|
+
# Get the active layer in the drawing
|
188
|
+
# @return [Layer] The active layer
|
189
|
+
# @rbs return Layer -- the active layer
|
190
|
+
def active_layer: () -> Layer
|
191
|
+
|
192
|
+
# Get the name of the active layer
|
193
|
+
# @return [String] The name of the active layer
|
194
|
+
# @rbs return String -- the name of the active layer
|
195
|
+
def active_layer_name: () -> String
|
196
|
+
|
197
|
+
# Set the active layer
|
198
|
+
# @param layer [Layer, String] Layer object or name to make active
|
199
|
+
# @raise [RuntimeError] If layer not found
|
200
|
+
# @example Set active layer by name
|
201
|
+
# drawing.active_layer = "Walls"
|
202
|
+
# @rbs layer: Layer | String -- make the given layer active
|
203
|
+
def active_layer=: (Layer | String layer) -> untyped
|
204
|
+
|
205
|
+
# Set the active paper space viewport
|
206
|
+
# @param vport [Autocad::PViewport] Viewport to make active
|
207
|
+
# @return [void]
|
208
|
+
# @rbs vport: Autocad::PViewport -- viewport to make active
|
209
|
+
# @rbs return void
|
210
|
+
def active_pviewport=: (Autocad::PViewport vport) -> void
|
211
|
+
|
212
|
+
# Get the active paper space viewport
|
213
|
+
# @return [PViewport] The active viewport
|
214
|
+
# @rbs return PViewport
|
215
|
+
def active_pviewport: () -> PViewport
|
216
|
+
|
217
|
+
# Get the active layout
|
218
|
+
# @return [Layout] The active layout
|
219
|
+
# @rbs return Layout
|
220
|
+
def active_layout: () -> Layout
|
221
|
+
|
222
|
+
# Set the active layout
|
223
|
+
# @param layout [Layout] Layout to make active
|
224
|
+
# @return [void]
|
225
|
+
# @example Switch to a specific layout
|
226
|
+
# layout = drawing.layouts.find { |l| l.name == "Layout1" }
|
227
|
+
# drawing.active_layout = layout
|
228
|
+
# @rbs layout: Layout -- layout to make active
|
229
|
+
def active_layout=: (Layout layout) -> untyped
|
230
|
+
|
231
|
+
# Get the currently active space (model or paper)
|
232
|
+
# @return [ModelSpace, PaperSpace] The active space object
|
233
|
+
def active_space: () -> untyped
|
234
|
+
|
235
|
+
# Close the drawing
|
236
|
+
# @param save [Boolean] Whether to save changes before closing
|
237
|
+
# @return [void]
|
238
|
+
# @raise [Autocad::DrawingClose] If closure fails
|
239
|
+
# @example Close without saving
|
240
|
+
# drawing.close(false)
|
241
|
+
# @rbs save: bool -- whether to save changes before closing
|
242
|
+
# @rbs return void
|
243
|
+
def close: (?bool save) -> void
|
244
|
+
|
245
|
+
# Get a selection set by name
|
246
|
+
# @param name [String] Selection set name to return
|
247
|
+
# @return [SelectionSet, nil] The selection set or nil if not found
|
248
|
+
# @example Get or create a selection set
|
249
|
+
# ss = drawing.get_selection_set("my_selection") || drawing.create_selection_set("my_selection")
|
250
|
+
# @rbs name: String -- selection set name to return
|
251
|
+
# @rbs return SelectionSet | nil
|
252
|
+
def get_selection_set: (String name) -> (SelectionSet | nil)
|
253
|
+
|
254
|
+
# Get all blocks in the drawing
|
255
|
+
# @return [Enumerator<Block>] An enumerator of blocks
|
256
|
+
# @yield [Block] Optional block to process each block
|
257
|
+
# @example Iterate through all blocks
|
258
|
+
# drawing.blocks.each { |block| puts block.name }
|
259
|
+
# @rbs return Enumerator[Block] -- an enumerator of blocks
|
260
|
+
# @rbs &: (Block) -> void -- optional block to process each block
|
261
|
+
def blocks: () { (Block) -> void } -> Enumerator[Block]
|
262
|
+
|
263
|
+
# Get all layouts in the drawing
|
264
|
+
# @return [Enumerator<Layout>] An enumerator of layouts
|
265
|
+
# @yield [Layout] Optional block to process each layout
|
266
|
+
# @example Find a layout by name
|
267
|
+
# title_layout = drawing.layouts.find { |layout| layout.name == "Title Block" }
|
268
|
+
# @rbs return Enumerator[Layout] -- an enumerator of layouts
|
269
|
+
# @rbs &: (Layout) -> void -- optional block to process each layout
|
270
|
+
def layouts: () { (Layout) -> void } -> Enumerator[Layout]
|
271
|
+
|
272
|
+
# Get all layers in the drawing
|
273
|
+
# @return [Enumerator<Layer>] An enumerator of layers
|
274
|
+
# @yield [Layer] Optional block to process each layer
|
275
|
+
# @example Find frozen layers
|
276
|
+
# frozen_layers = drawing.layers.select { |layer| layer.frozen? }
|
277
|
+
# @rbs return Enumerator[Layer] -- an enumerator of layers
|
278
|
+
# @rbs &: (Layer) -> void -- optional block to process each layer
|
279
|
+
def layers: () { (Layer) -> void } -> Enumerator[Layer]
|
280
|
+
|
281
|
+
# Get all linetypes in the drawing
|
282
|
+
# @return [Enumerator<Linetype>] An enumerator of linetypes
|
283
|
+
# @yield [Linetype] Optional block to process each linetype
|
284
|
+
# @example Load a new linetype
|
285
|
+
# unless drawing.linetypes.any? { |lt| lt.name == "DASHED" }
|
286
|
+
# drawing.load_linetype("acad.lin", "DASHED")
|
287
|
+
# end
|
288
|
+
# @rbs return Enumerator[Linetype] -- an enumerator of linetypes
|
289
|
+
# @rbs &: (Linetype) -> void -- optional block to process each linetype
|
290
|
+
def linetypes: () { (Linetype) -> void } -> Enumerator[Linetype]
|
291
|
+
|
292
|
+
# Create a new layer or get an existing one
|
293
|
+
# @param name [String, Layer] Layer name to create or existing Layer object
|
294
|
+
# @param color [Integer, Symbol, String, nil] Color for the layer (can be ACAD::COLOR constant, symbol, or integer)
|
295
|
+
# @return [Acad::Layer] The created or existing layer
|
296
|
+
# @example Create a red layer
|
297
|
+
# walls_layer = drawing.create_layer("Walls", :red)
|
298
|
+
# @example Create a layer with a specific color index
|
299
|
+
# detail_layer = drawing.create_layer("Details", 42)
|
300
|
+
# @rbs name: String | Layer -- layer name to create
|
301
|
+
# @rbs color: Integer|Symbol|String -- color for the layer (can be ACAD::COLOR constant, symbol, or integer)
|
302
|
+
# @rbs return Acad::Layer
|
303
|
+
def create_layer: (String | Layer name, ?Integer | Symbol | String color) -> Acad::Layer
|
304
|
+
|
305
|
+
# Regenerate the drawing display
|
306
|
+
# @param view_ports [Symbol] Viewports to regenerate (:all or :active)
|
307
|
+
# @return [void]
|
308
|
+
# @example Regenerate all viewports
|
309
|
+
# drawing.regen(:all)
|
310
|
+
# @note Uses AcRegenType enum from AutoCAD
|
311
|
+
# @rbs view_ports: Symbol -- :all or :active
|
312
|
+
# @rbs return void
|
313
|
+
def regen: (?Symbol view_ports) -> void
|
314
|
+
|
315
|
+
# Get all block references in model space
|
316
|
+
# @return [Enumerator<BlockReference>] All block references in model space
|
317
|
+
# @example Find all title blocks in model space
|
318
|
+
# title_blocks = drawing.model_block_references.select { |br| br.name == "TITLE_BLOCK" }
|
319
|
+
# @rbs return Enumerator[BlockReference] -- all block references in model space
|
320
|
+
def model_block_references: () -> Enumerator[BlockReference]
|
321
|
+
|
322
|
+
# Get all block references in paper space
|
323
|
+
# @return [Enumerator<BlockReference>] All block references in paper space
|
324
|
+
# @example Delete all border blocks in paper space
|
325
|
+
# drawing.paper_block_references.each do |br|
|
326
|
+
# br.delete if br.name == "BORDER"
|
327
|
+
# end
|
328
|
+
# @rbs return Enumerator[BlockReference] -- all block references in paper space
|
329
|
+
def paper_block_references: () -> Enumerator[BlockReference]
|
330
|
+
|
331
|
+
# Select all text objects containing the specified string
|
332
|
+
# @param str [String] Text pattern to search for (supports wildcards)
|
333
|
+
# @return [Enumerator<Element>] Text elements containing the pattern
|
334
|
+
# @example Find all text containing "REVISION"
|
335
|
+
# revision_texts = drawing.select_text_containing("*REVISION*")
|
336
|
+
def select_text_containing: (untyped str) -> untyped
|
337
|
+
|
338
|
+
# Check if the drawing has any paper space viewports
|
339
|
+
# @return [Boolean] True if paper space has at least one viewport
|
340
|
+
def has_pviewport?: () -> untyped
|
341
|
+
|
342
|
+
# Get a selection set containing text with the specified string
|
343
|
+
# @param str [String] Text pattern to search for
|
344
|
+
# @return [SelectionSetAdapter] Selection set with matching text
|
345
|
+
def get_select_text_containing: (untyped str) -> untyped
|
346
|
+
|
347
|
+
# Get all block references in the drawing
|
348
|
+
# @yield [BlockReference] Optional block to process each reference
|
349
|
+
# @return [Enumerator<BlockReference>] All block references
|
350
|
+
# @example Count references by block name
|
351
|
+
# counts = Hash.new(0)
|
352
|
+
# drawing.block_references { |br| counts[br.name] += 1 }
|
353
|
+
# &: (BlockReference) -> void
|
354
|
+
# @rbs return Enumerator[BlockReference]
|
355
|
+
def block_references: () -> Enumerator[BlockReference]
|
356
|
+
|
357
|
+
# Get all dimension styles in the drawing
|
358
|
+
# @yield [DimStyle] Optional block to process each dimension style
|
359
|
+
# @return [Enumerator<DimStyle>] Enumerator of dimension styles
|
360
|
+
# @example Find architectural dimension style
|
361
|
+
# arch_style = drawing.dim_styles.find { |ds| ds.name == "ARCHITECTURAL" }
|
362
|
+
# &: (DimStyle) -> void
|
363
|
+
# @rbs return Enumerator[DimStyle] -- enumerator of dimension styles in document
|
364
|
+
def dim_styles: () -> Enumerator[DimStyle]
|
365
|
+
|
366
|
+
# Get all text styles in the drawing
|
367
|
+
# @yield [TextStyle] Optional block to process each text style
|
368
|
+
# @return [Enumerator<TextStyle>] Enumerator of text styles
|
369
|
+
# @example Find a specific text style
|
370
|
+
# romans = drawing.text_styles.find { |ts| ts.name == "Romans" }
|
371
|
+
# &: (TextStyle) -> void
|
372
|
+
# @rbs return Enumerator[TextStyle] -- enumerator of text styles in document
|
373
|
+
def text_styles: () -> Enumerator[TextStyle]
|
374
|
+
|
375
|
+
# Get a selection set adapter for block references
|
376
|
+
# @return [SelectionSetAdapter] Selection set adapter for block references
|
377
|
+
# @example Use the selection set to filter block references
|
378
|
+
# ss = drawing.block_reference_selection_set
|
379
|
+
# ss.filter { |f| f.and(f.layer("Furniture"), f.block_reference) }
|
380
|
+
# @rbs return SelectionSetAdapter
|
381
|
+
def block_reference_selection_set: () -> SelectionSetAdapter
|
382
|
+
|
383
|
+
# Get the value of a system variable
|
384
|
+
# @param name [String] The name of the system variable
|
385
|
+
# @return [Object] The value of the system variable
|
386
|
+
# @example Get current layer
|
387
|
+
# current_layer = drawing.get_variable("CLAYER")
|
388
|
+
# @example Get dimension scale
|
389
|
+
# dim_scale = drawing.get_variable("DIMSCALE")
|
390
|
+
# @rbs name: String -- the name of the system variable
|
391
|
+
# @rbs return Object -- the value of the system variable
|
392
|
+
def get_variable: (String name) -> Object
|
393
|
+
|
394
|
+
# Set the value of a system variable
|
395
|
+
# @param name [String] The name of the system variable
|
396
|
+
# @param value [Object] The value to set
|
397
|
+
# @return [void]
|
398
|
+
# @example Set dimension scale
|
399
|
+
# drawing.set_variable("DIMSCALE", 2.5)
|
400
|
+
# @example Set current layer
|
401
|
+
# drawing.set_variable("CLAYER", "Dimensions")
|
402
|
+
# @rbs name: String -- the name of the system variable
|
403
|
+
# @rbs value: Object -- the value to set
|
404
|
+
# @rbs return void
|
405
|
+
def set_variable: (String name, Object value) -> void
|
406
|
+
|
407
|
+
# Set multiple system variables at once
|
408
|
+
# @param names [Array<String>] The names of the system variables
|
409
|
+
# @param values [Array<Object>] The values to set
|
410
|
+
# @return [void]
|
411
|
+
# @example Set multiple dimension variables
|
412
|
+
# drawing.set_variables(
|
413
|
+
# ["DIMSCALE", "DIMLWD", "DIMCLRT"],
|
414
|
+
# [2.5, 2, Autocad::Color::Blue]
|
415
|
+
# )
|
416
|
+
# @rbs names: Array[String] -- the names of the system variables
|
417
|
+
# @rbs values: Array[Object] -- the values to set
|
418
|
+
# @rbs return void
|
419
|
+
def set_variables: (Array[String] names, Array[Object] values) -> void
|
420
|
+
|
421
|
+
# Temporarily set system variables and restore them after the block executes
|
422
|
+
# @param names [Array<String>] The names of the system variables
|
423
|
+
# @param values [Array<Object>] The values to set
|
424
|
+
# @yield Block to execute with the temporary variable values
|
425
|
+
# @return [Object] The result of the block
|
426
|
+
# @example Temporarily change text settings
|
427
|
+
# drawing.with_system_variables(
|
428
|
+
# ["TEXTSTYLE", "TEXTSIZE"],
|
429
|
+
# ["Standard", 2.5]
|
430
|
+
# ) do
|
431
|
+
# # Add text with these settings
|
432
|
+
# drawing.model.add_text("Note", [0,0,0])
|
433
|
+
# end
|
434
|
+
# @rbs names: Array[String] -- the names of the system variables
|
435
|
+
# @rbs values: Array[Object] -- the values to set
|
436
|
+
# @rbs &block: Proc -- the block to execute with the temporary variable values
|
437
|
+
# @rbs return Object -- the result of the block
|
438
|
+
def with_system_variables: (Array[String] names, Array[Object] values) ?{ (?) -> untyped } -> Object
|
439
|
+
|
440
|
+
# Get the values of multiple system variables
|
441
|
+
# @param *atts [Array<String>] The names of the system variables
|
442
|
+
# @return [Array<Object>] The values of the system variables
|
443
|
+
# @example Get multiple dimension settings
|
444
|
+
# scale, arrow_size = drawing.get_variables("DIMSCALE", "DIMASZ")
|
445
|
+
# @rbs *atts: Array[String] -- the names of the system variables
|
446
|
+
# @rbs return Array[Object] -- the values of the system variables
|
447
|
+
def get_variables: (*Array[String] atts) -> Array[Object]
|
448
|
+
|
449
|
+
# Display a message in the AutoCAD command line
|
450
|
+
# @param message [String] The message to display
|
451
|
+
# @return [void]
|
452
|
+
# @example Show a status message
|
453
|
+
# drawing.prompt("Processing complete. Select objects to continue.")
|
454
|
+
# @rbs message: String -- the String to put in Autocad prompt
|
455
|
+
# @rbs return void
|
456
|
+
def prompt: (String message) -> void
|
457
|
+
|
458
|
+
# Get a string input from the user
|
459
|
+
# @param prompt [String] The string to prompt the user
|
460
|
+
# @param spaces [Boolean] Whether the string returned can contain spaces
|
461
|
+
# @return [String] User input
|
462
|
+
# @raise [Autocad::Error] If input operation fails
|
463
|
+
# @example Get a filename from user
|
464
|
+
# filename = drawing.get_input_string(prompt: "Enter filename:", spaces: false)
|
465
|
+
# @rbs prompt: String -- the string to prompt the user for String
|
466
|
+
# @rbs has_spaces: bool -- whether the string returned can contain spaces
|
467
|
+
def get_input_string: (?prompt: String, ?spaces: untyped) -> untyped
|
468
|
+
|
469
|
+
# Get an integer input from the user
|
470
|
+
# @param prompt [String] The string to prompt the user
|
471
|
+
# @return [Integer] User input
|
472
|
+
# @raise [Autocad::Error] If input operation fails
|
473
|
+
# @example Get number of copies
|
474
|
+
# copies = drawing.get_input_integer(prompt: "Enter number of copies:")
|
475
|
+
# @rbs prompt: String -- the string to prompt the user for Integer
|
476
|
+
def get_input_integer: (?prompt: String) -> untyped
|
477
|
+
|
478
|
+
# Get a floating point input from the user
|
479
|
+
# @param prompt [String] The string to prompt the user
|
480
|
+
# @return [Float] User input
|
481
|
+
# @raise [Autocad::Error] If input operation fails
|
482
|
+
# @example Get a scale factor
|
483
|
+
# scale = drawing.get_float(prompt: "Enter scale factor:")
|
484
|
+
def get_float: (?prompt: untyped) -> untyped
|
485
|
+
|
486
|
+
# Prompt the user for a point in the drawing
|
487
|
+
# @param prompt [String] The prompt string to display
|
488
|
+
# @param base_point [Array, Point3d, nil] Optional base point for rubber-band line
|
489
|
+
# @return [Point3d] The selected point
|
490
|
+
# @raise [Autocad::Error] If point selection fails
|
491
|
+
# @example Get start and end points for a line
|
492
|
+
# start = drawing.get_point(prompt: "Select start point:")
|
493
|
+
# end_pt = drawing.get_point(prompt: "Select end point:", base_point: start)
|
494
|
+
# drawing.model.add_line(start, end_pt)
|
495
|
+
# @note If base_point is provided, a stretched line is drawn from the base point
|
496
|
+
# @rbs prompt: String
|
497
|
+
# @rbs base_point: Array, Point3d, nil
|
498
|
+
# @rbs return [Point3d]
|
499
|
+
def get_point: (?prompt: String, ?base_point: Array) -> [ Point3d ]
|
500
|
+
|
501
|
+
# Prompt the user to select a rectangular region
|
502
|
+
# @return [Array<Point3d>] Two points defining opposite corners of the region
|
503
|
+
# @example Get a region for a window selection
|
504
|
+
# corner1, corner2 = drawing.get_region
|
505
|
+
# # Use corners for window selection
|
506
|
+
def get_region: () -> untyped
|
507
|
+
|
508
|
+
# Get all selection sets in the drawing
|
509
|
+
# @return [Enumerator<SelectionSetAdapter>] An enumerator of selection sets
|
510
|
+
# @yield [SelectionSetAdapter] Optional block to process each selection set
|
511
|
+
# @example Find a specific selection set
|
512
|
+
# walls_ss = drawing.selection_sets.find { |ss| ss.name == "WALLS" }
|
513
|
+
# @rbs return Enumerator[SelectionSetAdapter] -- an enumerator of selection sets
|
514
|
+
# @rbs &: (SelectionSetAdapter) -> void -- optional block to process each selection set
|
515
|
+
def selection_sets: () { (SelectionSetAdapter) -> void } -> Enumerator[SelectionSetAdapter]
|
516
|
+
|
517
|
+
# Get the model space of the drawing
|
518
|
+
# @return [ModelSpace] The model space container
|
519
|
+
# @example Add a circle to model space
|
520
|
+
# drawing.model_space.add_circle([0,0,0], 10)
|
521
|
+
# @rbs return ModelSpace -- the model space
|
522
|
+
def model_space: () -> ModelSpace
|
523
|
+
|
524
|
+
# Get all plot configurations in the drawing
|
525
|
+
# @return [Enumerator<PlotConfiguration>] Enumerator of plot configurations
|
526
|
+
# @yield [PlotConfiguration] Optional block to process each configuration
|
527
|
+
# @example Find a specific plot configuration
|
528
|
+
# pdf_config = drawing.plot_configurations.find { |pc| pc.name == "PDF_Export" }
|
529
|
+
# @rbs return Enumerator[PlotConfiguration] | void
|
530
|
+
# @rbs &: (PlotConfiguration) -> void
|
531
|
+
def plot_configurations: () { (PlotConfiguration) -> void } -> (Enumerator[PlotConfiguration] | void)
|
532
|
+
|
533
|
+
# Get all layouts in the drawing (duplicate method, should be removed)
|
534
|
+
# @return [Enumerator<Layout>] Enumerator of layouts
|
535
|
+
# @yield [Layout] Optional block to process each layout
|
536
|
+
# @rbs return Enumerator[Layout] | void
|
537
|
+
# @rbs &: (Layout) -> void
|
538
|
+
def plot_configurations: () { (Layout) -> void } -> (Enumerator[Layout] | void)
|
539
|
+
|
540
|
+
# Get the paper space of the drawing
|
541
|
+
# @return [PaperSpace] The paper space container
|
542
|
+
# @example Add a viewport to paper space
|
543
|
+
# drawing.paper_space.add_pv_viewport([5,5,0], width: 200, height: 150)
|
544
|
+
# @rbs return PaperSpace -- the paper space
|
545
|
+
def paper_space: () -> PaperSpace
|
546
|
+
|
547
|
+
# Get the underlying OLE object
|
548
|
+
# @return [WIN32OLE] The OLE object for the drawing
|
549
|
+
# @raise [DrawingClose] If drawing is closed or invalid
|
550
|
+
def ole_obj: () -> untyped
|
551
|
+
|
552
|
+
private
|
553
|
+
|
554
|
+
def default_event_handler: () -> untyped
|
555
|
+
|
556
|
+
def app_ole: () -> untyped
|
557
|
+
|
558
|
+
def dwg_path: (?name: untyped, ?dir: untyped) -> untyped
|
559
|
+
|
560
|
+
def dwg_name: (untyped name) -> untyped
|
561
|
+
|
562
|
+
def pdf_path: (?name: untyped, ?dir: untyped) -> untyped
|
563
|
+
|
564
|
+
def get_current_view_size: () -> untyped
|
565
|
+
|
566
|
+
def default_plot_setup: () -> untyped
|
567
|
+
|
568
|
+
# creates the "faa_ansid_bw" plot configuration
|
569
|
+
def create_pdf_plot_configutation: () -> PlotConfiguration
|
570
|
+
|
571
|
+
# Return the pdf name for the drawing.
|
572
|
+
#
|
573
|
+
# If a name is provided use the name provided otherwise use the drawing name
|
574
|
+
#
|
575
|
+
# @rbs name: String | nil -- change ext to pdf and return Pathname from
|
576
|
+
# the name or drawing name
|
577
|
+
def pdf_name: (?String | nil name) -> Pathname
|
578
|
+
|
579
|
+
def print_pdf: (untyped print_path, ?model: untyped) -> untyped
|
580
|
+
|
581
|
+
def print_paper_space_pdf: (untyped print_path) -> untyped
|
582
|
+
|
583
|
+
# If you copy the file the name to use
|
584
|
+
# @rbs backup_str: String -- the bqckup string to use for copies
|
585
|
+
def copy_name: (?String backup_str) -> untyped
|
586
|
+
|
587
|
+
def get_block_reference_selection_set: () -> untyped
|
588
|
+
|
589
|
+
# @rbs name: String -- selection set name to return
|
590
|
+
# @rbs return SelectionSet | nil
|
591
|
+
def get_ole_selection_set: (String name) -> (SelectionSet | nil)
|
592
|
+
|
593
|
+
def ole_selection_sets: () -> untyped
|
594
|
+
|
595
|
+
def utility: () -> untyped
|
596
|
+
end
|
597
|
+
end
|