こちらは無精をせずに、ブラウザを開いてプラグイン numbの構文をペーストしたものです。
たしかにプラグインの効果が発揮されました。
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# Name : Numb 1.1 # Description : add consecutive numbers on click # Author : TBD # Usage : select from the menu, left click to add text, # enter in VCB the start number, right click to change increment # Date : 01.Jul.2oo4 # Type : tool # History: 1.1 (02.Jul.2oo4) - added support for right click (change increment) # 1.o (12.Jun.2oo4) - first version class Numb # initialize on tool activation def activate @ip = Sketchup::InputPoint.new @iptemp = Sketchup::InputPoint.new @displayed = false @number = 1 @increment = 1 end # on MouseMove display InputPoint and update VCB def onMouseMove(flags, x, y, view) # show VCB and status info Sketchup::set_status_text("Numb::Click to insert text", SB_PROMPT) Sketchup::set_status_text("Number", SB_VCB_LABEL) Sketchup::set_status_text("#{@number}", SB_VCB_VALUE) # get position in the model @iptemp.pick view, x, y if( @iptemp.valid? ) changed = @iptemp != @ip @ip.copy! @iptemp @pos = @ip.position; # view update? if( changed and (@ip.display? or @displayed) ) view.invalidate end end end # on left click add text def onLButtonDown(flags, x, y, view) # add text Sketchup.active_model.entities.add_text(@number.to_s, @pos) @number = @number + @increment end # on right click add text def onRButtonDown(flags, x, y, view) # display input dialog (inputbox needs array) result = inputbox ["Increment value"],[@increment] return if not result @increment = result[0] end # on user text in VCB modify number to be displayed def onUserText(text,view) begin value = text.to_i rescue # Error parsing the text UI.beep value = nil Sketchup::set_status_text "", SB_VCB_VALUE end return if !value @number = value end # update the view def draw(view) if( @ip.valid? && @ip.display? ) @ip.draw view @displayed = true else @displayed = false end end end # class Numb #---------------------------------------------------------------------------- # add menu items if( not $numb_menu_loaded ) add_separator_to_menu("Tools") UI.menu("Tools").add_item("[TBD] Numb") { Sketchup.active_model.select_tool Numb.new } $numb_menu_loaded = true end |
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー