Class: Microstation::Drawing
- Inherits:
-
Object
- Object
- Microstation::Drawing
- Includes:
- Properties, ScanTrait, TagSetTrait
- Defined in:
- lib/microstation/dir.rb,
lib/microstation/drawing.rb,
lib/microstation/extensions/faa.rb,
lib/microstation/extensions/faa.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
-
#active? ⇒ Boolean
Is the drawing active?.
- #active_model ⇒ Object
- #add_element(line) ⇒ Object
-
#basename ⇒ Pathname
The name as Pathname.
-
#cad_input_queue {|Microstation::CadInputQueue| ... } ⇒ Object
the block.
-
#change_model(name) ⇒ Model?
(also: #activate_model)
activate the model with name param name [String] name the name of the model activate the model found and return the model.
- #change_text_suffix(reg, offset) ⇒ Object
- #close ⇒ Object
-
#copy(name: nil, dir: nil) ⇒ Object
copy the drawing.
- #create_line(p1, p2, el = nil) ⇒ Object
- #create_scanner(name, &block) ⇒ Object
- #create_tagset_instance_from_tagset_hash(h) ⇒ Object
- #create_tagset_instances(ts_name: nil, base_element_id: nil) ⇒ Object
-
#create_tagset_instances_bak ⇒ Object
used.
-
#default_model_reference ⇒ Model
The ole.DefaultModelReference.
-
#dimensions ⇒ Object
alias_method :keywords , :keywords=x.
-
#dirname ⇒ Pathname
The directory of the file.
- #drawing_closed? ⇒ Boolean
-
#each_model {|Model| ... } ⇒ Object
iterate through each model in the drawing and yield them.
- #eval_cexpression(string) ⇒ Object
-
#find_by_id(id) ⇒ Object
Iterates through all the models and finds the ole_el with id.
- #find_line_element ⇒ Object
-
#find_model(name) ⇒ Model?
Find the model in the drawing.
- #find_tagset_instance_by_name(name) ⇒ Object
- #find_tagset_instance_by_name_and_id(name, id) ⇒ Object
- #find_tagset_instance_from_hash(ti_array, h_local) ⇒ Object
- #find_tagset_instances_called? ⇒ Boolean
- #find_tagsets ⇒ Object
- #get_matching_text(re, &block) ⇒ Object
- #get_selected_elements ⇒ Object
- #get_selected_text ⇒ Object
-
#get_tagsets_in_drawing_hash(ts_name: nil, base_element_id: nil) ⇒ Object
used.
- #get_text(&block) ⇒ Object
-
#has_active_model? ⇒ Boolean
True if drawing has an active model.
-
#initialize(app, ole) ⇒ Drawing
constructor
Initialize drawing.
-
#model_names ⇒ Array<String>
Returns the model names.
- #models ⇒ Object
-
#modified_date ⇒ Date
Date last modified.
-
#multiple_models? ⇒ Boolean
True if drawing has more than 1 model.
-
#name ⇒ String
The name of the drawing.
-
#new_model(name, template = nil) ⇒ Object
Create a new model.
- #number ⇒ Object
-
#ole_obj ⇒ WIN32OLE
returns the internal ole_obj.
-
#path ⇒ Pathname
The complete path of file.
- #pdf_driver ⇒ Object
- #pdf_name(name = nil) ⇒ Object
- #pen_table ⇒ Object
-
#read_only? ⇒ Boolean
Is the drawing readonly?.
- #reset_tagset_instances ⇒ Object
- #revision_count ⇒ Object
-
#save ⇒ void
Save the drawing.
-
#save_as(name, overwrite: false, format: 0) ⇒ void
Save the drawing under a different name.
-
#save_as_pdf(name: nil, dir: nil) ⇒ void
save the drawing as a pdf file if the name or directory is given it uses those params.
- #save_tagsets_to_file(name) ⇒ Object
-
#scan_all(criteria, &block) ⇒ Object
scans all the drawing models with criteria calls scan_all_with_block calls scal_all_with_hash.
-
#scan_cells {|Cell| ... } ⇒ Object
scan all cells in drawing and.
-
#scan_model(criteria, model: default_model_reference) { ... } ⇒ Object
Scan the drawing.
-
#scan_tags {|Tag| ... } ⇒ Object
scan all tags in drawing and.
-
#scan_text {|String| ... } ⇒ Object
scan all text and text regions in all models.
- #scan_text_in_cells(&block) ⇒ Object
- #select_tagset_instances_by_name(name) ⇒ Object
- #tagsets_in_drawing ⇒ Object
- #tagsets_in_drawing! ⇒ Object
-
#three_d? ⇒ Boolean
True if a 3d drawing.
- #to_ole_point3d(pt) ⇒ Object
- #to_point(pt) ⇒ Object
-
#two_d? ⇒ Boolean
True if a 2d drawing.
- #update_error ⇒ Object
- #update_tagset(name, h_local = {}) ⇒ Object
- #update_tagsets(ts_arg) ⇒ Object
- #update_tagsets_from_template_structure(ts_arg) ⇒ Object
- #wait_save_event(secs, interval = 0.5) ⇒ Object
- #zoom_to_element(target, n_view) ⇒ Object
Methods included from ScanTrait
#cells_criteria, #graphics_criteria, #lines_criteria, #scan, #scan_cell_with_name, #scan_graphical, #scan_lines, #tags_criteria, #text_criteria
Methods included from TagSetTrait
#create_tagset, #create_tagset!, #find_tagset, #remove_tagset, #reset_tagsets, #tagset_names, #tagsets
Methods included from Properties
#author=, #comments=, #keywords=, #subject=, #title=
Constructor Details
#initialize(app, ole) ⇒ Drawing
Initialize drawing
29 30 31 32 33 34 35 36 |
# File 'lib/microstation/drawing.rb', line 29 def initialize(app, ole) @app = app @ole_obj = ole = false @app.register_handler('ISaveAsEvents_AfterSaveAs') do |*args| @drawing_saved = true end end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
21 22 23 |
# File 'lib/microstation/drawing.rb', line 21 def app @app end |
Instance Method Details
#active? ⇒ Boolean
Returns is the drawing active?.
47 48 49 |
# File 'lib/microstation/drawing.rb', line 47 def active? ole_obj.IsActive end |
#active_model ⇒ Object
198 199 200 201 202 |
# File 'lib/microstation/drawing.rb', line 198 def active_model return nil unless has_active_model? Model.new(app, self, app_ole_obj.ActiveModelReference) end |
#add_element(line) ⇒ Object
416 417 418 |
# File 'lib/microstation/drawing.rb', line 416 def add_element(line) active_model.add_element(line) end |
#basename ⇒ Pathname
Returns the name as Pathname.
239 240 241 |
# File 'lib/microstation/drawing.rb', line 239 def basename Pathname(name) end |
#cad_input_queue {|Microstation::CadInputQueue| ... } ⇒ Object
the block
53 54 55 |
# File 'lib/microstation/drawing.rb', line 53 def cad_input_queue(&block) @app.cad_input_queue(&block) end |
#change_model(name) ⇒ Model? Also known as: activate_model
activate the model with name param name [String] name the name of the model activate the model found and return the model
358 359 360 361 362 363 |
# File 'lib/microstation/drawing.rb', line 358 def change_model(name) model = find_model(name) return unless model model.activate end |
#change_text_suffix(reg, offset) ⇒ Object
350 351 352 |
# File 'lib/microstation/drawing.rb', line 350 def change_text_suffix(reg,offset) active_model.change_text_suffix(reg,offset) end |
#close ⇒ Object
261 262 263 264 265 |
# File 'lib/microstation/drawing.rb', line 261 def close @drawing_closed = true ole_obj.Close rescue nil @ole_obj = nil end |
#copy(name: nil, dir: nil) ⇒ Object
copy the drawing
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/microstation/drawing.rb', line 60 def copy(name: nil, dir: nil) if dir.nil? lname = name || copy_name dir_path = self.dirname else lname = name || self.name dir_path = Pathname(dir) end copy_path = dir_path + lname FileUtils.copy self.path.to_s, copy_path.to_s, verbose: true end |
#create_line(p1, p2, el = nil) ⇒ Object
593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 |
# File 'lib/microstation/drawing.rb', line 593 def create_line(p1,p2,el = nil) # el = find_line_element pt1,pt2 = [p1,p2].map{ |p| to_ole_point3d(p) } el = WIN32OLE_VARIANT::Nothing unless el el = el.ole_obj if el.respond_to? :ole_obj begin ole = app.ole_obj.CreateLineElement2(el, pt1,pt2) return nil unless ole app.wrap(ole) rescue Exception => ex puts ex. bb puts "class: #{el.class}" return nil end end |
#create_scanner(name, &block) ⇒ Object
420 421 422 |
# File 'lib/microstation/drawing.rb', line 420 def create_scanner(name,&block) app.create_scanner(name,&block) end |
#create_tagset_instance_from_tagset_hash(h) ⇒ Object
459 460 461 462 |
# File 'lib/microstation/drawing.rb', line 459 def (h) ts = [h[:name]] ts.create_instance( h[:base_element_id], h[:tags], h[:model]) end |
#create_tagset_instances(ts_name: nil, base_element_id: nil) ⇒ Object
441 442 443 444 445 446 447 448 |
# File 'lib/microstation/drawing.rb', line 441 def (ts_name: nil, base_element_id: nil) result = [] = true (ts_name: ts_name, base_element_id: base_element_id) do |h| result << (h) end result end |
#create_tagset_instances_bak ⇒ Object
used
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
# File 'lib/microstation/drawing.rb', line 425 def () result = [] = true filtered = if block_given? .select(&filter) else end binding.pry filtered.map do |h| element_id = h[:base_element_id] result << .create_instance(element_id, h[:tags], h[model]) end result end |
#default_model_reference ⇒ Model
Returns the ole.DefaultModelReference.
194 195 196 |
# File 'lib/microstation/drawing.rb', line 194 def default_model_reference Model.new(app, self, ole_obj.DefaultModelReference) end |
#dimensions ⇒ Object
alias_method :keywords , :keywords=x
215 216 217 |
# File 'lib/microstation/drawing.rb', line 215 def dimensions eval_cexpression("tcb->ndices") end |
#dirname ⇒ Pathname
Returns the directory of the file.
244 245 246 |
# File 'lib/microstation/drawing.rb', line 244 def dirname Pathname(ole_obj.Path). end |
#drawing_closed? ⇒ Boolean
267 268 269 |
# File 'lib/microstation/drawing.rb', line 267 def drawing_closed? @drawing_closed end |
#each_model {|Model| ... } ⇒ Object
iterate through each model in the drawing and yield them
287 288 289 290 291 292 293 294 295 296 297 298 |
# File 'lib/microstation/drawing.rb', line 287 def each_model result = [] ole_obj.Models.each do |el| model = model_from_ole(el) if block_given? yield model else result << model end end result unless block_given? end |
#eval_cexpression(string) ⇒ Object
257 258 259 |
# File 'lib/microstation/drawing.rb', line 257 def eval_cexpression(string) app.eval_cexpression(string) end |
#find_by_id(id) ⇒ Object
Iterates through all the models and finds the ole_el with id
383 384 385 386 387 388 389 |
# File 'lib/microstation/drawing.rb', line 383 def find_by_id(id) models.each do |model| el = model.find_by_id(id) return el if el end nil end |
#find_line_element ⇒ Object
581 582 583 584 585 586 587 |
# File 'lib/microstation/drawing.rb', line 581 def find_line_element line = nil self.scan_lines do |el| line = el if el.microstation_type == MSD::MsdElementTypeLine end line end |
#find_model(name) ⇒ Model?
Find the model in the drawing
320 321 322 323 324 325 326 |
# File 'lib/microstation/drawing.rb', line 320 def find_model(name) ole = ole_obj.Models(name) model_from_ole(ole) rescue puts "model #{name} not found" nil end |
#find_tagset_instance_by_name(name) ⇒ Object
483 484 485 |
# File 'lib/microstation/drawing.rb', line 483 def (name) (ts_name: name).first end |
#find_tagset_instance_by_name_and_id(name, id) ⇒ Object
487 488 489 |
# File 'lib/microstation/drawing.rb', line 487 def (name,id) (ts_name: name, base_element_id: id).first end |
#find_tagset_instance_from_hash(ti_array, h_local) ⇒ Object
529 530 531 532 533 534 535 536 537 |
# File 'lib/microstation/drawing.rb', line 529 def (ti_array, h_local) id = h_local.fetch('microstation_id', :not_found) if id == :not_found || id.nil? name = ti_array.first.name raise MultipleUpdateError, "found #{ti_array.size} instances for tagset #{name}; Need a microstation_id for hash" end ts = ti_array.find{|ti| ti.microstation_id == id} end |
#find_tagset_instances_called? ⇒ Boolean
38 39 40 |
# File 'lib/microstation/drawing.rb', line 38 def end |
#find_tagsets ⇒ Object
491 492 493 494 495 496 497 498 499 500 501 502 503 504 |
# File 'lib/microstation/drawing.rb', line 491 def results = [] each_model do |m| m..each do |ts| if block_given? yield ts else results << ts end end end return results unless block_given? end |
#get_matching_text(re, &block) ⇒ Object
346 347 348 |
# File 'lib/microstation/drawing.rb', line 346 def get_matching_text(re,&block) active_model.get_matching_text(re,&block) end |
#get_selected_elements ⇒ Object
337 338 339 340 |
# File 'lib/microstation/drawing.rb', line 337 def get_selected_elements return [] unless has_active_model? active_model.get_selected_elements end |
#get_selected_text ⇒ Object
342 343 344 |
# File 'lib/microstation/drawing.rb', line 342 def get_selected_text active_model.get_selected_text end |
#get_tagsets_in_drawing_hash(ts_name: nil, base_element_id: nil) ⇒ Object
used
470 471 472 473 474 475 476 477 |
# File 'lib/microstation/drawing.rb', line 470 def (ts_name: nil, base_element_id: nil) return to_enum(__callee__, ts_name: ts_name, base_element_id: base_element_id) unless block_given? each_model do |m| m.(ts_name: ts_name, base_element_id: base_element_id) do |tsi| yield tsi end end end |
#get_text(&block) ⇒ Object
156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/microstation/drawing.rb', line 156 def get_text(&block) result = [] scan_text do |te| if block_given? yield te.to_s else result << te.to_s end end result end |
#has_active_model? ⇒ Boolean
Returns true if drawing has an active model.
205 206 207 |
# File 'lib/microstation/drawing.rb', line 205 def has_active_model? app_ole_obj.HasActiveModelReference end |
#model_names ⇒ Array<String>
Returns the model names
371 372 373 374 375 376 377 |
# File 'lib/microstation/drawing.rb', line 371 def model_names result = [] ole_obj.Models.each do |el| result << el.name end result end |
#models ⇒ Object
333 334 335 |
# File 'lib/microstation/drawing.rb', line 333 def models @models ||= each_model end |
#modified_date ⇒ Date
Returns date last modified.
210 211 212 |
# File 'lib/microstation/drawing.rb', line 210 def modified_date ole_obj.DateLastSaved end |
#multiple_models? ⇒ Boolean
Returns true if drawing has more than 1 model.
329 330 331 |
# File 'lib/microstation/drawing.rb', line 329 def multiple_models? ole_obj.Models.Count > 1 end |
#name ⇒ String
Returns the name of the drawing.
234 235 236 |
# File 'lib/microstation/drawing.rb', line 234 def name ole_obj.Name end |
#new_model(name, template = nil) ⇒ Object
Create a new model
303 304 305 306 307 308 |
# File 'lib/microstation/drawing.rb', line 303 def new_model(name,template = nil) template_ole = template ? template.ole_obj : app.ole_obj.ActiveDesignFile.DefaultModelReference el = app.ole_obj.ActiveDesignFile.Models.Add(template_ole,name,"Added ") m = model_from_ole(el).activate m end |
#number ⇒ Object
16 17 18 19 |
# File 'lib/microstation/extensions/faa.rb', line 16 def number binding.pry Drawing::Number.from_string(self.basename) end |
#ole_obj ⇒ WIN32OLE
returns the internal ole_obj
566 567 568 569 570 571 572 573 574 575 576 577 578 579 |
# File 'lib/microstation/drawing.rb', line 566 def ole_obj is_ok = true begin @ole_obj.Name rescue StandardError => e is_ok = false end unless is_ok || drawing_closed? binding.pry end @ole_obj end |
#path ⇒ Pathname
Returns the complete path of file.
249 250 251 |
# File 'lib/microstation/drawing.rb', line 249 def path dirname + basename end |
#pdf_driver ⇒ Object
276 277 278 |
# File 'lib/microstation/drawing.rb', line 276 def pdf_driver app.windows_path( (::Microstation.plot_driver_directory + "pdf-bw.plt").to_s) end |
#pdf_name(name = nil) ⇒ Object
271 272 273 274 |
# File 'lib/microstation/drawing.rb', line 271 def pdf_name(name = nil) name = self.name unless name return Pathname(name).sub_ext(".pdf") end |
#pen_table ⇒ Object
280 281 282 |
# File 'lib/microstation/drawing.rb', line 280 def pen_table app.windows_path( (::Microstation.plot_driver_directory + 'wmbw.tbl')) end |
#read_only? ⇒ Boolean
Returns is the drawing readonly?.
121 122 123 |
# File 'lib/microstation/drawing.rb', line 121 def read_only? active_model_reference.IsReadOnly end |
#reset_tagset_instances ⇒ Object
42 43 44 |
# File 'lib/microstation/drawing.rb', line 42 def = false end |
#revision_count ⇒ Object
253 254 255 |
# File 'lib/microstation/drawing.rb', line 253 def revision_count ole_obj.DesignRevisionCount end |
#save ⇒ void
This method returns an undefined value.
Save the drawing
412 413 414 |
# File 'lib/microstation/drawing.rb', line 412 def save ole_obj.Save end |
#save_as(name, overwrite: false, format: 0) ⇒ void
This method returns an undefined value.
Save the drawing under a different name
98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/microstation/drawing.rb', line 98 def save_as(name, overwrite: false, format: 0) @drawing_saved = false path = Pathname(name). wpath = app.windows_path(name) begin ole_obj.SaveAs(wpath, overwrite, format) wait_save_event(10) raise "drawing not saved in 10 seconds" unless @drawing_saved rescue => e binding.pry end end |
#save_as_pdf(name: nil, dir: nil) ⇒ void
This method returns an undefined value.
save the drawing as a pdf file if the name or directory is given it uses those params. If not it uses the drawing name and the drawing directory
79 80 81 82 83 84 85 86 87 |
# File 'lib/microstation/drawing.rb', line 79 def save_as_pdf(name: nil, dir: nil) out_name = pdf_path(name: name, dir: dir) windows_name = app.windows_path(out_name) loop do print_pdf(windows_name) break if out_name.file? end puts "saved #{windows_name}" end |
#save_tagsets_to_file(name) ⇒ Object
464 465 466 467 |
# File 'lib/microstation/drawing.rb', line 464 def (name) require 'json' ::File.open(name, 'w'){ |f| f.write .to_a.to_json } end |
#scan_all(criteria, &block) ⇒ Object
scans all the drawing models with criteria calls scan_all_with_block calls scal_all_with_hash
142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/microstation/drawing.rb', line 142 def scan_all(criteria,&block) return to_enum(__callee__, criteria) unless block_given? each_model do |m| m.scan_model(criteria) do |r| if block_given? yield r else result << r end end end end |
#scan_cells {|Cell| ... } ⇒ Object
scan all cells in drawing and
183 184 185 |
# File 'lib/microstation/drawing.rb', line 183 def scan_cells(&block) scan_all(cells_criteria, &block) end |
#scan_model(criteria, model: default_model_reference) { ... } ⇒ Object
Scan the drawing. It takes a criteria and an optional model scan the drawing
131 132 133 134 135 |
# File 'lib/microstation/drawing.rb', line 131 def scan_model(criteria, model: default_model_reference, &block) criteria = criteria || create_scan_criteria model = model || default_model_reference model.scan_model(criteria, &block) end |
#scan_tags {|Tag| ... } ⇒ Object
scan all tags in drawing and
177 178 179 |
# File 'lib/microstation/drawing.rb', line 177 def (&block) scan_all(, &block) end |
#scan_text {|String| ... } ⇒ Object
scan all text and text regions in all models
171 172 173 |
# File 'lib/microstation/drawing.rb', line 171 def scan_text(&block) scan_all(text_criteria, &block) end |
#scan_text_in_cells(&block) ⇒ Object
187 188 189 190 191 |
# File 'lib/microstation/drawing.rb', line 187 def scan_text_in_cells(&block) scan_cells do |c| c.text_elements(&block) end end |
#select_tagset_instances_by_name(name) ⇒ Object
479 480 481 |
# File 'lib/microstation/drawing.rb', line 479 def (name) (ts_name: name) end |
#tagsets_in_drawing ⇒ Object
450 451 452 |
# File 'lib/microstation/drawing.rb', line 450 def ||= end |
#tagsets_in_drawing! ⇒ Object
454 455 456 457 |
# File 'lib/microstation/drawing.rb', line 454 def = nil end |
#three_d? ⇒ Boolean
Returns true if a 3d drawing.
229 230 231 |
# File 'lib/microstation/drawing.rb', line 229 def three_d? dimensions == 3 end |
#to_ole_point3d(pt) ⇒ Object
589 590 591 |
# File 'lib/microstation/drawing.rb', line 589 def to_ole_point3d(pt) app.to_ole_point3d(pt) end |
#to_point(pt) ⇒ Object
610 611 612 |
# File 'lib/microstation/drawing.rb', line 610 def to_point(pt) app.to_point(pt) end |
#two_d? ⇒ Boolean
Returns true if a 2d drawing.
224 225 226 |
# File 'lib/microstation/drawing.rb', line 224 def two_d? dimensions == 2 end |
#update_error ⇒ Object
548 549 550 |
# File 'lib/microstation/drawing.rb', line 548 def update_error raise ArgumentError, 'Argument must be an array of hashes' end |
#update_tagset(name, h_local = {}) ⇒ Object
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
# File 'lib/microstation/drawing.rb', line 506 def (name,h_local={}) tset_instances = (name) case tset_instances.size when 0 raise 'no tagset found' when 1 ts = tset_instances.first ts.update(h_local) else if (h_local.class == Array && h_local.all?{|l| l.class == Hash}) h_local.each do |update_hash| ts = (tset_instances, update_hash) ts.update(update_hash) end elsif h_local.class == Hash ts = (tset_instances, h_local) ts.update(h_local) else raise ArgumentError, "don't know how to update tagset" end end end |
#update_tagsets(ts_arg) ⇒ Object
539 540 541 542 543 544 545 546 |
# File 'lib/microstation/drawing.rb', line 539 def (ts_arg) return if ts_arg == [] return if ts_arg == {} ts_array = [ts_arg] if ts_arg.class == Hash ts_array.each do |hash_pair| (hash_pair.keys[0], hash_pair.values[0]) end end |
#update_tagsets_from_template_structure(ts_arg) ⇒ Object
552 553 554 555 556 557 558 559 |
# File 'lib/microstation/drawing.rb', line 552 def (ts_arg) ts_arg.each do |h| inst_array = h['instances'] inst_array.each do |ts_hash| (ts_hash['tagset_name'], ts_hash['attributes']) end end end |
#wait_save_event(secs, interval = 0.5) ⇒ Object
111 112 113 114 115 116 117 118 |
# File 'lib/microstation/drawing.rb', line 111 def wait_save_event(secs, interval = 0.5) elapsed = 0 while (!@drawing_saved && elapsed <= 5) elapsed += interval sleep(interval) WIN32OLE_EVENT. end end |
#zoom_to_element(target, n_view) ⇒ Object
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
# File 'lib/microstation/drawing.rb', line 391 def zoom_to_element(target, n_view) return nil unless target.graphical? zoom = 4 range = target.Range oview = app_ole_obj.ActiveDesignFile.Views.Item(n_view) range_diff = app_ole_obj.Point3dSubtract(range.High, range.Low) extent = app_ole_obj.Point3dScale(range_diff, zoom) oview_origin = app_ole_obj.Point3dSubtract(range.Low, app_ole_obj.Point3dScale(extent,0.5)) oview.Origin = oview_origin oview.Extents = extent oview.Redraw target.IsHighlighted = true end |