├── .gitignore ├── .yardopts ├── Constants.md ├── RenderingOptions.md ├── Yard API.html ├── generated ├── method-list-13.0.4812.txt ├── method-list-14.1.1282.txt ├── method-list-15.1.106.txt ├── method-list-15.2.560.txt ├── method-list-15.2.685.txt ├── method-list-7.1.6860.txt ├── method-list-8.0.16846.txt └── readme.md ├── lib ├── animation.rb ├── appobserver.rb ├── arccurve.rb ├── array.rb ├── attributedictionaries.rb ├── attributedictionary.rb ├── axes.rb ├── behavior.rb ├── boundingbox.rb ├── camera.rb ├── classifications.rb ├── classificationschema.rb ├── color.rb ├── command.rb ├── comparable.rb ├── componentdefinition.rb ├── componentinstance.rb ├── console.rb ├── constants.rb ├── constructionline.rb ├── constructionpoint.rb ├── curve.rb ├── definitionlist.rb ├── definitionobserver.rb ├── definitionsobserver.rb ├── dimension.rb ├── dimension_linear.rb ├── dimension_observer.rb ├── dimension_radial.rb ├── drawingelement.rb ├── edge.rb ├── edgeuse.rb ├── entities.rb ├── entitiesobserver.rb ├── entity.rb ├── entityobserver.rb ├── extensionlicense.rb ├── extensionsmanager.rb ├── face.rb ├── framechangeobserver.rb ├── geom.rb ├── group.rb ├── hlr.rb ├── image.rb ├── importer.rb ├── inputpoint.rb ├── instanceobserver.rb ├── language_handler.rb ├── latlong.rb ├── layer.rb ├── layers.rb ├── layersobserver.rb ├── length.rb ├── licensing.rb ├── loadhandler.rb ├── loop.rb ├── material.rb ├── materials.rb ├── materialsobserver.rb ├── menu.rb ├── model.rb ├── modelobserver.rb ├── numeric.rb ├── object.rb ├── optionsmanager.rb ├── optionsprovider.rb ├── optionsproviderobserver.rb ├── page.rb ├── pages.rb ├── pagesobserver.rb ├── pickhelper.rb ├── point3d.rb ├── polygonmesh.rb ├── renderingoptions.rb ├── renderingoptionsobserver.rb ├── sectionplane.rb ├── selection.rb ├── selectionobserver.rb ├── set.rb ├── shadow_info.rb ├── shadowinfoobserver.rb ├── sketchup.rb ├── sketchupextension.rb ├── sksocket.rb ├── string.rb ├── style.rb ├── styles.rb ├── text.rb ├── texture.rb ├── texturewriter.rb ├── tool.rb ├── toolbar.rb ├── tools.rb ├── toolsobserver.rb ├── transformation.rb ├── ui.rb ├── utm.rb ├── uvhelper.rb ├── vector3d.rb ├── vertex.rb ├── view.rb ├── viewobserver.rb └── webdialog.rb └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | doc 2 | .yardoc 3 | *.dot 4 | mockup.rb 5 | mockup_test.rb 6 | SketchUp-Ruby-Info.json 7 | -------------------------------------------------------------------------------- /.yardopts: -------------------------------------------------------------------------------- 1 | --charset UTF-8 2 | --markup markdown 3 | --title "SketchUp Ruby API Documentation - Community Edition" 4 | --readme README 5 | --no-private 6 | - 7 | lib/**/* 8 | RenderingOptions.md 9 | Constants.md 10 | -------------------------------------------------------------------------------- /Constants.md: -------------------------------------------------------------------------------- 1 | `Object.constants.sort.join("\n") ` 2 | 3 | Geometry 4 | 5 | ORIGIN Point3d(0, 0, 0) 6 | X_AXIS Vector3d(1, 0, 0) 7 | Y_AXIS Vector3d(0, 1, 0) 8 | Z_AXIS Vector3d(0, 0, 1) 9 | 10 | StatusBar Locations 11 | 12 | SB_PROMPT 13 | SB_VCB_LABEL 14 | SB_VCB_VALUE 15 | 16 | Messagebox Types 17 | 18 | MB_ABORTRETRYIGNORE 19 | MB_MULTILINE 20 | MB_OK 21 | MB_OKCANCEL 22 | MB_RETRYCANCEL 23 | MB_YESNO 24 | MB_YESNOCANCEL 25 | 26 | Messagebox Return Values 27 | 28 | IDABORT 29 | IDCANCEL 30 | IDENTITY 31 | IDIGNORE 32 | IDNO 33 | IDOK 34 | IDRETRY 35 | IDYES 36 | 37 | Toolbar 38 | 39 | TB_HIDDEN 40 | TB_NEVER_SHOWN 41 | TB_VISIBLE 42 | 43 | Yet Unfiled 44 | 45 | ALT_MODIFIER_KEY 46 | ALT_MODIFIER_MASK 47 | 48 | ALeaderModel 49 | ALeaderNone 50 | ALeaderView 51 | ARGF 52 | ARGV 53 | AddDetailTool 54 | 55 | CMD_ARC 56 | CMD_CAMERA_UNDO 57 | CMD_CIRCLE 58 | CMD_COPY 59 | CMD_CUT 60 | CMD_DELETE 61 | CMD_DIMENSION 62 | CMD_DISPLAY_FOV 63 | CMD_DOLLY 64 | CMD_DRAWCUTS 65 | CMD_DRAWOUTLINES 66 | CMD_ERASE 67 | CMD_EXTRUDE 68 | CMD_FREEHAND 69 | CMD_HIDDENLINE 70 | CMD_LINE 71 | CMD_MAKE_COMPONENT 72 | CMD_MEASURE 73 | CMD_MOVE 74 | CMD_NEW 75 | CMD_OFFSET 76 | CMD_OPEN 77 | CMD_ORBIT 78 | CMD_PAGE_DELETE 79 | CMD_PAGE_NEW 80 | CMD_PAGE_NEXT 81 | CMD_PAGE_PREVIOUS 82 | CMD_PAGE_UPDATE 83 | CMD_PAINT 84 | CMD_PAN 85 | CMD_PASTE 86 | CMD_POLYGON 87 | CMD_POSITION_CAMERA 88 | CMD_PRINT 89 | CMD_PROTRACTOR 90 | CMD_PUSHPULL 91 | CMD_RECTANGLE 92 | CMD_REDO 93 | CMD_ROTATE 94 | CMD_RUBY_CONSOLE 95 | CMD_SAVE 96 | CMD_SCALE 97 | CMD_SECTION 98 | CMD_SELECT 99 | CMD_SELECTION_ZOOM_EXT 100 | CMD_SHADED 101 | CMD_SHOWGUIDES 102 | CMD_SHOWHIDDEN 103 | CMD_SKETCHAXES 104 | CMD_SKETCHCS 105 | CMD_TEXT 106 | CMD_TEXTURED 107 | CMD_TRANSPARENT 108 | CMD_UNDO 109 | CMD_VIEW_BACK 110 | CMD_VIEW_BOTTOM 111 | CMD_VIEW_FRONT 112 | CMD_VIEW_ISO 113 | CMD_VIEW_LEFT 114 | CMD_VIEW_PERSPECTIVE 115 | CMD_VIEW_RIGHT 116 | CMD_VIEW_TOP 117 | CMD_WALK 118 | CMD_WIREFRAME 119 | CMD_ZOOM 120 | CMD_ZOOM_EXTENTS 121 | CMD_ZOOM_WINDOW 122 | 123 | CONSTRAIN_MODIFIER_KEY 124 | CONSTRAIN_MODIFIER_MASK 125 | COPY_MODIFIER_KEY 126 | COPY_MODIFIER_MASK 127 | 128 | CameraAppObserver 129 | CameraEntityObserver 130 | CameraFrameChangeObserver 131 | CameraRep 132 | CameraToolModelObserver 133 | CameraToolPagesObserver 134 | CameraToolViewObserver 135 | Class 136 | Comparable 137 | Continuation 138 | DCConverter 139 | DCDownloader 140 | DCFunctionsV1 141 | DCInteractTool 142 | DCObservers 143 | DCProgressBar 144 | Data 145 | DefaultManager 146 | DimensionArrowClosed 147 | DimensionArrowDot 148 | DimensionArrowNone 149 | DimensionArrowOpen 150 | DimensionArrowSlash 151 | Dir 152 | DrapeEdges 153 | DrapeTool 154 | DynamicComponentsV1 155 | ENV 156 | EOFError 157 | Enumerable 158 | Errno 159 | Exception 160 | FALSE 161 | FILE_WRITE_FAILED_INVALID_TYPE 162 | FILE_WRITE_FAILED_UNKNOWN 163 | FILE_WRITE_OK 164 | FSCameraData 165 | FSGeomUtils 166 | FSValidate 167 | FalseClass 168 | File 169 | FileTest 170 | FilmCameraTool 171 | Fixnum 172 | FlipEdgeTool 173 | Float 174 | FloatDomainError 175 | FootprintFinder 176 | FromContoursTool 177 | FromScratchTool 178 | GC 179 | 180 | GL_LINES 181 | GL_LINE_LOOP 182 | GL_LINE_STRIP 183 | GL_POINTS 184 | GL_POLYGON 185 | GL_QUADS 186 | GL_QUAD_STRIP 187 | GL_TRIANGLES 188 | GL_TRIANGLE_FAN 189 | GL_TRIANGLE_STRIP 190 | 191 | Geom 192 | Hash 193 | 194 | IO 195 | IOError 196 | IndexError 197 | Integer 198 | Interrupt 199 | Kernel 200 | 201 | LAYER_HIDDEN_BY_DEFAULT 202 | LAYER_IS_HIDDEN_ON_NEW_PAGES 203 | LAYER_IS_VISIBLE_ON_NEW_PAGES 204 | LAYER_USES_DEFAULT_VISIBILITY_ON_NEW_PAGES 205 | LAYER_VISIBLE_BY_DEFAULT 206 | 207 | LanguageHandler 208 | Length 209 | LoadError 210 | LocalJumpError 211 | 212 | MF_CHECKED 213 | MF_DISABLED 214 | MF_ENABLED 215 | MF_GRAYED 216 | MF_UNCHECKED 217 | 218 | MK_ALT 219 | MK_COMMAND 220 | MK_CONTROL 221 | MK_LBUTTON 222 | MK_MBUTTON 223 | MK_RBUTTON 224 | MK_SHIFT 225 | 226 | Marshal 227 | MatchData 228 | MatchingData 229 | Math 230 | Method 231 | Module 232 | NIL 233 | NameError 234 | NilClass 235 | NoMemoryError 236 | NoMethodError 237 | NotImplementedError 238 | Numeric 239 | Object 240 | ObjectSpace 241 | 242 | PAGE_NO_CAMERA 243 | PAGE_USE_ALL 244 | PAGE_USE_CAMERA 245 | PAGE_USE_HIDDEN 246 | PAGE_USE_LAYER_VISIBILITY 247 | PAGE_USE_RENDERING_OPTIONS 248 | PAGE_USE_SECTION_PLANES 249 | PAGE_USE_SHADOWINFO 250 | PAGE_USE_SKETCHCS 251 | 252 | PLATFORM 253 | PageNameChangeObserver 254 | Precision 255 | Proc 256 | Process 257 | RELEASE_DATE 258 | RUBY_PATCHLEVEL 259 | RUBY_PLATFORM 260 | RUBY_RELEASE_DATE 261 | RUBY_VERSION 262 | Range 263 | RangeError 264 | Regexp 265 | RegexpError 266 | RuntimeError 267 | 268 | SKETCHUP_CONSOLE 269 | SKSocket 270 | STDERR 271 | STDIN 272 | STDOUT 273 | ScriptError 274 | SecurityError 275 | Set 276 | Signal 277 | SignalException 278 | Sketchup 279 | SketchupExtension 280 | SmooveTool 281 | SnapTo_Arbitrary 282 | SnapTo_Horizontal 283 | SnapTo_Sloped 284 | SnapTo_Vertical 285 | StampTool 286 | StandardError 287 | String 288 | Struct 289 | Symbol 290 | SyntaxError 291 | SystemCallError 292 | SystemExit 293 | SystemStackError 294 | 295 | 296 | TOPLEVEL_BINDING 297 | TRUE 298 | Terrain 299 | Test 300 | 301 | TextAlignCenter 302 | TextAlignLeft 303 | TextAlignRight 304 | 305 | Thread 306 | ThreadError 307 | ThreadGroup 308 | Time 309 | TrueClass 310 | TypeError 311 | UI 312 | UnboundMethod 313 | VERSION 314 | 315 | VK_ALT 316 | VK_COMMAND 317 | VK_CONTROL 318 | VK_DELETE 319 | VK_DOWN 320 | VK_END 321 | VK_HOME 322 | VK_INSERT 323 | VK_LEFT 324 | VK_MENU 325 | VK_NEXT 326 | VK_PRIOR 327 | VK_RIGHT 328 | VK_SHIFT 329 | VK_SPACE 330 | VK_UP 331 | 332 | WebTextures 333 | ZeroDivisionError 334 | 335 | ArgumentError 336 | Array 337 | Bignum 338 | Binding 339 | -------------------------------------------------------------------------------- /RenderingOptions.md: -------------------------------------------------------------------------------- 1 | # RenderingOptions # 2 | 3 | ## List of RendingOptions keys ## 4 | 5 | - BackgroundColor 6 | - BandColor 7 | - ConstructionColor 8 | - DepthQueWidth 9 | - DisplayColorByLayer 10 | - DisplayDims 11 | - DisplayFog 12 | - DisplayInstanceAxes 13 | - DisplaySectionCuts 14 | - DisplaySectionPlanes 15 | - DisplaySketchAxes 16 | - DisplayText 17 | - DisplayWatermarks 18 | - DrawBackEdges 19 | - DrawDepthQue 20 | - DrawGround 21 | - DrawHidden 22 | - DrawHorizon 23 | - DrawLineEnds 24 | - DrawProfilesOnly 25 | - DrawSilhouettes 26 | - DrawUnderground 27 | - EdgeColorMode 28 | - EdgeDisplayMode 29 | - EdgeType 30 | - ExtendLines 31 | - FaceBackColor 32 | - FaceColorMode 33 | - FaceFrontColor 34 | - FogColor 35 | - FogEndDist 36 | - FogStartDist 37 | - FogUseBkColor 38 | - ForegroundColor 39 | - GroundColor 40 | - GroundTransparency 41 | - HideConstructionGeometry 42 | - HighlightColor 43 | - HorizonColor 44 | - InactiveFade 45 | - InactiveHidden 46 | - InstanceFade 47 | - InstanceHidden 48 | - JitterEdges 49 | - LineEndWidth 50 | - LineExtension 51 | - LockedColor 52 | - MaterialTransparency 53 | - ModelTransparency 54 | - RenderMode 55 | - SectionActiveColor 56 | - SectionCutDrawEdges 57 | - SectionCutWidth 58 | - SectionDefaultCutColor 59 | - SectionInactiveColor 60 | - ShowViewName 61 | - SilhouetteWidth 62 | - SkyColor 63 | - Texture 64 | - TransparencySort 65 | - InactiveFade 66 | - InactiveHidden 67 | - InstanceFade 68 | - InstanceHidden 69 | - JitterEdges 70 | - LineEndWidth 71 | - LineExtension 72 | - LockedColor 73 | - MaterialTransparency 74 | - ModelTransparency 75 | - RenderMode 76 | - SectionActiveColor 77 | - SectionCutWidth 78 | - SectionDefaultCutColor 79 | - SectionInactiveColor 80 | - ShowViewName 81 | - SilhouetteWidth 82 | - SkyColor 83 | - Texture 84 | - TransparencySort 85 | 86 | -------------------------------------------------------------------------------- /generated/readme.md: -------------------------------------------------------------------------------- 1 | These files are automatically generated from scripts in my Plugins folder. 2 | 3 | Modifications will be over-written. 4 | 5 | These method lists should be generated with all SketchupExtensions disabled. 6 | -------------------------------------------------------------------------------- /lib/animation.rb: -------------------------------------------------------------------------------- 1 | # The Animation interface is implemented to create animations inside SketchUp. 2 | # At any given time, a single animation can be active on a View. To make your 3 | # own, build a Ruby class that contains the methods described below. 4 | # 5 | # Animation objects are activated by using the animation= method on a 6 | # View object. To stop an animation set the view's animation object to nil, like 7 | # so: 8 | # Sketchup.active_model.active_view.animation = nil 9 | # 10 | # @abstract 11 | # 12 | # @example 13 | # # This is an example of a simple animation that floats the camera up to 14 | # # a z position of 200". The only required method for an animation is 15 | # # nextFrame. It is called whenever you need to show the next frame of 16 | # # the animation. If nextFrame returns false, the animation will stop. 17 | # class FloatUpAnimation 18 | # def nextFrame(view) 19 | # new_eye = view.camera.eye 20 | # new_eye.z = new_eye.z + 1.0 21 | # view.camera.set(new_eye, view.camera.target, view.camera.up) 22 | # view.show_frame 23 | # return new_eye.z < 500.0 24 | # end 25 | # end 26 | # 27 | # # This adds an item to the Camera menu to activate our custom animation. 28 | # UI.menu("Camera").add_item("Run Float Up Animation") { 29 | # Sketchup.active_model.active_view.animation = FloatUpAnimation.new 30 | # } 31 | # 32 | # @see http://www.sketchup.com/intl/en/developer/docs/ourdoc/animation Animation Docs 33 | # 34 | # @since SketchUp 6.0 35 | class Animation 36 | 37 | # Invoked by SketchUp to tell the animation to display its next frame. This 38 | # method should set up the camera and then call the show_frame method on 39 | # the View object. 40 | # 41 | # @example 42 | # def nextFrame(view) 43 | # # Insert your handler code for updating the camera or other entities. 44 | # view.show_frame 45 | # return true 46 | # end 47 | # 48 | # @param [Sketchup::View] view The view for the animation. 49 | # 50 | # @return [Boolean] +true+ if you want the animation to continue on to the 51 | # next frame or +false+ if you want the animation to stop after this frame. 52 | def nextFrame(view) 53 | end 54 | 55 | # Invoked by SketchUp when the animation is paused. 56 | # 57 | # This method is optional (you do not need to implement this method unless you 58 | # want to perform some specialized function when the animation is paused). You 59 | # cannot call this method in your code explicitly and expect an animation to 60 | # pause, only certain SketchUp events cause the method to be called. 61 | # 62 | # @note The user interface for pausing and resuming animations isn't 63 | # integrated with the Ruby API in the current version, so this method is 64 | # probably not useful to you. 65 | # 66 | # @example 67 | # def pause 68 | # # Insert handler code for whatever you need to do when it is paused. 69 | # end 70 | # 71 | # @return [void] 72 | def pause 73 | end 74 | 75 | # Invoked by SketchUp when the animation is resumed after being paused. 76 | # 77 | # This method is optional (you do not need to implement this method unless you 78 | # want to perform some specialized function when the animation is resumed). 79 | # You cannot call this method in your code explicitly and expect an animation 80 | # to stop, only certain SketchUp events cause the method to be called. 81 | # 82 | # @note The user interface for pausing and resuming animations isn't 83 | # integrated with the Ruby API in the current version, so this method is 84 | # probably not useful to you. 85 | # 86 | # @example 87 | # def resume 88 | # # Insert your handler code for whatever you need to do as you resume. 89 | # end 90 | # 91 | # @return [void] 92 | def resume 93 | end 94 | 95 | # Invoked by SketchUp when the animation is stopped. 96 | # 97 | # This method is optional (you do not need to implement this method unless you 98 | # want to perform some specialized function when the animation is stopped). 99 | # You cannot call this method in your code explicitly and expect an animation 100 | # to stop, only certain SketchUp events cause the method to be called. 101 | # 102 | # Perhaps the most common way for this method to be called is when your Ruby 103 | # code sets the view.animation to nil. 104 | # 105 | # @example 106 | # def stop 107 | # # Insert your handler code for cleaning up after your animation. 108 | # end 109 | # 110 | # @return [void] 111 | def stop 112 | end 113 | 114 | end # class Animation 115 | -------------------------------------------------------------------------------- /lib/appobserver.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | # This observer interface is implemented to react to application events. This 4 | # interface is often used to attach other observers to models as they are 5 | # opened or started. This ensures that your observers are watching all open 6 | # models. 7 | # 8 | # For example, when one attaches a SelectionObserver, it is only attached to 9 | # the Selection collection of a given model. If a 2nd model is opened, the new 10 | # model's selection changes will not fire selection callbacks unless you've 11 | # attached a {SelectionObserver} to the new model as well. By watching for 12 | # {#onNewModel}, you can be sure to do so. 13 | # 14 | # To implement this observer, create a Ruby class of this type, override the 15 | # desired methods, and add an instance of the observer to the application 16 | # class. 17 | # 18 | # @example 19 | # # This is an example of an observer that watches the application for 20 | # # new models and shows a messagebox. 21 | # class MyAppObserver < Sketchup::AppObserver 22 | # def onNewModel(model) 23 | # puts "onNewModel: " + model.to_s 24 | # 25 | # # Here is where one might attach other observers to the new model. 26 | # model.selection.add_observer(MySelectionObserver.new) 27 | # end 28 | # end 29 | # 30 | # # Attach the observer 31 | # Sketchup.add_observer(MyAppObserver.new) 32 | # 33 | # @see http://www.sketchup.com/intl/en/developer/docs/ourdoc/appobserver AppObserver Docs 34 | # 35 | # @since SketchUp 6.0 36 | class AppObserver 37 | 38 | # Called to determine if the observer expects to receive {#onNewModel} and 39 | # {#onOpenModel} calls for the models that are created or opened at SketchUp 40 | # startup. This includes the empty initial model, a model opened via command 41 | # line arguments, or auto-restored models on Mac OS X. 42 | # 43 | # @note Prior to SketchUp 2014, these methods were not being called for the 44 | # startup models. This issue is now fixed but observers still need to 45 | # express their intent to receive these calls. This is for 46 | # back-compatibility with existing scripts which worked around these 47 | # missing calls by other means. For new code, this method should be 48 | # implemented and should return true. 49 | # 50 | # @example 51 | # def expectsStartupModelNotifications() 52 | # return true 53 | # end 54 | # 55 | # @return [Boolean] Return +true+ to receive {#onNewModel} and 56 | # {#onOpenModel} calls for startup models. Return +false+ or simply not 57 | # implement the method in order to not receive these calls (which was the 58 | # behaviour prior to SketchUp 2014). 59 | # 60 | # @since SketchUp 2014 61 | def expectsStartupModelNotifications 62 | end 63 | 64 | # Called when an open model is activated. This is relevant on Mac only which 65 | # supports multiple documents to be opened simultaneously. 66 | # 67 | # @example 68 | # def onActivateModel(model) 69 | # puts "onActivateModel: " + model.to_s 70 | # end 71 | # 72 | # @param [Sketchup::Model] model The newly-activated model object. 73 | # 74 | # @return [void] 75 | # 76 | # @since SketchUp 2015 77 | def onActivateModel(model) 78 | end 79 | 80 | # Called when the application creates a new, empty model. 81 | # 82 | # @example 83 | # def onNewModel(model) 84 | # puts "onNewModel: " + model.to_s 85 | # end 86 | # 87 | # @param [Sketchup::Model] model The active model object. 88 | # 89 | # @return [void] 90 | def onNewModel(model) 91 | end 92 | 93 | # Called when the application opens an existing model. 94 | # 95 | # @note If a skp file is loaded via the command line or double-clicking on a 96 | # skp in explorer (which is also is the command line) then this observer 97 | # will not be called. The Ruby interpreter in SketchUp is initialized 98 | # after command line processing so the observer won't be added in time to 99 | # get the notification. 100 | # 101 | # @example 102 | # def onOpenModel(model) 103 | # puts "onOpenModel: " + model.to_s 104 | # end 105 | # 106 | # @param [Sketchup::Model] model The active model object. 107 | # 108 | # @return [void] 109 | def onOpenModel(model) 110 | end 111 | 112 | # Triggered when SketchUp closes. This is useful if you need to clean up 113 | # anything or store your application state upon close. 114 | # 115 | # @example 116 | # def onQuit() 117 | # UI.messagebox("SU is closing!") 118 | # end 119 | # 120 | # @return [void] 121 | def onQuit 122 | end 123 | 124 | # Called when the user turns off a Ruby extension. This is useful for 125 | # detecting if the user is deactivating some critical set of observers, for 126 | # example, so you can warn them or cache your plugin state. 127 | # 128 | # @example 129 | # def onUnloadExtension(ext_name) 130 | # puts "onUnloadExtension: " + ext_name.to_s 131 | # end 132 | # 133 | # @param [String] ext_name The name of the extension just unloaded. 134 | # 135 | # @return [void] 136 | # 137 | # @since SketchUp 7.0 138 | def onUnloadExtension(ext_name) 139 | end 140 | 141 | end # class AppObserver 142 | end # module Sketchup 143 | -------------------------------------------------------------------------------- /lib/arccurve.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | # An {ArcCurve} is a {Curve} that makes up part of a circle. This is the 4 | # underlying class for circles as well. 5 | # 6 | # You can think of ArcCurves as entities that were created with SketchUp's Arc 7 | # or Circle drawing tools and Curves as entities that were created with the 8 | # Freehand drawing tool. 9 | # 10 | # However, keep in mind that all Curves in SketchUp are really edges with some 11 | # extra data attached to them. When you use the API to draw a {Curve} or 12 | # {ArcCurve}, you are really drawing edges. 13 | # 14 | # {ArcCurve} is a subclass of {Curve}, so all of the methods that are 15 | # available to Curves are also available to ArcCurves. 16 | # 17 | # @example 18 | # # Draw a circle on the ground plane around the origin. 19 | # center_point = Geom::Point3d.new(0,0,0) 20 | # normal_vector = Geom::Vector3d.new(0,0,1) 21 | # radius = 10 22 | # 23 | # entities = Sketchup.active_model.entities 24 | # edge_array = entities.add_circle center_point, normal_vector, radius 25 | # first_edge = edge_array[0] 26 | # arc_curve = first_edge.curve 27 | # 28 | # @see http://www.sketchup.com/intl/en/developer/docs/ourdoc/arccurve ArcCurve Docs 29 | # 30 | # @since SketchUp 6.0 31 | class ArcCurve < Curve 32 | 33 | # Get center of the circular arc. 34 | # 35 | # @example 36 | # center_point = Geom::Point3d.new 37 | # # Create a circle perpendicular to the normal or Z axis 38 | # vector = Geom::Vector3d.new 0,0,1 39 | # vector2 = vector.normalize! 40 | # model = Sketchup.active_model 41 | # entities = model.entities 42 | # edge_array = entities.add_circle center_point, vector2, 10 43 | # edge = edge_array[0] 44 | # arc_curve = edge.curve 45 | # point = arc_curve.center 46 | # 47 | # @return [Geom::Point3d] Center of the arc if successful. 48 | def center 49 | end 50 | 51 | # Get the angle of the end of the arc measured from the X axis in radians. 52 | # 53 | # @example 54 | # # Create a 1/2 circle, normal to the Z axis 55 | # center = Geom::Point3d.new 56 | # normal = Geom::Vector3d.new 0,0,1 57 | # xaxis = Geom::Vector3d.new 1,0,0 58 | # start_a = 0.0 59 | # end_a = Math::PI 60 | # model = Sketchup.active_model 61 | # entities = model.entities 62 | # edge_array = entities.add_arc center, xaxis, normal, 5, start_a, end_a 63 | # edge = edge_array[0] 64 | # arc_curve = edge.curve 65 | # end_angle = arc_curve.end_angle 66 | # 67 | # @return [Numeric] The angle of the end of the arc (in radians) if 68 | # successful. 69 | def end_angle 70 | end 71 | 72 | # Get arc normal, the vector that is perpendicular to the plane of the arc. 73 | # 74 | # @example 75 | # center_point = Geom::Point3d.new 76 | # # Create a circle perpendicular to the normal or Z axis 77 | # vector = Geom::Vector3d.new 0,0,1 78 | # vector2 = vector.normalize! 79 | # model = Sketchup.active_model 80 | # entities = model.entities 81 | # edge_array = entities.add_circle center_point, vector2, 10 82 | # edge = edge_array[0] 83 | # arc_curve = edge.curve 84 | # v = arc_curve.normal 85 | # 86 | # @return [Geom::Vector3d] The normal of the arc if successful. 87 | def normal 88 | end 89 | 90 | # Get arc plane. 91 | # 92 | # @note Refer to the {Geom} module for instructions to create a plane. 93 | # 94 | # @example 95 | # center_point = Geom::Point3d.new 96 | # # Create a circle perpendicular to the normal or Z axis 97 | # vector = Geom::Vector3d.new 0,0,1 98 | # vector2 = vector.normalize! 99 | # model = Sketchup.active_model 100 | # entities = model.entities 101 | # edge_array = entities.add_circle center_point, vector2, 10 102 | # edge = edge_array[0] 103 | # arc_curve = edge.curve 104 | # plane = arc_curve.plane 105 | # 106 | # @return [Array] An a array of four values representing the plane 107 | # of the arc curve. 108 | def plane 109 | end 110 | 111 | # Get arc radius. 112 | # 113 | # @example 114 | # center_point = Geom::Point3d.new 115 | # # Create a circle perpendicular to the normal or Z axis 116 | # vector = Geom::Vector3d.new 0,0,1 117 | # vector2 = vector.normalize! 118 | # model = Sketchup.active_model 119 | # entities = model.entities 120 | # edge_array = entities.add_circle center_point, vector2, 10 121 | # edge = edge_array[0] 122 | # arc_curve = edge.curve 123 | # radius = arc_curve.radius 124 | # 125 | # @return [Numeric] The radius of the arc if successful. 126 | def radius 127 | end 128 | 129 | # Get the angle of the start of the arc, measured from the X axis in 130 | # radians. 131 | # 132 | # @example 133 | # # Create a 1/4 circle, radius of 5, normal to the Z axis 134 | # center = Geom::Point3d.new 0, 0, -1 135 | # normal = Geom::Vector3d.new 0,0,1 136 | # xaxis = Geom::Vector3d.new 1,0,0 137 | # start_a = Math::PI/2 138 | # end_a = Math::PI 139 | # model = Sketchup.active_model 140 | # entities = model.entities 141 | # edge_array = entities.add_arc center, xaxis, normal, 5, start_a, end_a 142 | # edge = edge_array[0] 143 | # arc_curve = edge.curve 144 | # start_angle = arc_curve.start_angle 145 | # 146 | # @return [Numeric] The angle of the start of the arc (in radians) if 147 | # successful. 148 | def start_angle 149 | end 150 | 151 | # Get the X axis of the arc's coordinate system. 152 | # 153 | # @note The length of the returned vector is equal to the radius of the 154 | # underlying curve. 155 | # 156 | # @example 157 | # center_point = Geom::Point3d.new 158 | # # Create a circle perpendicular to the normal or Z axis 159 | # vector = Geom::Vector3d.new 0,0,1 160 | # vector2 = vector.normalize! 161 | # model = Sketchup.active_model 162 | # entities = model.entities 163 | # edge_array = entities.add_circle center_point, vector2, 10 164 | # edge = edge_array[0] 165 | # arc_curve = edge.curve 166 | # v = arc_curve.xaxis 167 | # 168 | # @return [Geom::Vector3d] The xaxis of the arc's coordinate system if 169 | # successful. 170 | def xaxis 171 | end 172 | 173 | # Get the Y axis of the arc's coordinate system. 174 | # 175 | # @note The length of the returned vector is equal to the radius of the 176 | # underlying curve. 177 | # 178 | # @example 179 | # center_point = Geom::Point3d.new 180 | # # Create a circle perpendicular to the normal or Z axis 181 | # vector = Geom::Vector3d.new 0,0,1 182 | # vector2 = vector.normalize! 183 | # model = Sketchup.active_model 184 | # entities = model.entities 185 | # edge_array = entities.add_circle center_point, vector2, 10 186 | # edge = edge_array[0] 187 | # arc_curve = edge.curve 188 | # v = arc_curve.yaxis 189 | # 190 | # @return [Geom::Vector3d] The yaxis of the arc's coordinate system if 191 | # successful. 192 | def yaxis 193 | end 194 | 195 | end # class ArcCurve < Curve 196 | end # module Sketchup 197 | -------------------------------------------------------------------------------- /lib/array.rb: -------------------------------------------------------------------------------- 1 | # The SketchUp Array class adds additional methods to the standard Ruby Array 2 | # class. Specifically, it contains methods allowing an array to behave just as a 3 | # {Geom::Vector3d} or {Geom::Point3d} object (which can be thought of as arrays 4 | # of 3 coordinate values). Therefore, you can use the Array class in place of a 5 | # {Geom::Point3d} or {Geom::Vector3d} as a way to pass coordinate values. 6 | # 7 | # In addition to the built-in {http://www.ruby-doc.org/core-2.0.0/Array.html Ruby Array} 8 | # methods, the following methods have been added by SketchUp. 9 | # 10 | # @note In SketchUp, Arrays may be used in place of either {Geom::Point3d} and 11 | # {Geom::Vector3d} objects depending on how they are used. 12 | # 13 | # @example 14 | # # An array of 3 values can represent a 1" long vector pointing straight 15 | # # up in the z-direction. 16 | # array = [0, 0, 1] 17 | # 18 | # # An array of 3 values can also represent a point 1" above the origin in 19 | # # the z direction. (Note that this is the exact same array.) 20 | # array = [0, 0, 1] 21 | # 22 | # # How it is interpreted is based on context. For example, this code will 23 | # # create a construction point at position 0, 0, 1, since in this context 24 | # # a Point3d is expected. 25 | # entities = Sketchup.active_model.entities 26 | # construction_point = entities.add_cpoint(array) 27 | # 28 | # # Whereas this will move our construction point 1" upward, since in this 29 | # # context a Vector3d is expected. 30 | # transformation = Geom::Transformation.new(array) 31 | # entities.transform_entities(transformation, construction_point) 32 | # 33 | # @see http://www.sketchup.com/intl/en/developer/docs/ourdoc/array Array Docs 34 | # 35 | # @since SketchUp 6.0 36 | class Array 37 | 38 | # Compute the cross product between two vectors, particularly this vector and 39 | # the given vector. 40 | # 41 | # @example 42 | # vector1 = Geom::Vector3d.new(0, 1, 0) 43 | # array = [1, 0, 0] 44 | # This will return a new Vector3d 45 | # vector2 = array.cross(vector1) 46 | # 47 | # @param [Geom::Vector3d, Array] vector 48 | # 49 | # @return [Vector3d] Computed cross product. 50 | def cross(vector) 51 | end 52 | 53 | # Compute the distance between this point and the given point. 54 | # 55 | # @example 56 | # [0,0].distance([1,1]) # ==> 1.414 57 | # ORIGIN.distance([1,1,1]) # ==> 1.732 58 | # 59 | # @example 60 | # point = Geom::Point3d.new(10, 10, 10) 61 | # array = [1, 1, 1] 62 | # # This will return a Length 63 | # distance = array.distance(point) 64 | # 65 | # @param [Geom::Point3d, Array] point 66 | # 67 | # @return [Length] Computed distance. 68 | def distance(point) 69 | end 70 | 71 | # Compute the distance from the current point to a line. Lines are defined by 72 | # an array of a point and a vector or an array of two points. See the {Geom} 73 | # module for instructions on how to create a line. 74 | # 75 | # @example 76 | # line = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)] 77 | # array = [10, 10, 10] 78 | # # This will return a Length 79 | # distance = array.distance_to_line(line) 80 | # 81 | # @param [Array<(Geom::Point3d, Geom::Vector3d)>, Array<(Geom::Point3d, Geom::Point3d)>] line 82 | # An array with a {Geom::Point3d} object and a {Geom::Vector3d} object or an 83 | # array with two {Geom::Point3d} objects representing the line. 84 | # 85 | # @return [Length] Computed distance. 86 | def distance_to_line(line) 87 | end 88 | 89 | # Compute the distance from the current point to a plane. See the {Geom} 90 | # module for instructions on how to create a plane. 91 | # 92 | # @example 93 | # plane = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)] 94 | # array = [10, 10, 10] 95 | # # This will return a Length 96 | # distance = array.distance_to_plane(plane) 97 | # 98 | # @param [Array<(Geom::Point3d, Geom::Vector3d)>] plane An array with a 99 | # {Geom::Point3d} object and a {Geom::Vector3d} object representing the 100 | # plane. 101 | # 102 | # @return [Length] Computed distance. 103 | def distance_to_plane(plane) 104 | end 105 | 106 | # Compute the dot product between the current and the specified vector. 107 | # 108 | # @example 109 | # [0, 0, 1].dot([0, 1, 0]) # ==> 0.0 110 | # 111 | # @example 112 | # vector = Geom::Vector3d.new(0, 1, 0) 113 | # array = [1, 0, 0] 114 | # # This will return a Float, in this case 22.0 115 | # dot_product = array.dot(vector) 116 | # 117 | # @param [Vector3d] vector 118 | # 119 | # @return [Float] Computed dot product. 120 | def dot(vector) 121 | end 122 | 123 | # Normalize the current vector (setting its length to one). It returns a new 124 | # array rather than changing the original in place. 125 | # 126 | # @example 127 | # array = [1, 2, 3] 128 | # # This will return a new Array 129 | # normal_vector = array.normalize 130 | # 131 | # @return [Array] A new array representing the normalized vector. 132 | def normalize 133 | end 134 | 135 | # Normalize the current vector in place (settings its length to one). 136 | # 137 | # @example 138 | # array = [1, 2, 3] 139 | # # This will modify the 'array' in place. 140 | # normal_vector = array.normalize! 141 | # 142 | # @return [Array] The current array with the normalized vector. 143 | def normalize! 144 | end 145 | 146 | # Offset current point by a vector. This returns a new array rather than 147 | # modifying the original in place. 148 | # 149 | # @example 150 | # array = [10, 10, 10] 151 | # vector = Geom::Vector3d.new(0, 0, 1) 152 | # # This will return a new Array 153 | # point = array.offset(vector) 154 | # 155 | # @param [Geom::Vector3d, Array] vector 156 | # 157 | # @return [Array] The newly offset array. 158 | def offset(vector) 159 | end 160 | 161 | # Offset current point by a vector in place. This modifies the current array. 162 | # 163 | # @example 164 | # array = [10, 10, 10] 165 | # vector = Geom::Vector3d.new(0, 0, 1) 166 | # # This will modify 'array' in place. 167 | # point = array.offset!(vector) 168 | # 169 | # @param [Geom::Vector3d, Array] vector 170 | # 171 | # @return [Array] The current offset array. 172 | def offset!(vector) 173 | end 174 | 175 | # Determine if the current point is on the given line. See the {Geom} module 176 | # for instructions on how to create a line. 177 | # 178 | # @example 179 | # line = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)] 180 | # array = [10, 10, 10] 181 | # # This will return a true or false value 182 | # on_plane = array.on_line?(line) 183 | # 184 | # @param [Array<(Geom::Point3d, Geom::Vector3d)>, Array<(Geom::Point3d, Geom::Point3d)>] line 185 | # An array with a {Geom::Point3d} object and a {Geom::Vector3d} object or an 186 | # array with two {Geom::Point3d} objects representing the line. 187 | # 188 | # @return [Boolean] +true+ if the point is on the line or +false+ if the point 189 | # is not on the line. 190 | def on_line?(line) 191 | end 192 | 193 | # Determine if the current point is on the given plane. See the {Geom} module 194 | # for instructions on how to create a plane. 195 | # 196 | # @example 197 | # plane = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)] 198 | # array = [10, 10, 10] 199 | # # This will return false because the current point is not on the plane. 200 | # on_plane = array.on_plane?(plane) 201 | # 202 | # @param [Array<(Geom::Point3d, Geom::Vector3d)>] plane An array with a 203 | # {Geom::Point3d} object and a {Geom::Vector3d} object representing the 204 | # plane. 205 | # 206 | # @return [Boolean] +true+ if the point is on the plane or +false+ if the 207 | # point is not on the plane. 208 | def on_plane?(plane) 209 | end 210 | 211 | # Project point onto a line. See the {Geom} module for instructions on how to 212 | # create a line. 213 | # 214 | # @example 215 | # line = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)] 216 | # array = [10, 10, 10] 217 | # # This will return a new Array 218 | # point_on_line = array.project_to_line(line) 219 | # 220 | # @param [Array<(Geom::Point3d, Geom::Vector3d)>, Array<(Geom::Point3d, Geom::Point3d)>] line 221 | # An array with a {Geom::Point3d} object and a {Geom::Vector3d} object or an 222 | # array with two {Geom::Point3d} objects representing the line. 223 | # 224 | # @return [Array] A new point on the line that is closest to this point if 225 | # successful. 226 | def project_to_line(line) 227 | end 228 | 229 | # Project point onto a plane. See the {Geom} module for instructions on how to 230 | # create a plane. 231 | # 232 | # @example 233 | # plane = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)] 234 | # array = [10, 10, 10] 235 | # # This will return a new Array 236 | # point_on_line = array.project_to_plane(plane) 237 | # 238 | # @param [Array<(Geom::Point3d, Geom::Vector3d)>] plane An array with a 239 | # {Geom::Point3d} object and a {Geom::Vector3d} object representing the 240 | # plane. 241 | # 242 | # @return [Array] A new point on the plane that is closest to this point if 243 | # successful. 244 | def project_to_plane(plane) 245 | end 246 | 247 | # Apply {Geom::Transformation} object to the current point defined by an 248 | # {Array} object. This method returns a new transformed point rather than 249 | # modifying the current point. 250 | # 251 | # @example 252 | # point = Geom::Point3d.new(10, 20, 30) 253 | # transform = Geom::Transformation.new(point) 254 | # array = [1, 2, 3] 255 | # # This will return a new Array 256 | # array.transform(transform) 257 | # 258 | # @param [Geom::Transformation] transformation 259 | # 260 | # @return [Array] The newly transformed point. 261 | def transform(transformation) 262 | end 263 | 264 | # Apply {Geom::Transformation} object to the current point defined by an 265 | # {Array} object. This method modifies the current point. 266 | # 267 | # @example 268 | # point = Geom::Point3d.new(10, 20, 30) 269 | # transform = Geom::Transformation.new(point) 270 | # array = [1, 2, 3] 271 | # # This will modify 'array' in place 272 | # array.transform!(transform) 273 | # 274 | # @param [Geom::Transformation] transformation 275 | # 276 | # @return [Array] The current transformed point. 277 | def transform!(transformation) 278 | end 279 | 280 | # Compute vector from the current point to the given point. 281 | # 282 | # @example 283 | # point = Geom::Point3d.new(10, 20, 30) 284 | # array = [1, 2, 3] 285 | # # This will return a new Vector3d 286 | # vector = array.vector_to(point) 287 | # 288 | # @param [Geom::Point3d, Array] point 289 | # 290 | # @return [Geom::Vector3d] 291 | def vector_to(point) 292 | end 293 | 294 | # Get the X coordinate or the first element of the array. 295 | # 296 | # @example 297 | # [1, 2, 3].x # ==> 1 298 | # 299 | # @example 300 | # array = [1, 2, 3] 301 | # # This will return a Fixnum, in this case 1 302 | # x = array.x 303 | # 304 | # array = [1.0, 2.0, 3.0] 305 | # # This will return a Float, in this case 1.0 306 | # x = array.x 307 | # 308 | # @return [Numeric] The X coordinate or the first element. 309 | def x 310 | end 311 | 312 | # Set the X coordinate or the first element of the array. 313 | # 314 | # @example 315 | # array = [1, 2, 3] 316 | # # This will initialize the x value as a Float 317 | # array.x = 2.5 318 | # # This will initialize the x value as a Fixnum 319 | # array.x = 5 320 | # 321 | # @return [Object] The newly assigned value. 322 | def x= 323 | end 324 | 325 | # Get the Y coordinate or the second element of the array. 326 | # 327 | # @example 328 | # [1, 2, 3].y # ==> 2 329 | # 330 | # @example 331 | # array = [1, 2, 3] 332 | # # This will return a Fixnum, in this case 2 333 | # y = array.y 334 | # 335 | # array = [1.0, 2.0, 3.0] 336 | # # This will return a Float, in this case 2.0 337 | # y = array.y 338 | # 339 | # @return [Numeric] The Y coordinate or the second element. 340 | def y 341 | end 342 | 343 | # Set the Y coordinate or the second element of the array. 344 | # 345 | # @example 346 | # array = [1, 2, 3] 347 | # # This will initialize the y value as a Float 348 | # array.y = 2.5 349 | # # This will initialize the y value as a Fixnum 350 | # array.y = 5 351 | # 352 | # @return [Object] The newly assigned value. 353 | def y= 354 | end 355 | 356 | # Get the Z coordinate or the third element of the array. 357 | # 358 | # @example 359 | # [1, 2, 3].z # ==> 2 360 | # 361 | # @example 362 | # array = [1, 2, 3] 363 | # # This will return a Fixnum, in this case 3 364 | # z = array.z 365 | # 366 | # array = [1.0, 2.0, 3.0] 367 | # # This will return a Float, in this case 3.0 368 | # z = array.z 369 | # 370 | # @return [Numeric] The Z coordinate or the third element. 371 | def z 372 | end 373 | 374 | # Set the Z coordinate or the third element of the array. 375 | # 376 | # @example 377 | # array = [1, 2, 3] 378 | # # This will initialize the z value as a Float 379 | # array.z = 2.5 380 | # # This will initialize the z value as a Fixnum 381 | # array.z = 5 382 | # 383 | # @return [Object] The newly assigned value. 384 | def z= 385 | end 386 | 387 | end # class Array 388 | -------------------------------------------------------------------------------- /lib/attributedictionaries.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | # The {AttributeDictionaries} class is a collection of all of the 4 | # {AttributeDictionary} objects that are attached to a given Entity object. 5 | # 6 | # The {Entity} class is a popular parent class in SketchUp, meaning you can 7 | # attach {AttributeDictionaries} to almost anything, from geometric items like 8 | # edges and faces and components to more conceptual things like pages or 9 | # materials. 10 | # 11 | # You access this class not by performing an AttributeDictionaries.new 12 | # but by grabbing a handle from an existing entity. 13 | # 14 | # By default, when entity is created it has no {AttributeDictionaries} object: 15 | # g = Sketchup.active_model.entities.add_group 16 | # g.attribute_dictionaries # => nil 17 | # The {AttributeDictionaries} object is added to the entity only once the first 18 | # attribute is added to the entity: 19 | # g.set_attribute("Test", "Yo", "Hello") 20 | # g.attribute_dictionaries # => #> 21 | # When iterating through entity attribute dictionaries, be sure to verify that 22 | # Sketchup::Entity.#attribute_dictionaries is not nil. 23 | # 24 | # @example 25 | # # Grab the first entity from the model. 26 | # my_layer = Sketchup.active_model.entities[0] 27 | # 28 | # # Grab a handle to its attribute dictionaries. 29 | # attr_dicts = my_layer.attribute_dictionaries 30 | # 31 | # @see http://www.sketchup.com/intl/en/developer/docs/ourdoc/attributedictionaries AttributeDictionaries Docs 32 | # 33 | # @since SketchUp 6.0 34 | class AttributeDictionaries < Entity 35 | 36 | include Enumerable 37 | 38 | # Get an {AttributeDictionary} object by name. 39 | # 40 | # @example 41 | # model = Sketchup.active_model 42 | # attr_dicts = model.attribute_dictionaries 43 | # # Iterates through all dictionaries and prints to screen. 44 | # dict = attr_dicts['my_dictionary'] 45 | # if dict 46 | # UI.messagebox("Found: " + dict.to_s) 47 | # else 48 | # UI.messagebox("No dictionary found.") 49 | # end 50 | # 51 | # @param [String] key The name of the attribute dictionary. 52 | # 53 | # @return [AttributeDictionary] An attribute dictionary if it exits or +nil+ 54 | # if none with the specified key exist. 55 | def [](key) 56 | end 57 | 58 | # Destroy {AttributeDictionary} object. 59 | # 60 | # @example 61 | # model = Sketchup.active_model 62 | # attr_dicts = model.attribute_dictionaries 63 | # # Deletes a dictionary called 'my_dictionary' 64 | # attr_dicts.delete 'my_dictionary' 65 | # 66 | # @param [AttributeDictionary, String] key_or_dict The name of the attribute 67 | # dictionary to delete or the object itself. 68 | # 69 | # @return [AttributeDictionaries] The modified attribute dictionaries. 70 | def delete(key_or_dict) 71 | end 72 | 73 | # Iterate through all of the attribute dictionaries. 74 | # 75 | # @example 76 | # model = Sketchup.active_model 77 | # attr_dicts = model.attribute_dictionaries 78 | # # Iterates through all dictionaries and prints to screen. 79 | # attr_dicts.each { | dict | UI.messagebox dict } 80 | # 81 | # @yieldparam [AttributeDictionary] dictionary Each attribute dictionary as 82 | # it is found. 83 | # 84 | # @return [nil] 85 | def each 86 | end 87 | 88 | # Get the number of {AttributeDictionary} objects in the collection. 89 | # 90 | # @example 91 | # model = Sketchup.active_model 92 | # model.set_attribute('Example', 'Hello', 'World') 93 | # dictionaries = model.attribute_dictionaries 94 | # number = dictionaries.length 95 | # 96 | # @return [Fixnum] 97 | # 98 | # @since SketchUp 2014 99 | def length 100 | end 101 | 102 | alias_method :size, :length 103 | 104 | end # class AttributeDictionaries < Entity 105 | end # module Sketchup 106 | -------------------------------------------------------------------------------- /lib/attributedictionary.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | # The {AttributeDictionary} class allows you to attach arbitrary collections 4 | # of attributes to a SketchUp entity. The attributes are defined by key/value 5 | # pairs where the keys are strings. An {Entity} or {Model} object can have any 6 | # number of {AttributeDictionary} objects. 7 | # 8 | # The {Entity} class is a popular parent class in SketchUp, meaning you can 9 | # attach {AttributeDictionaries} to almost anything, from geometric items like 10 | # edges and faces and components to more conceptual things like pages or 11 | # materials. 12 | # 13 | # @see http://www.sketchup.com/intl/en/developer/docs/ourdoc/attributedictionary AttributeDictionary Docs 14 | # 15 | # @since SketchUp 6.0 16 | class AttributeDictionary < Entity 17 | 18 | include Enumerable 19 | 20 | # Get attribute value. 21 | # 22 | # @example 23 | # model = Sketchup.active_model 24 | # value = model.set_attribute "test_dictionary", "test", 115 25 | # attr_dicts = model.attribute_dictionaries 26 | # attr_dicts = attr_dicts["test_dictionary"] 27 | # 28 | # # value will contain 115 29 | # value = attr_dicts["test"] 30 | # 31 | # @param [String] key The name of the attribute. 32 | # 33 | # @return [Object] The attribute stored under the given key or +nil+ if 34 | # there is no attribute with the given key. 35 | def [](key) 36 | end 37 | 38 | # Set attribute value. 39 | # 40 | # @example 41 | # model = Sketchup.active_model 42 | # value = model.set_attribute "test_dictionary", "test", 110 43 | # attr_dicts = model.attribute_dictionaries 44 | # attr_dicts = attr_dicts["test_dictionary"] 45 | # value = attr_dicts["test2"] = 120 46 | # if (value) 47 | # UI.messagebox value 48 | # end 49 | # 50 | # @param [String] key The name of the attribute. 51 | # @param [Object] value The value of the attribute. 52 | # 53 | # @return [Object] The newly assigned object if successful or +nil+ if 54 | # unsuccessful. 55 | def []=(key, value) 56 | end 57 | 58 | # Delete an attribute with a given key. 59 | # 60 | # @example 61 | # create_if_nil = true 62 | # model = Sketchup.active_model 63 | # attr_dict = model.attribute_dictionary "test_dict", create_if_nil 64 | # attr_dict["attr_one"] = "one" 65 | # attr_dict["attr_two"] = "two" 66 | # 67 | # # Gets an array of values 68 | # attr_dict = model.attribute_dictionaries['test_dict'] 69 | # value = attr_dict.delete_key("attr_one") 70 | # 71 | # @param [String] key The key to be deleted. 72 | # 73 | # @return [Object] The value of the key or +nil+ if the specified key 74 | # doesn't exist. 75 | def delete_key(key) 76 | end 77 | 78 | # Iterate through all of the attribute keys and values. 79 | # 80 | # @example 81 | # create_if_nil = true 82 | # model = Sketchup.active_model 83 | # attr_dict = model.attribute_dictionary "test_dict", create_if_nil 84 | # attr_dict["attr_one"] = "one" 85 | # attr_dict["attr_two"] = "two" 86 | # 87 | # # Iterates through all attributes and prints the key to the screen 88 | # attr_dict = model.attribute_dictionaries['test_dict'] 89 | # attr_dict.each { | key, value | 90 | # UI.messagebox key.to_s + '=' + value.to_s 91 | # } 92 | # 93 | # @yieldparam [String] key 94 | # @yieldparam [Object] value 95 | # 96 | # @return [nil] 97 | def each 98 | end 99 | 100 | # Iterate through all of the attribute keys. 101 | # 102 | # @example 103 | # create_if_nil = true 104 | # model = Sketchup.active_model 105 | # attr_dict = model.attribute_dictionary "test_dict", create_if_nil 106 | # attr_dict["attr_one"] = "one" 107 | # attr_dict["attr_two"] = "two" 108 | # 109 | # # iterates through all attributes and prints the key to the screen 110 | # attr_dict = model.attribute_dictionaries['test_dict'] 111 | # attr_dict.each_key { | key | UI.messagebox key } 112 | # 113 | # @yieldparam [String] key The key of each attribute as it is found. 114 | # 115 | # @return [nil] 116 | def each_key 117 | end 118 | 119 | alias_method :each_pair, :each 120 | 121 | # Get an array with all of the attribute keys. 122 | # 123 | # @return [Array] An array of keys within the attribute dictionary. 124 | def keys 125 | end 126 | 127 | # Get the number of attributes in the attribute dictionary. 128 | # 129 | # @example 130 | # model = Sketchup.active_model 131 | # model.set_attribute('Example', 'Hello', 'World') 132 | # dictionary = model.attribute_dictionary('Example') 133 | # number = dictionary.length 134 | # 135 | # @return [Fixnum] The size of the attribute dictionary. 136 | def length 137 | end 138 | 139 | alias_method :size, :length 140 | 141 | # Get the name of an attribute dictionary. 142 | # 143 | # @example 144 | # create_if_nil = true 145 | # model = Sketchup.active_model 146 | # attr_dict = model.attribute_dictionary "test_dict", create_if_nil 147 | # attr_dict["attr_one"] = "one" 148 | # attr_dict["attr_two"] = "two" 149 | # 150 | # # Show the name. 151 | # UI.messagebox attr_dict.name 152 | # 153 | # @return [String] The name of the attribute dictionary. 154 | def name 155 | end 156 | 157 | # Get an array with all of the attribute values. 158 | # 159 | # @example 160 | # create_if_nil = true 161 | # model = Sketchup.active_model 162 | # attr_dict = model.attribute_dictionary "test_dict", create_if_nil 163 | # attr_dict["attr_one"] = "one" 164 | # attr_dict["attr_two"] = "two" 165 | # 166 | # # Gets an array of values 167 | # attr_dict = model.attribute_dictionaries['test_dict'] 168 | # values = attr_dict.values 169 | # 170 | # @return [Array] An array of values within the attribute dictionary. 171 | def values 172 | end 173 | 174 | end # class AttributeDictionary < Entity 175 | end # module Sketchup 176 | -------------------------------------------------------------------------------- /lib/axes.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | # @since SketchUp 2016 4 | class Axes < Entity 5 | 6 | # @return Array 7 | def axes 8 | end 9 | 10 | # @return [Point3d] 11 | def origin 12 | end 13 | 14 | # @return [Axes] 15 | def set(point, xaxis, yaxis, zaxis) 16 | end 17 | 18 | # @return [Array] 19 | def sketch_plane 20 | end 21 | 22 | # @return [Array] a point and 3 vectors 23 | def to_a 24 | end 25 | 26 | # @return [Transformation] 27 | def transformation 28 | end 29 | 30 | # @return [Vector3d] 31 | def xaxis 32 | end 33 | 34 | # @return [Vector3d] 35 | def yaxis 36 | end 37 | 38 | # @return [Vector3d] 39 | def zaxis 40 | end 41 | 42 | end 43 | end 44 | 45 | -------------------------------------------------------------------------------- /lib/behavior.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | # The {Behavior} class is used to control the "behavior" of components, which 4 | # roughly correlates to the series of options that you see in the Components 5 | # dialog under the "edit" tab, such as whether it casts shadows, glues to 6 | # walls, etc. 7 | # 8 | # A {Behavior} object is accessed from a {ComponentDefinition} object, not 9 | # created with a Behavior.new call. 10 | # 11 | # @example 12 | # # Grab the Behavior object from the first component definition. 13 | # model = Sketchup.active_model 14 | # definition = model.definitions[0] 15 | # behavior = definition.behavior 16 | # 17 | # @see http://www.sketchup.com/intl/en/developer/docs/ourdoc/behavior Behavior 18 | # 19 | # @since SketchUp 6.0 20 | class Behavior < Entity 21 | 22 | # Set the always-face-camera behavior for a component. 23 | # 24 | # @example 25 | # model = Sketchup.active_model 26 | # behavior = model.definitions[0].behavior 27 | # status = behavior.always_face_camera = false 28 | # 29 | # @param [Boolean] state +true+ to enable always-face-camera behavior, 30 | # +false+ to disable always-face-camera behavior. 31 | # 32 | # @return [Object] The newly assigned value. 33 | def always_face_camera=(state) 34 | end 35 | 36 | # Determine if the always-face-camera behavior is enabled. If the 37 | # always-face-camera behavior is true, then a component will always try to 38 | # orient itself so that the -Y axis of the component is facing the camera. 39 | # 40 | # @example 41 | # model = Sketchup.active_model 42 | # # Returns a DefinitionList 43 | # definitions = model.definitions 44 | # path = Sketchup.find_support_file "Bed.skp", "Components/Components Sampler/" 45 | # 46 | # begin 47 | # definition = definitions.load path 48 | # rescue 49 | # UI.messagebox $!.message 50 | # end 51 | # 52 | # behavior = definition.behavior 53 | # b = behavior.always_face_camera? 54 | # if (b) 55 | # UI.messagebox b 56 | # else 57 | # UI.messagebox "Always Face Camera is equal to false" 58 | # end 59 | # status = behavior.always_face_camera = true 60 | # b = behavior.always_face_camera? 61 | # if (b) 62 | # UI.messagebox b 63 | # else 64 | # UI.messagebox "Failure" 65 | # end 66 | # 67 | # @return [Boolean] +true+ if the component is set to always face the camera 68 | # or +false+ if the component is not set to always face the camera. 69 | def always_face_camera? 70 | end 71 | 72 | # Set the cut-openings behavior for a component. 73 | # 74 | # @example 75 | # model = Sketchup.active_model 76 | # behavior = model.definitions[0].behavior 77 | # status = behavior.cuts_opening = false 78 | # if (status) 79 | # # if status is true, print the status 80 | # UI.messagebox status 81 | # else 82 | # # code to respond cuts_opening being false 83 | # end 84 | # 85 | # @param [Boolean] state +true+ to enable cuts openings, +false+ to disable 86 | # cuts-openings. 87 | # 88 | # @return [Object] The newly assigned value. 89 | def cuts_opening=(state) 90 | end 91 | 92 | # Determine if the cuts-openings behavior is set for a component. 93 | # 94 | # @example 95 | # model = Sketchup.active_model 96 | # behavior = model.definitions[0].behavior 97 | # status = behavior.cuts_opening? 98 | # if (status) 99 | # # if status is true, do something 100 | # else 101 | # # if status is false, do something else 102 | # end 103 | # 104 | # @return [Boolean] +true+ if cuts-openings behavior is set or +false+ if 105 | # cuts-openings behavior is not set. 106 | def cuts_opening? 107 | end 108 | 109 | # Set the 2D behavior for a component: whether it can be glued or aligned to 110 | # a face. 111 | # 112 | # @example 113 | # model = Sketchup.active_model 114 | # behavior = model.definitions[0].behavior 115 | # status = behavior.is2d = false 116 | # if (status) 117 | # # if status is true, print the status 118 | # UI.messagebox status 119 | # else 120 | # # code to respond is2d behavior being false 121 | # end 122 | # 123 | # @param [Boolean] state +true+ to enable 2D behavior, +false+ to disalbe 2D 124 | # behavior. 125 | # 126 | # @return [Object] The newly assigned value. 127 | def is2d=(state) 128 | end 129 | 130 | # Determine if the 2D behavior is set: whether it can be glued or aligned to 131 | # a face. 132 | # 133 | # @example 134 | # model = Sketchup.active_model 135 | # behavior = model.definitions[0].behavior 136 | # status = behavior.is2d? 137 | # if (status) 138 | # # if status is true, do something 139 | # else 140 | # # if status is false, do something else 141 | # end 142 | # 143 | # @return [Boolean] The status of the 2D behavior. 144 | def is2d? 145 | end 146 | 147 | # Set an integer that is really a bit-by-bit description of which scale tool 148 | # handles are hidden on a given component. This is useful for creating 149 | # definitions that can only be scaled in particular ways. If a bit contains 150 | # a 1, then a certain handle set will be hidden when the user selects the 151 | # component and activates the Scale tool. Here is the map of which bits 152 | # control which handles. 153 | # Bit0: disable scale along red (X), 154 | # Bit1: disable scale along green (Y), 155 | # Bit2: disable scale along blue (Z), 156 | # Bit3: disable scale in red/blue plane (X+Z), 157 | # Bit4: disable scale in green/blue plane (Y+Z), 158 | # Bit5: disable scale in red/green plane (X+Y), 159 | # Bit6: disable scale uniform (from corners) (XYZ). 160 | # 161 | # @note For 2-dimensional components (such as face-me components), not all 162 | # of the handles in the list above are even used. Also, if the component 163 | # you are modifying is already selected with the scale tool, then you or 164 | # your user must deactivate and reactivate the scale tool for your new 165 | # behavior to take effect. 166 | # 167 | # @example 168 | # # Disable the green and red-axes handles by setting bits 1 and 2 to 1. 169 | # definition = Sketchup.active_model.definitions[0] 170 | # behavior = definition.behavior 171 | # behavior.no_scale_mask = (1 << 1) + (1 << 2) 172 | # 173 | # @param [Fixnum] scale_mask An integer describing which scale tool handles 174 | # are hidden. 175 | # 176 | # @return [Object] The newly assigned value. 177 | # 178 | # @since Sketchup 7.0 179 | def no_scale_mask=(scale_mask) 180 | end 181 | 182 | # Get an integer that is a bit-by-bit description of which scale tool 183 | # handles are hidden when the user selects this single component with the 184 | # scale tool. See the {#no_scale_mask=} method for details on the bit 185 | # encodings used. 186 | # 187 | # @example 188 | # definition = Sketchup.active_model.definitions[0] 189 | # behavior = definition.behavior 190 | # no_scale_mask = behavior.no_scale_mask? 191 | # 192 | # @return [Fixnum] An integer describing which scale tool handles are 193 | # hidden. 194 | # 195 | # @since Sketchup 7.0 196 | def no_scale_mask? 197 | end 198 | 199 | # Identify whether the component's shadow will be cast from the component's 200 | # current position as though the component were facing the sun. See the 201 | # Component entity within the SketchUp User's guide for more information on 202 | # this feature. 203 | # 204 | # @example 205 | # model = Sketchup.active_model 206 | # behavior = model.definitions[0].behavior 207 | # behavior.shadows_face_sun = true 208 | # 209 | # @param [Boolean] status +true+ if the component's shadow is to be cast 210 | # from the component's current position as though the component were 211 | # facing the sun, +false+ to cause the shadow to be cast from the 212 | # component's current position. 213 | # 214 | # @return [Object] The newly assigned value. 215 | def shadows_face_sun=(status) 216 | end 217 | 218 | # Determine whether the component's shadow is being cast from the 219 | # component's current position (as though the component were facing the 220 | # sun). See the Component entity within the SketchUp User's guide for more 221 | # information on this feature. 222 | # 223 | # @example 224 | # model = Sketchup.active_model 225 | # behavior = model.definitions[0].behavior 226 | # status = behavior.shadows_face_sun? 227 | # 228 | # @return [Boolean] +true+ if the component's shadow is to be cast from the 229 | # component's current position as though the component were facing the sun 230 | # or +false+ if the shadow is to be cast from the component's current 231 | # position. 232 | def shadows_face_sun? 233 | end 234 | 235 | # Get components "snap to" behavior. Returns a constant indicating the 236 | # snapping behavior of the component described by behavior. Snapping 237 | # behavior is how the x-y plane of a component instance will be snapped 238 | # against a face. Possible values are: 239 | # SnapTo_Arbitrary (0) => Snap to any arbitrary face. 240 | # SnapTo_Horizontal (1) => Snap to horizontal face like floors. 241 | # SnapTo_Vertical (2) => Snap to vertical face like walls. 242 | # SnapTo_Sloped (3) => Snap to sloped face like sloping roofs. 243 | # 244 | # @example 245 | # model = Sketchup.active_model 246 | # behavior = model.definitions[0].behavior 247 | # status = behavior.snapto 248 | # if (status) 249 | # # if status is true, do something 250 | # else 251 | # # if status is false, do something else 252 | # end 253 | # 254 | # @return [Fixnum] A constant identifying one of the snapto types. 255 | def snapto 256 | end 257 | 258 | # Set components "snap to" behavior. Snapping behavior is how the x-y plane 259 | # of a component instance will be snapped against a face. Possible constant 260 | # values are: 261 | # SnapTo_Arbitrary (0) => Snap to any arbitrary face. 262 | # SnapTo_Horizontal (1) => Snap to horizontal face like floors. 263 | # SnapTo_Vertical (2) => Snap to vertical face like walls. 264 | # SnapTo_Sloped (3) => Snap to sloped face like sloping roofs. 265 | # 266 | # @example 267 | # model = Sketchup.active_model 268 | # behavior = model.definitions[0].behavior 269 | # behavior.snapto = SnapTo_Horizontal 270 | # 271 | # @param [Fixnum] type A constant identifying one of the snapto types. 272 | # 273 | # @return [Object] The newly assigned value. 274 | def snapto=(type) 275 | end 276 | 277 | end # class Behavior < Entity 278 | end # module Sketchup 279 | -------------------------------------------------------------------------------- /lib/boundingbox.rb: -------------------------------------------------------------------------------- 1 | module Geom 2 | 3 | # Bounding boxes are three-dimensional boxes (eight corners), aligned with the 4 | # global axes, that surround entities within your model. There is a default 5 | # bounding box for any new model that will surround all entities, including 6 | # all groups and components. Additionally, there are bounding boxes for 7 | # {Sketchup::Drawingelement} objects, including components and groups. 8 | # Bounding boxes are only large enough to exactly bound the entities within 9 | # your model, group, or component. 10 | # 11 | # @note The bounding box returned for Face Me components is the center of its 12 | # entire range of motion. This behavior changed in SketchUp 7.1. In 7.0 and 13 | # earlier, the Sketchup::Drawingelement.#bounds method would return 14 | # the bounds around the Face Me component's current, visible center. 15 | # 16 | # You can also create arbitrary {BoundingBox} objects by calling 17 | # BoundingBox.new. 18 | # 19 | # @example 20 | # # You can get the bounding box on a model. 21 | # model = Sketchup.active_model 22 | # model_bb = model.bounds 23 | # 24 | # # Or you can get the bounding box on any Drawingelement object. 25 | # first_entity = model.entities[0] 26 | # first_entity_bb = first_entity.bounds 27 | # 28 | # # Or you can create an empty bounding box of your own. 29 | # bounding_box = Geom::BoundingBox.new 30 | # 31 | # @see http://www.sketchup.com/intl/en/developer/docs/ourdoc/boundingbox BoundingBox Docs 32 | # 33 | # @since SketchUp 6.0 34 | class BoundingBox 35 | 36 | # Create a new, empty, bounding box. 37 | # 38 | # @example 39 | # bounding_box = Geom::BoundingBox.new 40 | def initialize 41 | end 42 | 43 | # Add a point, vertex, or other bounding boxes to the bounding box. The size 44 | # of the bounding box will increase as necessary to accommodate the new 45 | # items. 46 | # 47 | # Adding one point to an empty bounding box does not increase the size of 48 | # the bounding box. You must add at least two points before methods such as 49 | # BoundingBox.#diagonal will return a size greater than zero. 50 | # 51 | # @example 52 | # model = Sketchup.active_model 53 | # bounding_box = model.bounds 54 | # point1 = Geom::Point3d.new(100, 200, 300) 55 | # point2 = Geom::Point3d.new(200, 400, 200) 56 | # bounding_box.add(point1, point2) 57 | # 58 | # @param [Geom::Point3d, Sketchup::Vertex, Geom::BoundingBox] things A list 59 | # or single instance of {Point3d}, {Sketchup::Vertex}, or {BoundingBox} 60 | # objects. 61 | # 62 | # @return [Geom::BoundingBox] The current {BoundingBox} object. 63 | def add(*args) 64 | end 65 | 66 | # Get the center point of the bounding box. 67 | # 68 | # @example 69 | # bounding_box = Geom::BoundingBox.new 70 | # bounding_box.add([100, 200, -400], [200, 400, 100]) 71 | # # This will return a point Point3d(150, 300, -150). 72 | # point = bounding_box.center 73 | # 74 | # @return [Geom::Point3d] The center point of the BoundingBox. 75 | def center 76 | end 77 | 78 | # Remove all points from the bounding box. A cleared BoundingBox does not 79 | # have an points; therefore, the size is zero. 80 | # 81 | # @example 82 | # bounding_box = Geom::BoundingBox.new 83 | # bounding_box.add([100, 200, -400], [200, 400, 100]) 84 | # 85 | # # This will return false. 86 | # bounding_box.empty? 87 | # 88 | # bounding_box.clear 89 | # 90 | # # This will return true. 91 | # bounding_box.empty? 92 | # 93 | # @return [Geom::BoundingBox] The current {BoundingBox} object. 94 | def clear 95 | end 96 | 97 | # Determine if the current bounding box contains a specific {Point3d} or 98 | # {BoundingBox} object. 99 | # 100 | # @example 101 | # bounding_box = Geom::BoundingBox.new 102 | # bounding_box.add([100, 200, -400], [200, 400, 100]) 103 | # # This will return false. 104 | # bounding_box.contains?([300, 100, 400]) 105 | # # This will return true. 106 | # bounding_box.contains?([150, 300, -200]) 107 | # 108 | # @param [Array, Geom::Point3d, Geom::BoundingBox] thing 109 | # 110 | # @return [Boolean] +true+ if the bounding box contains the specified thing 111 | # or +false+ if not. 112 | def contains?(thing) 113 | end 114 | 115 | # Get point at specified corner of the bounding box. 116 | # 117 | # There are 8 corners to a bounding box, identified by the numbers 0..7. 118 | # Points are returned in the currently set units (inches by default). 119 | # 120 | # These are which index refers to which corner: 121 | # 0 = [0, 0, 0] (left front bottom) 122 | # 1 = [1, 0, 0] (right front bottom) 123 | # 2 = [0, 1, 0] (left back bottom) 124 | # 3 = [1, 1, 0] (right back bottom) 125 | # 4 = [0, 0, 1] (left front top) 126 | # 5 = [1, 0, 1] (right front top) 127 | # 6 = [0, 1, 1] (left back top) 128 | # 7 = [1, 1, 1] (right back top) 129 | # 130 | # @example 131 | # bounding_box = Geom::BoundingBox.new 132 | # bounding_box.add([100, 200, -400], [200, 400, 100]) 133 | # # This will return Point3d(100, 200, -400). 134 | # bounding_box.corner(0) 135 | # # This will return Point3d(100, 200, -400). 136 | # bounding_box.corner(6) 137 | # 138 | # @param [Fixnum] n A number between 0 and 7. 139 | # 140 | # @return [Geom::Point3d] The position of the corner at _n_. 141 | def corner(n) 142 | end 143 | 144 | # Get the depth of the bounding box. 145 | # 146 | # The depth is returned in the currently set units (inches by default). 147 | # 148 | # @example 149 | # bounding_box = Geom::BoundingBox.new 150 | # bounding_box.add([100, 200, -400], [200, 400, 100]) 151 | # # This will return a Length of 500.0". 152 | # length = bounding_box.depth 153 | # 154 | # @return [Length] The depth of the bounding box in currently set units. 155 | def depth 156 | end 157 | 158 | # Get the length of the diagonal of the bounding box. 159 | # 160 | # The diagonal is returned in the currently set units (inches by default). 161 | # 162 | # @example 163 | # bounding_box = Geom::BoundingBox.new 164 | # bounding_box.add([100, 200, -400], [200, 400, 100]) 165 | # # This will return a Length of ~547.72". 166 | # length = bounding_box.diagonal 167 | # 168 | # @return [Length] The diagonal of the bounding box in currently set units. 169 | def diagonal 170 | end 171 | 172 | # Determine if the bounding box is empty, such as if the bounds have not 173 | # been set. This is the opposite of the {#valid?} method. 174 | # 175 | # @example 176 | # bounding_box = Geom::BoundingBox.new 177 | # bounding_box.add([100, 200, -400], [200, 400, 100]) 178 | # # This will return false. 179 | # bounding_box.empty? 180 | # 181 | # @return [Boolean] +true+ if the bounding box is empty or +false+ if filed. 182 | def empty? 183 | end 184 | 185 | # Get the height of the bounding box. 186 | # 187 | # The height is returned in the currently set units (inches, by default). 188 | # 189 | # @example 190 | # bounding_box = Geom::BoundingBox.new 191 | # bounding_box.add([100, 200, -400], [200, 400, 100]) 192 | # # This will return a Length of 200.0". 193 | # length = bounding_box.height 194 | # 195 | # @return [Length] The height of the bounding box in currently set units. 196 | def height 197 | end 198 | 199 | # Intersect this bounding box with another bounding box. This method returns 200 | # a new bounding box object rather than modifying the current one. 201 | # 202 | # @note Prior to SU2015 this method would return incorrect result in some 203 | # cases. For correct result in these versions you must first check if the 204 | # bounding boxes actually overlap - then call this to get the resulting 205 | # bounding box. 206 | # 207 | # @example 208 | # boundingbox1 = Geom::BoundingBox.new 209 | # boundingbox1.add([100, 200, -400], [200, 400, 300]) 210 | # boundingbox2 = Geom::BoundingBox.new 211 | # boundingbox2.add([150, 350, 100], [200, 400, 500]) 212 | # # The returned boundingbox is a result of the intersection of the two. 213 | # boundingbox = boundingbox1.intersect(boundingbox2) 214 | # 215 | # @param [Geom::BoundingBox] other_bounding_box THe other bounding box, 216 | # which might intersect with this bounding box. 217 | # 218 | # @return [Geom::BoundingBox] The resulting BoundingBox object. 219 | def intersect(other_bounding_box) 220 | end 221 | 222 | # Get the maximum point in the bounding box. 223 | # 224 | # @note If you attempt to call this method on an empty bounding box, you 225 | # will receive a point consisting of very large negative numbers. 226 | # 227 | # @example 228 | # bounding_box = Geom::BoundingBox.new 229 | # bounding_box.add([100, 200, -400], [700, 900, 800], [200, 400, 100]) 230 | # # This will return a point Point3d(700, 900, 800). 231 | # point = bounding_box.max 232 | # 233 | # @return [Geom::Point3d] The point where x, y, and z are the maximum in the 234 | # bounding box. 235 | def max 236 | end 237 | 238 | # Get the minimum point in the bounding box. 239 | # 240 | # @note If you attempt to call this method on an empty bounding box, you 241 | # will receive a point consisting of very large negative numbers. 242 | # 243 | # @example 244 | # bounding_box = Geom::BoundingBox.new 245 | # bounding_box.add([100, 200, -400], [700, 900, 800], [200, 400, 100]) 246 | # # This will return a point Point3d(100, 200, -400). 247 | # point = bounding_box.min 248 | # 249 | # @return [Geom::Point3d] The point where x, y, and z are the minimum in the 250 | # bounding box. 251 | def min 252 | end 253 | 254 | # Determine if the bounding box is valid (contains points). This method is 255 | # the opposite of the {#empty?} method. 256 | # 257 | # @example 258 | # bounding_box = Geom::BoundingBox.new 259 | # bounding_box.add([100, 200, -400], [200, 400, 100]) 260 | # # This will return true. 261 | # bounding_box.valid? 262 | # 263 | # @return [Boolean] +true+ if filled or +false+ if empty. 264 | def valid? 265 | end 266 | 267 | # Get the width of the bounding box. 268 | # 269 | # The width is returned in the currently set units (inches by default). 270 | # 271 | # @example 272 | # bounding_box = Geom::BoundingBox.new 273 | # bounding_box.add([100, 200, -400], [200, 400, 100]) 274 | # # This will return a Length of 100.0". 275 | # length = bounding_box.width 276 | # 277 | # @return [Length] The width of the bounding box in currently set units. 278 | def width 279 | end 280 | 281 | end # class BoundingBox 282 | end #module Geom 283 | -------------------------------------------------------------------------------- /lib/camera.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | # Accessed via {Sketchup::View#camera} or a {Sketchup::Page#camera} 3 | class Camera 4 | 5 | # Returns the aspect ratio of the camera. 6 | # @return [Float] 7 | def aspect_ratio 8 | return @ascpect_ratio 9 | end 10 | 11 | # Set the camera aspect ratio 12 | # @param [Float] aspect_ratio 13 | # @return [Float] aspect ratio 14 | def aspect_ratio=(aspect_ratio) 15 | @aspect_ratio = aspect_ratio 16 | end 17 | 18 | # @since SketchUp 2015 19 | # @return [Geom::Point3d] 20 | def center_2d 21 | end 22 | 23 | # @return [String] A description of the camera 24 | def description 25 | return @description 26 | end 27 | 28 | # @param [String] text A desription of the camera 29 | # @return [void] 30 | # @example 31 | # camera = Sketchup::Camera.new 32 | # description = camera.description = "35 mm Camera" 33 | def description=(text) 34 | @description = text 35 | end 36 | 37 | def direction 38 | end 39 | def eye 40 | end 41 | def focal_length 42 | end 43 | def focal_length= 44 | end 45 | def fov 46 | end 47 | def fov= 48 | end 49 | 50 | # @since SketchUp 2015 51 | def fov_is_height? 52 | end 53 | 54 | def height 55 | end 56 | def height= 57 | end 58 | 59 | # @since SketchUp 2015 60 | def is_2d? 61 | end 62 | 63 | def image_width 64 | end 65 | def image_width= 66 | end 67 | def new 68 | end 69 | def perspective= 70 | end 71 | def perspective? 72 | end 73 | 74 | # @since SketchUp 2015 75 | def scale_2d 76 | end 77 | 78 | def set 79 | end 80 | def target 81 | end 82 | def up 83 | end 84 | def xaxis 85 | end 86 | def yaxis 87 | end 88 | def zaxis 89 | end 90 | end 91 | end 92 | -------------------------------------------------------------------------------- /lib/classifications.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | # The Classifications class is a container/manager for all classifications in a model. 4 | class Classifications 5 | 6 | include Enumerable 7 | 8 | def [] 9 | end 10 | 11 | def length 12 | end 13 | 14 | def unload_schema 15 | end 16 | 17 | def each 18 | end 19 | 20 | def load_schema 21 | end 22 | 23 | def keys 24 | end 25 | 26 | def size 27 | end 28 | 29 | end 30 | 31 | end 32 | -------------------------------------------------------------------------------- /lib/classificationschema.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | class ClassificationSchema 4 | include Comparable 5 | 6 | def <=> 7 | end 8 | 9 | def name 10 | end 11 | 12 | def namespace 13 | end 14 | 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /lib/color.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Color 3 | def alpha 4 | end 5 | def alpha=(value) 6 | end 7 | def blend 8 | end 9 | def blue 10 | end 11 | def blue=(value) 12 | end 13 | def green 14 | end 15 | def green=(value) 16 | end 17 | def names 18 | end 19 | def self.new 20 | end 21 | def red 22 | end 23 | def red=(value) 24 | end 25 | def to_a 26 | end 27 | def to_i 28 | end 29 | def to_s 30 | end 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /lib/command.rb: -------------------------------------------------------------------------------- 1 | module UI 2 | # @since SketchUp 6 3 | class Command 4 | 5 | # @since SketchUp 8 M1 6 | def large_icon 7 | end 8 | 9 | # @since SketchUp 6 10 | # @since SketchUp 2016 - svg files supported 11 | def large_icon=(filename) 12 | end 13 | def menu_text 14 | end 15 | 16 | # @since SketchUp 6 17 | def menu_text=(string) 18 | end 19 | 20 | # @since SketchUp 6 21 | def self.new(menu_text, &block) 22 | end 23 | 24 | # @since SketchUp 6 25 | def set_validation_proc(&block) 26 | end 27 | 28 | # @since SketchUp 8 M1 29 | def small_icon 30 | end 31 | 32 | # @since SketchUp 6 33 | # @since SketchUp 2016 - svg files supported 34 | def small_icon=(filename) 35 | end 36 | 37 | # @since SketchUp 8 M1 38 | def status_bar_text 39 | end 40 | 41 | # @since SketchUp 6 42 | def status_bar_text=(string) 43 | end 44 | 45 | # @since SketchUp 8 M1 46 | def tooltip 47 | end 48 | 49 | # @since SketchUp 6 50 | def tooltip=(string) 51 | end 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /lib/comparable.rb: -------------------------------------------------------------------------------- 1 | # Appears to be a modified version of the {http://www.ruby-doc.org/core-1.8.6/Comparable.html Ruby Comparable} module which includes only a single method: between? 2 | module Comparable 3 | # @see http://www.ruby-doc.org/core-1.8.6/Comparable.html#method-i-between-3F 4 | def between?(min, max) 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /lib/componentdefinition.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class ComponentDefinition < Drawingelement 3 | include Comparable 4 | def <=> 5 | end 6 | def == 7 | end 8 | 9 | def add_classification 10 | end 11 | 12 | def add_observer 13 | end 14 | def behavior 15 | end 16 | def count_instances 17 | end 18 | 19 | # The count_used_instances method is used to count the total number of 20 | # component instances in a model using this component definition. This 21 | # method takes into account the full hierarchy of the model. 22 | # 23 | # @since SketchUp 2016 24 | # @return [Fixnum] the number of instances 25 | def count_used_instances 26 | count = 0 27 | return count 28 | end 29 | 30 | def description 31 | end 32 | def description= 33 | end 34 | def entities 35 | end 36 | 37 | def get_classification_value 38 | end 39 | 40 | def group? 41 | end 42 | def guid 43 | end 44 | def hidden? 45 | end 46 | def image? 47 | end 48 | def insertion_point 49 | end 50 | def insertion_point= 51 | end 52 | def instances 53 | end 54 | def internal? 55 | end 56 | def invalidate_bounds 57 | end 58 | def name 59 | end 60 | def name= 61 | end 62 | def path 63 | end 64 | def refresh_thumbnail 65 | end 66 | 67 | def remove_classification 68 | end 69 | 70 | def remove_observer 71 | end 72 | def save_as 73 | end 74 | def save_thumbnail 75 | end 76 | 77 | def set_classification_value 78 | end 79 | 80 | end 81 | end 82 | -------------------------------------------------------------------------------- /lib/componentinstance.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class ComponentInstance < Drawingelement 3 | def add_observer 4 | end 5 | def definition 6 | end 7 | def definition= 8 | end 9 | def explode 10 | end 11 | # @since 8.0 12 | def equals? 13 | end 14 | def glued_to 15 | end 16 | def glued_to= 17 | end 18 | 19 | # Returns a base 64 unique id for this object 20 | # @since Sketchup 2014 21 | # @return [String] 22 | def guid 23 | end 24 | 25 | def locked= 26 | end 27 | def locked? 28 | end 29 | def make_unique 30 | end 31 | def move! 32 | end 33 | def name 34 | end 35 | def name= 36 | end 37 | def remove_observer 38 | end 39 | def transform! 40 | end 41 | def transformation 42 | end 43 | def transformation= 44 | end 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /lib/console.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | # @since SketchUp 2014 4 | class Console 5 | 6 | def show 7 | end 8 | 9 | def hide 10 | end 11 | 12 | def clear 13 | end 14 | 15 | def visibe? 16 | end 17 | 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /lib/constants.rb: -------------------------------------------------------------------------------- 1 | # Geometry 2 | 3 | ORIGIN = Geom::Point3d.new(0, 0, 0) 4 | X_AXIS = Geom::Vector3d.new(1, 0, 0) 5 | Y_AXIS = Geom::Vector3d.new(0, 1, 0) 6 | Z_AXIS = Geom::Vector3d.new(0, 0, 1) 7 | IDENTITY = Geom::Transformation.new 8 | 9 | 10 | # StatusBar Locations 11 | 12 | SB_PROMPT = 0 13 | SB_VCB_LABEL = 1 14 | SB_VCB_VALUE = 2 15 | 16 | 17 | # Messagebox Types 18 | 19 | MB_ABORTRETRYIGNORE = 2 20 | MB_MULTILINE = 16 21 | MB_OK = 0 22 | MB_OKCANCEL = 1 23 | MB_RETRYCANCEL = 5 24 | MB_YESNO = 4 25 | MB_YESNOCANCEL = 3 26 | 27 | 28 | # Messagebox Return Values 29 | 30 | IDABORT = 3 31 | IDCANCEL = 2 32 | IDIGNORE = 5 33 | IDNO = 7 34 | IDOK = 1 35 | IDRETRY = 4 36 | IDYES = 6 37 | 38 | 39 | # Toolbar Visibility States 40 | 41 | TB_HIDDEN = 0 42 | TB_NEVER_SHOWN = -1 43 | TB_VISIBLE = 1 44 | 45 | 46 | # Tool Key Modifiers 47 | 48 | ALT_MODIFIER_KEY = 18 49 | ALT_MODIFIER_MASK = 32 50 | CONSTRAIN_MODIFIER_KEY = 16 51 | CONSTRAIN_MODIFIER_MASK = 4 52 | COPY_MODIFIER_KEY = 17 53 | COPY_MODIFIER_MASK = 8 54 | 55 | 56 | # Tool Mouse and Key 57 | 58 | MK_ALT = 32 59 | MK_COMMAND = 0 60 | MK_CONTROL = 8 61 | MK_LBUTTON = 1 62 | MK_MBUTTON = 16 63 | MK_RBUTTON = 2 64 | MK_SHIFT = 4 65 | 66 | 67 | # Tool Keys 68 | 69 | VK_ALT = 18 70 | VK_COMMAND = 18 71 | VK_CONTROL = 17 72 | VK_DELETE = 46 73 | VK_DOWN = 40 74 | VK_END = 35 75 | VK_HOME = 36 76 | VK_INSERT = 45 77 | VK_LEFT = 37 78 | VK_MENU = 18 79 | VK_NEXT = 34 80 | VK_PRIOR = 33 81 | VK_RIGHT = 39 82 | VK_SHIFT = 16 83 | VK_SPACE = 32 84 | VK_UP = 38 85 | 86 | 87 | # Text Alignment 88 | 89 | TextAlignCenter = 1 90 | TextAlignLeft = 0 91 | TextAlignRight = 2 92 | 93 | 94 | # Text Leader States 95 | 96 | ALeaderModel = 2 97 | ALeaderNone = 0 98 | ALeaderView = 1 99 | 100 | 101 | # Texture Writer (?) 102 | 103 | FILE_WRITE_FAILED_INVALID_TYPE = 1 104 | FILE_WRITE_FAILED_UNKNOWN = 2 105 | FILE_WRITE_OK = 0 106 | 107 | 108 | # View.draw Modes 109 | 110 | GL_LINES = 1 111 | GL_LINE_LOOP = 2 112 | GL_LINE_STRIP = 3 113 | GL_POINTS = 0 114 | GL_POLYGON = 9 115 | GL_QUADS = 7 116 | GL_QUAD_STRIP = 8 117 | GL_TRIANGLES = 4 118 | GL_TRIANGLE_FAN = 6 119 | GL_TRIANGLE_STRIP = 5 120 | 121 | 122 | # Layer Visibility 123 | 124 | LAYER_HIDDEN_BY_DEFAULT = 1 125 | LAYER_IS_HIDDEN_ON_NEW_PAGES = 32 126 | LAYER_IS_VISIBLE_ON_NEW_PAGES = 16 127 | LAYER_USES_DEFAULT_VISIBILITY_ON_NEW_PAGES = 0 128 | LAYER_VISIBLE_BY_DEFAULT = 0 129 | 130 | 131 | # Menu States 132 | 133 | MF_CHECKED = 8 134 | MF_DISABLED = 2 135 | MF_ENABLED = 0 136 | MF_GRAYED = 1 137 | MF_UNCHECKED = 0 138 | 139 | 140 | # Page 141 | 142 | PAGE_NO_CAMERA = 4094 143 | PAGE_USE_ALL = 4095 144 | PAGE_USE_CAMERA = 1 145 | PAGE_USE_HIDDEN = 16 146 | PAGE_USE_LAYER_VISIBILITY = 32 147 | PAGE_USE_RENDERING_OPTIONS = 2 148 | PAGE_USE_SECTION_PLANES = 64 149 | PAGE_USE_SHADOWINFO = 4 150 | PAGE_USE_SKETCHCS = 8 151 | 152 | 153 | # Glue-To States 154 | 155 | SnapTo_Arbitrary = 0 156 | SnapTo_Horizontal = 1 157 | SnapTo_Sloped = 3 158 | SnapTo_Vertical = 2 159 | -------------------------------------------------------------------------------- /lib/constructionline.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class ConstructionLine < Drawingelement 3 | def direction 4 | end 5 | def direction= 6 | end 7 | def end 8 | end 9 | def end= 10 | end 11 | def position 12 | end 13 | def position= 14 | end 15 | def reverse! 16 | end 17 | def start 18 | end 19 | def start= 20 | end 21 | def stipple 22 | end 23 | def stipple= 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /lib/constructionpoint.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | # @since 6.0 3 | class ConstructionPoint < Drawingelement 4 | 5 | # @private 6 | def initialize(pt = [0, 0, 0]) 7 | @position = Geom::Point3d.new(pt) 8 | end 9 | 10 | # @example 11 | # pt = Sketchup.active_model.entities.add_cpoint([1, 1, 0]) 12 | # pos = pt.position 13 | # 14 | # @return [Point3d] 15 | # 16 | def position 17 | @position 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /lib/curve.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Curve < Entity 3 | def count_edges 4 | end 5 | def each_edge 6 | end 7 | def edges 8 | end 9 | def first_edge 10 | end 11 | def last_edge 12 | end 13 | def length 14 | end 15 | def move_vertices 16 | end 17 | def vertices 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /lib/definitionlist.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class DefinitionList < Entity 3 | include Enumerable 4 | def [] 5 | end 6 | def add 7 | end 8 | def add_observer 9 | end 10 | def at 11 | end 12 | 13 | # @since SketchUp 2014 this is inherited from [Enumerable] 14 | def count 15 | end 16 | def each 17 | end 18 | def length 19 | end 20 | def load 21 | end 22 | def load_from_url 23 | end 24 | def purge_unused 25 | end 26 | def remove_observer 27 | end 28 | def unique_name 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /lib/definitionobserver.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class DefinitionObserver < EntityObserver 3 | def onComponentInstanceAdded 4 | end 5 | def onComponentInstanceRemoved 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /lib/definitionsobserver.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class DefinitionsObserver 3 | def onComponentAdded 4 | end 5 | def onComponentPropertiesChanged 6 | end 7 | def onComponentRemoved 8 | end 9 | def onComponentTypeChanged 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /lib/dimension.rb: -------------------------------------------------------------------------------- 1 | 2 | module Sketchup 3 | 4 | # @since SketchUp 2014 5 | class Dimension 6 | def add_observer 7 | end 8 | def arrow_type 9 | end 10 | def arrow_type= 11 | end 12 | def has_aligned_text= 13 | end 14 | def has_aligned_text? 15 | end 16 | def plane 17 | end 18 | def remove_observer 19 | end 20 | def text 21 | end 22 | def text= 23 | end 24 | 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /lib/dimension_linear.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | # @since Sketchup 2014 4 | class DimensionLinear < Dimension 5 | 6 | ALIGNED_TEXT_ABOVE = '?' 7 | ALIGNED_TEXT_CENTER = '?' 8 | ALIGNED_TEXT_OUTSIDE = '?' 9 | 10 | def aligned_text_position 11 | end 12 | def aligned_text_position= 13 | end 14 | def end 15 | end 16 | def end= 17 | end 18 | def offset_vector 19 | end 20 | def offset_vector= 21 | end 22 | def start 23 | end 24 | def start= 25 | end 26 | def text_position 27 | end 28 | def text_position= 29 | end 30 | 31 | end 32 | end 33 | 34 | -------------------------------------------------------------------------------- /lib/dimension_observer.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | # @since SketchUp 2014 4 | class DimensionObserver 5 | 6 | # @param [Dimension] 7 | def onTextChanged(dimension) 8 | end 9 | 10 | end 11 | 12 | end 13 | 14 | -------------------------------------------------------------------------------- /lib/dimension_radial.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | class DimensionRadial < Dimension 4 | 5 | def arc_curve 6 | end 7 | 8 | def arc_curve= 9 | end 10 | 11 | def leader_break_point 12 | end 13 | 14 | def leader_break_point= 15 | end 16 | 17 | def leader_points 18 | end 19 | 20 | end 21 | 22 | end 23 | -------------------------------------------------------------------------------- /lib/drawingelement.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Drawingelement < Entity 3 | 4 | # @return [Geom::BoundingBox] 5 | def bounds 6 | end 7 | def casts_shadows= 8 | end 9 | def casts_shadows? 10 | end 11 | def erase! 12 | end 13 | def hidden= 14 | end 15 | def hidden? 16 | end 17 | 18 | # @return [Layer] 19 | def layer 20 | end 21 | def layer= 22 | end 23 | 24 | # @return [Material] or nil if default material. 25 | def material 26 | end 27 | def material= 28 | end 29 | def receives_shadows= 30 | end 31 | def receives_shadows? 32 | end 33 | def visible= 34 | end 35 | def visible? 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /lib/edge.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Edge < Drawingelement 3 | 4 | # @private 5 | def initialize(pt1, pt2) 6 | end 7 | 8 | # @example 9 | # model = Sketchup.active_model 10 | # edge = model.selection[0] 11 | # ents = edge.all_connected 12 | # ==> [, #, #, #, #] 13 | # 14 | # @return [Array] an array of the edge and its connected entities. 15 | def all_connected 16 | end 17 | 18 | # @param [Sketchup::Edge] edge 19 | # 20 | # @return [Sketchup::Face, Nil] 21 | def common_face(edge) 22 | end 23 | 24 | # @return [Sketchup::Curve, Sketchup::ArcCurve, Nil] 25 | def curve 26 | end 27 | 28 | # @return [Sketchup::Vertex] 29 | def end 30 | end 31 | 32 | # @return [Sketchup::Edge] 33 | def explode_curve 34 | end 35 | 36 | # @return [Array] 37 | def faces 38 | end 39 | 40 | # @return [Integer] 41 | def find_faces 42 | end 43 | 44 | # @return [Length] 45 | def length 46 | end 47 | 48 | # @return [Array(Geom::Point3d, Geom::Vector3d)] 49 | def line 50 | end 51 | 52 | # @param [Sketchup::Edge] edge 53 | # 54 | # @return [Sketchup::Vertex] 55 | def other_vertex(edge) 56 | end 57 | 58 | # @param [Sketchup::Face] face 59 | # 60 | # @return [Boolean] 61 | def reversed_in?(face) 62 | end 63 | 64 | # @param [Boolean] value 65 | # 66 | # @return [Boolean] 67 | def smooth=(value) 68 | end 69 | 70 | # @return [Boolean] 71 | def smooth? 72 | end 73 | 74 | # @param [Boolean] value 75 | # 76 | # @return [Boolean] 77 | def soft=(value) 78 | end 79 | 80 | # @return [Boolean] 81 | def soft? 82 | end 83 | 84 | # @param [Geom::Point3d] point 85 | # 86 | # @param [Sketchup::Edge, Nil] 87 | def split(point) 88 | end 89 | 90 | # @return [Sketchup::Vertex] 91 | def start 92 | end 93 | 94 | # @param [Sketchup::Edge, Sketchup::Vertex] edge_or_vertex 95 | # 96 | # @return [Boolean] 97 | def used_by?(edge_or_vertex) 98 | end 99 | 100 | # @return [Array] 101 | def vertices 102 | end 103 | 104 | end 105 | end 106 | -------------------------------------------------------------------------------- /lib/edgeuse.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class EdgeUse < Entity 3 | def edge 4 | end 5 | def end_vertex_normal 6 | end 7 | def face 8 | end 9 | def loop 10 | end 11 | def next 12 | end 13 | def partners 14 | end 15 | def previous 16 | end 17 | def reversed? 18 | end 19 | def start_vertex_normal 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /lib/entities.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | class Entities 4 | 5 | include Enumerable 6 | 7 | # @private 8 | def initialize 9 | #@model = Sketchup::Model.new 10 | @list = [] 11 | end 12 | 13 | # @private 14 | def inspect 15 | @list.to_s 16 | end 17 | # @private 18 | def empty? 19 | @list.empty? 20 | end 21 | 22 | def [](o) 23 | end 24 | 25 | # Added in 2014 26 | #Entities.active_section_plane 27 | #Entities.active_section_plane= 28 | #Entities.add_dimension_linear 29 | #Entities.add_dimension_radial 30 | #Entities.add_section_plane 31 | #Entities.size 32 | 33 | # @since SketchUp 2014 34 | # @return [SectionPlane] 35 | def active_section_plane 36 | end 37 | 38 | # @since SketchUp 2014 39 | def active_section_plane=(section_plane) 40 | end 41 | 42 | # @since SketchUp 2014 43 | def add_dimension_linear(dim_start, dim_end, offset_vector) 44 | end 45 | 46 | # @since SketchUp 2014 47 | def add_dimension_radial(arc_curve, leader_break_point) 48 | end 49 | 50 | # @since SketchUp 2014 51 | def add_section_plane(*args) 52 | end 53 | 54 | # @since SketchUp 2014 55 | # alias_method :size, :length 56 | # @see #length 57 | def size 58 | end 59 | 60 | def add_3d_text(string, alignment, font, bold = false, italic = false, 61 | letter_height = nil, tolerance = 0.0, z = nil, 62 | filled = true, extrusion = 0.0) 63 | end 64 | def add_arc(center, xaxis, normal, radius, start_angle, end_angle, segments = 12) 65 | end 66 | def add_circle(center, normal, radius, segments = 24) 67 | end 68 | def add_cline(line_Start, line_end, stipple = '') 69 | end 70 | 71 | def add_cpoint(point) 72 | pt = Sketchup::ConstructionPoint.new(pt) 73 | @list.push(pt) 74 | return(pt) 75 | end 76 | 77 | def add_curve(*args) 78 | end 79 | 80 | # Accepts list of Point3ds or Array of Point3ds 81 | # 82 | # @param [Geom::Point3d, Geom::Point3d, ...] 83 | # @param [Array] 84 | # 85 | # @return [Array] if successful 86 | def add_edges(*args) 87 | edges = [] 88 | len = args.length 89 | (len-1).times {|i| 90 | edge = Edge.new(args[i], args[i+1]) 91 | edges.push(edge) 92 | } 93 | @list.concat(edges) 94 | return(edges) 95 | end 96 | def add_face(*args) 97 | end 98 | def add_faces_from_mesh(mesh) 99 | end 100 | def add_group(*args) 101 | end 102 | def add_image(filename, position, width, height = nil) 103 | end 104 | def add_instance(definition, transformation) 105 | end 106 | 107 | # Adds an Edge to the Entities collection 108 | # 109 | # @example 110 | # model = Sketchup.active_model 111 | # ents = model.entities 112 | # edge = ents.add_line(ORIGIN, [1, 1, 0]) 113 | # 114 | # @param pt1 {Geom::Point3d} 115 | # @param pt2 [Geom::Point3d] 116 | # 117 | # @return [Sketchup::Edge] ege 118 | # 119 | def add_line(*args) 120 | end 121 | 122 | def add_ngon(center, normal, radius, segments) 123 | end 124 | def add_observer(observer) 125 | end 126 | def add_text(text, position, vector = nil) 127 | end 128 | def at(index) 129 | end 130 | def clear! 131 | end 132 | 133 | # @since SketchUp 2014 @see Enumberable#count 134 | def count 135 | end 136 | 137 | def each 138 | end 139 | def erase_entities(*args) 140 | end 141 | def fill_from_mesh(mesh, weld = nil, 142 | smooth = AUTO_SOFTEN | SMOOTH_SOFT_EDGES, 143 | front_material = nil, back_material = nil) 144 | end 145 | def intersect_with(recurse, transform1, entities1, transform2, hidden, entities2) 146 | end 147 | def length 148 | end 149 | 150 | def model 151 | end 152 | def parent 153 | end 154 | def remove_observer(observer) 155 | end 156 | def transform_by_vectors(entities, vectors) 157 | end 158 | def transform_entities(transformation, entities) 159 | end 160 | end 161 | end 162 | -------------------------------------------------------------------------------- /lib/entitiesobserver.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class EntitiesObserver 3 | 4 | # @since SketchUp 2014 5 | # @return nil 6 | def onActiveSectionPlaneChanged(entities) 7 | return nil 8 | end 9 | 10 | def onContentsModified 11 | end 12 | def onElementAdded 13 | end 14 | def onElementRemoved 15 | end 16 | def onEraseEntities 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /lib/entity.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Entity 3 | 4 | # @param [EntityObserver] entity_observer 5 | # @return [Boolean] 6 | def add_observer(entity_observer) 7 | end 8 | def attribute_dictionaries 9 | end 10 | def attribute_dictionary 11 | end 12 | def delete_attribute 13 | end 14 | def deleted? 15 | end 16 | 17 | # @since 2006 18 | # The ID is not persistent between sessions. 19 | # @since 2014 20 | # Groups and ComponentInstances are persistent. 21 | # @return [Fixnum] 22 | def entityID 23 | end 24 | 25 | def get_attribute 26 | end 27 | 28 | # Returns the Model of the receiver 29 | # @example 30 | # model = face.model 31 | # @return [Sketchup::Model] the Model of the entity 32 | def model 33 | end 34 | def parent 35 | end 36 | # @param [ModelObserver] model_observer a instance of a model observer 37 | def remove_observer(model_observer) 38 | end 39 | 40 | # Sets the value of an attibute in an AtrtributeDictonary 41 | # @param dict_name [String] the name of te AttributeDictionary 42 | # @param key [String] 43 | # @param value 44 | # Alowable values are: 45 | # true, false, [Length], [Integer], [Float], [String], [Array] 46 | # [Color], [Time], [Point3d], [Vector3d] 47 | def set_attribute(dict_name, key, value) 48 | end 49 | 50 | def to_s 51 | end 52 | def typename 53 | end 54 | def valid? 55 | end 56 | end 57 | end 58 | -------------------------------------------------------------------------------- /lib/entityobserver.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | # Attached to an {Entity} using the {Entity#add_observer} method 3 | # @abstract 4 | # This is an abstract class - you need to over-write 5 | # the methods in your code. 6 | # 7 | # @example 8 | # # use a Ruby module as a namespace to avoid conflicts 9 | # module Namespace 10 | # # Define a new observer class 11 | # class MyEntityObserver < Sketchup::EntityObserver 12 | # def onChangeEntity(entity) 13 | # end 14 | # def onEraseEntity(entity) 15 | # end 16 | # end 17 | # end 18 | # # Create a reference to a new observer (if it needs to be removed later.) 19 | # my_ent_obs = MyEntityObserver.new 20 | # # Attach the observer to a Group 21 | # grp.add_observer(my_ent_obs) 22 | # # ...Later, remove the observer 23 | # grp.remove_observer(my_ent_observer) 24 | # 25 | # 26 | class EntityObserver 27 | 28 | # @param [Entity] entity 29 | # @return [nil] 30 | def onChangeEntity(entity) 31 | end 32 | 33 | # @param [Entity] entity 34 | # @return [nil] 35 | def onEraseEntity(entity) 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /lib/extensionlicense.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | module Licensing 3 | 4 | class ExtensionLicense 5 | 6 | # @return [Integer] number of days 7 | def days_remaining 8 | end 9 | 10 | # @return [String] error description 11 | def error_description 12 | end 13 | 14 | def licensed? 15 | end 16 | 17 | # @return state a constant defined in the Licensing namespace 18 | # 19 | # * {Sketchup::Licensing::LICENSED} 20 | # * {Sketchup::Licensing::EXPIRED} 21 | # * {Sketchup::Licensing::TRIAL} 22 | # * {Sketchup::Licensing::TRIAL_EXPIRED} 23 | # * {Sketchup::Licensing::NOT_LICENSED} 24 | def state 25 | state = Sketchup::Licensing::NOT_LICENSED 26 | return state 27 | end 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /lib/extensionsmanager.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | # @since SketchUp 8.0 M2 4 | class ExtensionsManager 5 | 6 | include Enumerable 7 | 8 | # @return [SketchupExtension] 9 | # @overload [] Integer 10 | # @param [Integer] n 11 | # @overload [](String) 12 | def [] 13 | end 14 | 15 | def each 16 | end 17 | 18 | # The keys method is used to get a list of keys in the ExtensionsManager, which are the same as the names of the extensions. 19 | # @return [Array] an Array of Strings 20 | def keys 21 | end 22 | 23 | # @return [Number] 24 | def size 25 | end 26 | 27 | private 28 | def intitialize 29 | end 30 | 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /lib/face.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Face < Drawingelement 3 | 4 | PointUnknown = 0 5 | PointInside = 1 6 | PointOnVertex = 2 7 | PointOnEdge = 4 8 | PointOnFace = 8 9 | PointOutside = 16 10 | PointNotOnPlane = 32 11 | 12 | # @since SketchUp 2014 13 | # @return [Vector3d] 14 | # @param [Boolean] use_front_side 15 | def get_texture_projection(use_front_side) 16 | end 17 | 18 | 19 | # @since SketchUp 2014 20 | # @param [Vector3d] vector 21 | # @param [Boolean] use_front_side 22 | # @return true or false 23 | def set_texture_projection(vector, use_front_side) 24 | end 25 | 26 | 27 | def all_connected 28 | end 29 | def area 30 | end 31 | def back_material 32 | end 33 | def back_material=(material) 34 | end 35 | def classify_point(point) 36 | end 37 | def edges 38 | end 39 | def followme 40 | end 41 | def get_UVHelper 42 | end 43 | def get_glued_instances 44 | end 45 | def loops 46 | end 47 | def material 48 | end 49 | def material= 50 | end 51 | 52 | # @return [Geom::PolygonMesh] 53 | def mesh(flags = Geom::PolygonMesh::PolygonMeshPoints) 54 | end 55 | 56 | def normal 57 | end 58 | def outer_loop 59 | end 60 | def plane 61 | end 62 | 63 | # @param [Sketchup::Material] material 64 | # @param [Array] mapping 65 | # @param [Boolean] front 66 | def position_material(material, mapping, front) 67 | end 68 | def pushpull 69 | end 70 | def reverse! 71 | end 72 | def vertices 73 | end 74 | end 75 | end 76 | -------------------------------------------------------------------------------- /lib/framechangeobserver.rb: -------------------------------------------------------------------------------- 1 | # @abstract 2 | class FrameChangeObserver 3 | def frameChange 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /lib/geom.rb: -------------------------------------------------------------------------------- 1 | module Geom 2 | 3 | # @param [Array] line1 4 | # @param [Array] line2 5 | # 6 | # @return [Array(Geom::Point3d, Geom::Point3d)] 7 | def self.closest_points(line1, line2) 8 | end 9 | 10 | 11 | # @param [Array] points 12 | # 13 | # @return [Array(Geom::Point3d, Geom::Point3d)] 14 | def self.fit_plane_to_points(*points) 15 | end 16 | 17 | # @param [Array] line1 18 | # @param [Array] line2 19 | # 20 | # @return [Geom::Point3d, Nil] 21 | def self.intersect_line_line 22 | end 23 | 24 | # @param [Array] line 25 | # @param [Array] plane 26 | # 27 | # @return [Geom::Point3d, Nil] 28 | def self.intersect_line_plane(line, plane) 29 | end 30 | 31 | # @param [Array] plane1 32 | # @param [Array] plane2 33 | # 34 | # @return [Geom::Point3d, Nil] 35 | def self.intersect_plane_plane(plane1, plane2) 36 | end 37 | 38 | # @overload linear_combination(weight1, point1, weight2, point2) 39 | # @param [Numeric] weight1 40 | # @param [Geom::Point3d] point1 41 | # @param [Numeric] weight2 42 | # @param [Geom::Point3d] point2 43 | # 44 | # @return [Geom::Point3d] 45 | # 46 | # @overload linear_combination(weight1, vector1, weight2, vector2) 47 | # @param [Numeric] weight1 48 | # @param [Geom::Vector3d] vector1 49 | # @param [Numeric] weight2 50 | # @param [Geom::Vector3d] vector2 51 | # 52 | # @return [Geom::Vector3d] 53 | def self.linear_combination(weight1, point1, weight2, point2) 54 | end 55 | 56 | # @param [Geom::Point3d] point 57 | # @param [Array] polygon 58 | # @param [Boolean] border 59 | # 60 | # @return [Boolean] 61 | def self.point_in_polygon_2D(point, polygon, border) 62 | end 63 | 64 | end 65 | -------------------------------------------------------------------------------- /lib/group.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Group < Drawingelement 3 | 4 | # @since SketchUp 2014 5 | # @return [String] unique_id 6 | def guid 7 | end 8 | 9 | def add_observer 10 | end 11 | def copy 12 | end 13 | 14 | # @since SketchUp 2015 15 | # @return [ComponentDefinition] 16 | def definition 17 | end 18 | 19 | def description 20 | end 21 | def description= 22 | end 23 | def entities 24 | end 25 | def explode 26 | end 27 | def local_bounds 28 | end 29 | def locked= 30 | end 31 | def locked? 32 | end 33 | def make_unique 34 | end 35 | def move! 36 | end 37 | def name 38 | end 39 | def name= 40 | end 41 | def remove_observer 42 | end 43 | def to_component 44 | end 45 | def transform! 46 | end 47 | def transformation 48 | end 49 | def transformation= 50 | end 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /lib/hlr.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | # @deprecated Undocumented Class 3 | class HLR 4 | def calculate 5 | end 6 | def cleanup 7 | end 8 | def num_faces 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /lib/image.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Image < Drawingelement 3 | def explode 4 | end 5 | def height 6 | end 7 | def height= 8 | end 9 | def normal 10 | end 11 | def origin 12 | end 13 | def origin= 14 | end 15 | def path 16 | end 17 | def pixelheight 18 | end 19 | def pixelwidth 20 | end 21 | def size= 22 | end 23 | 24 | # @since SketchUp 2014 25 | def transformation 26 | end 27 | 28 | # @since SketchUp 2014 29 | def transformation= 30 | end 31 | 32 | def transform! 33 | end 34 | def width 35 | end 36 | def width= 37 | end 38 | def zrotation 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /lib/importer.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Importer 3 | 4 | ImportSuccess = 0 5 | ImportFail = 1 6 | ImportCanceled = 2 7 | ImporterNotFound = 3 8 | ImportFileNotFound = 4 9 | 10 | def description 11 | end 12 | 13 | def do_options 14 | end 15 | 16 | def file_extension 17 | end 18 | 19 | def id 20 | end 21 | 22 | def load_file 23 | end 24 | 25 | def supports_options? 26 | end 27 | 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /lib/inputpoint.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class InputPoint 3 | def == 4 | end 5 | def clear 6 | end 7 | def copy!(input_point) 8 | end 9 | def degrees_of_freedom 10 | end 11 | def depth 12 | end 13 | def display? 14 | end 15 | def draw(view) 16 | end 17 | def edge 18 | end 19 | def face 20 | end 21 | def new(point_or_vertex) 22 | end 23 | def pick(view, x, y, input_point = nil) 24 | end 25 | def position 26 | end 27 | def tooltip 28 | end 29 | def transformation 30 | end 31 | def valid? 32 | end 33 | def vertex 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/instanceobserver.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class InstanceObserver < EntityObserver 3 | def onClose 4 | end 5 | def onOpen 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /lib/language_handler.rb: -------------------------------------------------------------------------------- 1 | # @since SketchUp 2014 2 | 3 | class LanguageHandler 4 | 5 | # @private 6 | def initialize 7 | end 8 | private :initialize 9 | 10 | # @params [String] file name 11 | # @return [LanguageHandler] 12 | def new(file_name) 13 | initialize 14 | end 15 | 16 | def [](key) 17 | end 18 | 19 | def resource_path 20 | end 21 | 22 | # @return [Hash] 23 | def strings 24 | end 25 | 26 | end 27 | -------------------------------------------------------------------------------- /lib/latlong.rb: -------------------------------------------------------------------------------- 1 | module Geom 2 | class LatLong 3 | def latitude 4 | end 5 | def longitude 6 | end 7 | def new 8 | end 9 | def to_a 10 | end 11 | def to_s 12 | end 13 | def to_utm 14 | end 15 | end 16 | end # module Geom 17 | -------------------------------------------------------------------------------- /lib/layer.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Layer < Entity 3 | include Comparable 4 | def <=> 5 | end 6 | def == 7 | end 8 | 9 | # @since SketchUp 2014 10 | def color 11 | end 12 | 13 | # @since SketchUp 2014 14 | def color= 15 | end 16 | 17 | # @since SketchUp 2014 18 | def size 19 | end 20 | 21 | def name 22 | end 23 | def name= 24 | end 25 | def page_behavior 26 | end 27 | def page_behavior= 28 | end 29 | def visible= 30 | end 31 | def visible? 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/layers.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Layers < Entity 3 | include Enumerable 4 | def [] 5 | end 6 | def add 7 | end 8 | def add_observer 9 | end 10 | def at 11 | end 12 | def count 13 | end 14 | def each 15 | end 16 | def length 17 | end 18 | def purge_unused 19 | end 20 | 21 | # @since SketchUp 2015 22 | # @param layer a {Layer}, layer name, or index number 23 | def remove(layer) 24 | end 25 | 26 | def remove_observer 27 | end 28 | def unique_name 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /lib/layersobserver.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class LayersObserver 3 | def onCurrentLayerChanged 4 | end 5 | def onLayerAdded 6 | end 7 | 8 | # @since SketchUp 2014 9 | # @return [Layer] 10 | def onlayerChanged(layers) 11 | end 12 | 13 | def onLayerRemoved 14 | end 15 | def onRemoveAllLayers 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /lib/length.rb: -------------------------------------------------------------------------------- 1 | class Length 2 | 3 | Inches = 0 4 | Feet = 1 5 | Millimeter = 2 6 | Centimeter = 3 7 | Meter = 4 8 | 9 | def < 10 | end 11 | def <= 12 | end 13 | def <=> 14 | end 15 | def == 16 | end 17 | def > 18 | end 19 | def >= 20 | end 21 | def inspect 22 | end 23 | def to_f 24 | end 25 | def to_s 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /lib/licensing.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | module Licensing 4 | LICENSED = 0 5 | EXPIRED = 1 6 | TRIAL = 2 7 | TRIAL_EXPIRED = 3 8 | NOT_LICENSED = 4 9 | 10 | # @param [String] UUID 11 | # @return [ExtensionLicense] 12 | def self.get_extension_license(extension_id) 13 | 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /lib/loadhandler.rb: -------------------------------------------------------------------------------- 1 | # @abstract 2 | class LoadHandler 3 | def cancelled? 4 | end 5 | def onFailure 6 | end 7 | def onPercentChange 8 | end 9 | def onSuccess 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /lib/loop.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Loop < Entity 3 | def convex? 4 | end 5 | def edges 6 | end 7 | def edgeuses 8 | end 9 | def face 10 | end 11 | def outer? 12 | end 13 | def vertices 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /lib/material.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Material < Entity 3 | 4 | include Comparable 5 | 6 | MATERIAL_SOLID = 0 7 | MATERIAL_TEXTURED = 1 8 | MATERIAL_COLORIZED_TEXTURED = 2 9 | 10 | def <=> 11 | end 12 | def == 13 | end 14 | def alpha 15 | end 16 | def alpha= 17 | end 18 | 19 | # @return [Sketchup::Color] the Color of the Material 20 | # @note The alpha value is always 255. 21 | # If you want the alpha, use {Material#alpha} 22 | def color 23 | end 24 | 25 | def color= 26 | end 27 | 28 | # @since SketchUp 2015 29 | # @return [Array] 30 | def colorize_deltas 31 | end 32 | 33 | def colorize_type 34 | end 35 | 36 | def colorize_type= 37 | end 38 | 39 | def display_name 40 | end 41 | def materialType 42 | end 43 | def name 44 | end 45 | def texture 46 | end 47 | def texture= 48 | end 49 | def use_alpha? 50 | end 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /lib/materials.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | class Materials < Entity 4 | 5 | include Enumerable 6 | 7 | def [] 8 | end 9 | def add 10 | end 11 | def add_observer 12 | end 13 | def at 14 | end 15 | def count 16 | end 17 | def current 18 | end 19 | def current= 20 | end 21 | def each 22 | end 23 | def length 24 | end 25 | def purge_unused 26 | end 27 | def remove_observer 28 | end 29 | 30 | # @since SketchUp 2014 31 | def size 32 | end 33 | 34 | end 35 | 36 | end 37 | -------------------------------------------------------------------------------- /lib/materialsobserver.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | # This observer interface is implemented to react to {Material}s events. 4 | # To implement this observer, create a Ruby class of this type, override the 5 | # desired methods, and add an instance of the observer to the objects of 6 | # interest. The callback onMaterialRemoveAll has been deprecated, we 7 | # recommend using onMaterialRemove instead. 8 | # 9 | # @example 10 | # # This is an example of an observer that watches the materials collection 11 | # # for new materials and shows a messagebox. 12 | # class MyMaterialsObserver < Sketchup::MaterialsObserver 13 | # def onMaterialAdd(materials, material) 14 | # UI.messagebox("onMaterialAdd: " + material.to_s) 15 | # end 16 | # end 17 | # 18 | # # Attach the observer. 19 | # Sketchup.active_model.materials.add_observer(MyMaterialsObserver.new) 20 | # 21 | # @see http://www.sketchup.com/intl/en/developer/docs/ourdoc/materialsobserver MaterialsObserver Docs 22 | # 23 | # @since SketchUp 6.0 24 | class MaterialsObserver 25 | 26 | # The onMaterialAdd method is invoked whenever a {Material} is added. 27 | # 28 | # @example 29 | # def onMaterialAdd(materials, material) 30 | # UI.messagebox("onMaterialAdd: " + material.to_s) 31 | # end 32 | # 33 | # @param [Sketchup::Materials] materials The materials collection 34 | # to which the new material has been added. 35 | # 36 | # @param [Sketchup::Material] material The newly added material. 37 | # 38 | # @return [nil] 39 | # 40 | # @since SketchUp 6 41 | def onMaterialAdd(materials, material) 42 | end 43 | 44 | # The onMaterialChange method is invoked whenever a {Material}'s texture 45 | # image is altered. 46 | # 47 | # @example 48 | # def onMaterialChange(materials, material) 49 | # UI.messagebox("onMaterialChange: " + material.to_s) 50 | # end 51 | # 52 | # @param [Sketchup::Materials] materials The materials collection 53 | # to which the changed material belongs. 54 | # 55 | # @param [Sketchup::Material] material The changed material. 56 | # 57 | # @return [nil] 58 | # 59 | # @since SketchUp 6 60 | def onMaterialChange(materials, material) 61 | end 62 | 63 | # The onMaterialRefChange method is invoked whenever the number of entities 64 | # that a material is painted on changes. This could be due to the user 65 | # manually painting something, but it could also be when faces are split, 66 | # pasted, push-pulled, deleted, etc. 67 | # 68 | # @example 69 | # def onMaterialRefChange(materials, material) 70 | # UI.messagebox("onMaterialRefChange: " + material.to_s) 71 | # end 72 | # 73 | # @param [Sketchup::Materials] materials The materials collection 74 | # to which the changed material belongs. 75 | # 76 | # @param [Sketchup::Material] material The changed material. 77 | # 78 | # @return [nil] 79 | # 80 | # @since SketchUp 6 81 | def onMaterialRefChange(materials, material) 82 | end 83 | 84 | # The onMaterialRemove method is invoked whenever a {Material} is deleted. 85 | # 86 | # @example 87 | # def onMaterialRemove(materials, material) 88 | # UI.messagebox("onMaterialRemove: " + material.to_s) 89 | # end 90 | # 91 | # @param [Sketchup::Materials] materials The materials collection 92 | # from which the material was removed. 93 | # 94 | # @param [Sketchup::Material] material The removed material. 95 | # 96 | # @return [nil] 97 | # 98 | # @since SketchUp 6 99 | def onMaterialRemove(materials, material) 100 | end 101 | 102 | # @deprecated 103 | def onMaterialRemoveAll 104 | end 105 | 106 | # The onMaterialSetCurrent method is invoked whenever a different {Material} 107 | # is selected in the Materials dialog. 108 | # 109 | # @example 110 | # def onMaterialSetCurrent(materials, material) 111 | # UI.messagebox("onMaterialSetCurrent: " + material.to_s) 112 | # end 113 | # 114 | # @param [Sketchup::Materials, nil] materials The materials collection 115 | # to which the newly selected material belongs. If the selected material is 116 | # not yet used in the Model (like from default Material Libraries), nil is 117 | # passed instead. 118 | # 119 | # @param [Sketchup::Material] material The newly selected material. 120 | # 121 | # @return [nil] 122 | # 123 | # @since SketchUp 6 124 | def onMaterialSetCurrent(materials, material) 125 | end 126 | 127 | # The onMaterialUndoRedo method is invoked whenever a material is altered 128 | # and then those changes are undone or redone. 129 | # 130 | # @note Due to a bug, this callback does not fire in SU6 or SU7. You can use 131 | # the ModelObserver.onTransactionStart to capture all undo events. 132 | # 133 | # @example 134 | # def onMaterialUndoRedo(materials, material) 135 | # UI.messagebox("onMaterialUndoRedo: " + material.to_s) 136 | # end 137 | # 138 | # @param [Sketchup::Materials] materials The materials collection 139 | # to which the modified material belongs. 140 | # 141 | # @param [Sketchup::Material] material The modified material. 142 | # 143 | # @return [nil] 144 | def onMaterialUndoRedo(materials, material) 145 | end 146 | 147 | end 148 | end 149 | -------------------------------------------------------------------------------- /lib/menu.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Menu 3 | # add_item may take 2 forms. 4 | # 5 | # @overload add_item(menu_item) 6 | # @param [String] menu_item the name of the menu item, or a UI::Command object. 7 | # @example 8 | # menu = UI.menu("Plugins") 9 | # menu_id = menu.add_item("Calculate Area"} { calc_area } 10 | # 11 | # @overload add_item(command) 12 | # @param [UI::Command] command a UI::Command object 13 | # @example 14 | # menu = UI.menu("Plugins") 15 | # cmd = UI::Command.new("Calculate Area") { calc_area } 16 | # menu_id = menu.add_item(cmd) 17 | # 18 | # @return [menu_id] a unique numeric id number 19 | 20 | def add_item(item) 21 | end 22 | 23 | def add_separator 24 | end 25 | def add_submenu(menu_name) 26 | end 27 | def set_validation_proc(item, &block) 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /lib/model.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | # This is the access point for many common Sketchup objects 3 | class Model 4 | 5 | # Sketchup::Model.constants.each { |n| 6 | # puts "#{n} = #{Sketchup::Model.const_get(n)}" 7 | # } 8 | 9 | VERSION_3 = 3 10 | VERSION_4 = 4 11 | VERSION_5 = 5 12 | VERSION_6 = 6 13 | VERSION_7 = 7 14 | VERSION_8 = 8 15 | VERSION_2013 = 9 16 | VERSION_2014 = 10 17 | VERSION_2015 = 11 18 | 19 | # @private 20 | def initialize 21 | # These collections may also depend on the template... 22 | @entities = Sketchup::Entities.new 23 | #@layers = Sketchup::Layers.new 24 | #@materials = Sketchup::Materials.new 25 | #@definitions = Sketchup::DefinitionList.new 26 | #@options = Sketchup::OptionsManager.new 27 | #@pages = Sketchup::Pages.new 28 | #@styles = Sketchup::Styles.new 29 | #@selection = Sketchup::Selection.new 30 | end 31 | 32 | # @private 33 | #def inspect 34 | #self 35 | #end 36 | 37 | def abort_operation 38 | end 39 | 40 | # @return [Sketchup::Entities] 41 | def active_entities 42 | end 43 | 44 | # @return [Sketchup::Layer] 45 | def active_layer 46 | end 47 | 48 | # @param [Layer] layer 49 | def active_layer=(layer) 50 | end 51 | 52 | def active_path 53 | end 54 | 55 | # @return [View] 56 | def active_view 57 | end 58 | def add_note 59 | end 60 | def add_observer 61 | end 62 | def attribute_dictionaries 63 | end 64 | def attribute_dictionary 65 | end 66 | def behavior 67 | end 68 | 69 | # @return [BoundingBox] 70 | def bounds 71 | end 72 | 73 | def classifications 74 | end 75 | 76 | # @since 2015 77 | def close(ignore_changes = false) 78 | nil 79 | end 80 | 81 | def close_active 82 | end 83 | def commit_operation 84 | end 85 | 86 | # @return [DefinitionList] 87 | def definitions 88 | end 89 | def description 90 | end 91 | def description= 92 | end 93 | def edit_transform 94 | end 95 | 96 | # Returns a reference to the active_model's top-level entities collection. 97 | # @return [Entities] collection 98 | # @see active_entities 99 | def entities 100 | @entities 101 | end 102 | 103 | # @note Exporting a model actually saves a copy of the model, 104 | # and subsequently triggers the `onSaveModel` method of any [ModelObserver] 105 | # 106 | # @note PDF export ability added in SketchUp 2016 107 | # 108 | # @see 109 | # http://stackoverflow.com/questions/32246092/onsavemodel-observer-in-ruby-sketchup-causes-infinite-loop#comment52404566_32256862 110 | # The way exporters work, SketchUp will first save a temporary copy of the model and pass that temp skp file path to the exporter. That's why onSaveModel triggers during an export. The resulting infinite loop would certainly be nasty :-) – Bugra Barin Aug 28 '15 at 2:40 111 | def export 112 | end 113 | 114 | # Finds and returns entities by their entityID or GUID. 115 | def find_entity_by_id(id_list_or_array) 116 | end 117 | 118 | # @see set_attribute 119 | def get_attribute 120 | end 121 | 122 | def get_datum 123 | end 124 | def get_product_family 125 | end 126 | def guid 127 | end 128 | def import 129 | end 130 | def latlong_to_point 131 | end 132 | 133 | # @return [Layers] 134 | def layers 135 | @layers 136 | end 137 | 138 | def list_datums 139 | end 140 | 141 | # @return [Materials] 142 | def materials 143 | @materials 144 | end 145 | 146 | def mipmapping= 147 | end 148 | def mipmapping? 149 | end 150 | def modified? 151 | end 152 | 153 | # The model name, or "" if model as not been saved. 154 | # @return [String] 155 | def name 156 | end 157 | 158 | def name= 159 | end 160 | def options 161 | @options 162 | end 163 | 164 | # @return a reference to the model's Pages (Scenes) collection. 165 | def pages 166 | @pages 167 | end 168 | 169 | def path 170 | end 171 | def place_component 172 | end 173 | def point_to_latlong 174 | end 175 | def point_to_utm 176 | end 177 | def raytest 178 | end 179 | def remove_observer 180 | end 181 | 182 | # @return [RenderingOptions] 183 | def rendering_options 184 | end 185 | def save 186 | end 187 | 188 | # @since SketchUp 2014 189 | def save_copy 190 | end 191 | 192 | def save_thumbnail 193 | end 194 | def select_tool 195 | end 196 | 197 | # @return a collection of selected Entity objects 198 | def selection 199 | @selection 200 | end 201 | 202 | # @see Model#get_attribute 203 | def set_attribute 204 | end 205 | 206 | def set_datum 207 | end 208 | 209 | # @return [ShadowInfo] object 210 | def shadow_info 211 | end 212 | 213 | # The start_operation method is used to notify Edit > Undo that a new operation (which can be undone) is starting. 214 | # 215 | # @overload start_operation(op_name) 216 | # @since SketchUp 6.0 217 | # @param [String] op_name the name which appears 218 | # 219 | # @overload start_operation(op_name [,disable_ui, transparent, prev_trans]) 220 | # @since SketchUp 7.0 221 | # @param [String] op_name optional the name which appears 222 | # @param [optional, true/false] disable_ui user interface changes are suppressed. 223 | # @param [Boolean] transparent 224 | # @param [Boolean] prev_trans 225 | # 226 | # @return [bool] true if successful, false if not. 227 | def start_operation(op_name, disable_ui = false, next_transparent = false, previous_transparent = false) 228 | end 229 | 230 | def styles 231 | end 232 | def tags 233 | end 234 | def tags= 235 | end 236 | 237 | # The name of the model 238 | # @return [String] model name 239 | def title 240 | end 241 | 242 | def tools 243 | end 244 | def utm_to_point 245 | end 246 | def valid? 247 | end 248 | end 249 | end 250 | -------------------------------------------------------------------------------- /lib/modelobserver.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class ModelObserver 3 | def onActivePathChanged 4 | end 5 | def onAfterComponentSaveAs 6 | end 7 | def onBeforeComponentSaveAs 8 | end 9 | def onDeleteModel 10 | end 11 | def onEraseAll 12 | end 13 | def onExplode 14 | end 15 | def onPlaceComponent 16 | end 17 | def onSaveModel 18 | end 19 | def onTransactionAbort 20 | end 21 | def onTransactionCommit 22 | end 23 | def onTransactionEmpty 24 | end 25 | def onTransactionRedo 26 | end 27 | def onTransactionStart 28 | end 29 | def onTransactionUndo 30 | end 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /lib/numeric.rb: -------------------------------------------------------------------------------- 1 | class Numeric 2 | def cm 3 | end 4 | def degrees 5 | end 6 | def feet 7 | end 8 | def inch 9 | end 10 | def km 11 | end 12 | def m 13 | end 14 | def mile 15 | end 16 | def mm 17 | end 18 | def radians 19 | end 20 | def to_cm 21 | end 22 | def to_feet 23 | end 24 | def to_inch 25 | end 26 | def to_km 27 | end 28 | def to_l 29 | end 30 | def to_m 31 | end 32 | def to_mile 33 | end 34 | def to_mm 35 | end 36 | def to_yard 37 | end 38 | def yard 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /lib/object.rb: -------------------------------------------------------------------------------- 1 | class Object 2 | ORIGIN = Geom::Point3d.new(0, 0, 0) 3 | X_AXIS = Geom::Vector3d.new(1, 0, 0) 4 | Y_AXIS = Geom::Vector3d.new(0, 1, 0) 5 | Z_AXIS = Geom::Vector3d.new(0, 0, 1) 6 | 7 | SB_PROMPT = 0 8 | 9 | SB_VCB_LABEL = 1 10 | 11 | SB_VCB_VALue = 2 12 | end -------------------------------------------------------------------------------- /lib/optionsmanager.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class OptionsManager 3 | include Enumerable 4 | def [] 5 | end 6 | def count 7 | end 8 | def each 9 | end 10 | def keys 11 | end 12 | 13 | # @since SketchUp 2014 14 | def length 15 | end 16 | 17 | def size 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /lib/optionsprovider.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class OptionsProvider 3 | include Enumerable 4 | def [] 5 | end 6 | def []= 7 | end 8 | def add_observer 9 | end 10 | def count 11 | end 12 | def each 13 | end 14 | def each_key 15 | end 16 | def each_pair 17 | end 18 | def each_value 19 | end 20 | def has_key? 21 | end 22 | def key? 23 | end 24 | def keys 25 | end 26 | 27 | # @since SketchUp 2014 28 | def length 29 | end 30 | 31 | def name 32 | end 33 | def remove_observer 34 | end 35 | def size 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /lib/optionsproviderobserver.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class OptionsProviderObserver 3 | def onOptionsProviderChanged 4 | end 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /lib/page.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Page < Entity 3 | 4 | def initialize 5 | @delay_time = -1 6 | end 7 | private :initialize 8 | 9 | # Returns the {Sketchup::Camera} for the Page 10 | # @return [Camera] 11 | def camera 12 | end 13 | 14 | # @return [Float] seconds the delay time in seconds 15 | def delay_time 16 | end 17 | 18 | # @return [Float] 19 | def delay_time= 20 | end 21 | 22 | # @return [String] description The Scene description from the Scenes dialog 23 | def description 24 | end 25 | 26 | # Set the Scene description 27 | # @return [String] description The Scene description from the Scenes dialog 28 | def description= 29 | end 30 | 31 | # @return [Array] ary and array of hidden entities. Objects 32 | # on hidden Layers are not considered hidden in this context. 33 | def hidden_entities 34 | end 35 | 36 | # @return [String] 37 | def label 38 | end 39 | 40 | # @return [Array] ary an Array of non-visible Layer entities. 41 | def layers 42 | end 43 | 44 | # @return [String] the name from the Scene tab 45 | def name 46 | end 47 | 48 | # @return [String] 49 | def name= 50 | end 51 | 52 | # @return [RenderingOptions] a Rendering Options object for the Scene 53 | def rendering_options 54 | end 55 | 56 | # Set the visibilty of a Layer for the Scene 57 | # @param [Layer] layer 58 | # @param [Boolean] visibilty 59 | # @return [Page] 60 | def set_visibility(layer, visibility) 61 | end 62 | 63 | # Returns the shadow info object for the Scene 64 | # @return [ShadowInfo] or nil 65 | def shadow_info 66 | end 67 | 68 | def style 69 | end 70 | 71 | def transition_time 72 | end 73 | 74 | def transition_time= 75 | end 76 | 77 | def update 78 | end 79 | 80 | def use_axes= 81 | end 82 | 83 | def use_axes? 84 | end 85 | 86 | def use_camera= 87 | end 88 | 89 | def use_camera? 90 | end 91 | 92 | def use_hidden= 93 | end 94 | 95 | def use_hidden? 96 | end 97 | 98 | def use_hidden_layers= 99 | end 100 | 101 | def use_hidden_layers? 102 | end 103 | 104 | def use_rendering_options= 105 | end 106 | 107 | def use_rendering_options? 108 | end 109 | 110 | def use_section_planes= 111 | end 112 | 113 | def use_section_planes? 114 | end 115 | 116 | def use_shadow_info= 117 | end 118 | 119 | def use_shadow_info? 120 | end 121 | 122 | def use_style= 123 | end 124 | 125 | def use_style? 126 | end 127 | end 128 | end 129 | -------------------------------------------------------------------------------- /lib/pages.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Pages < Entity 3 | include Enumerable 4 | def [] 5 | end 6 | def add 7 | end 8 | def add_frame_change_observer 9 | end 10 | def add_matchphoto_page 11 | end 12 | def add_observer 13 | end 14 | def count 15 | end 16 | def each 17 | end 18 | def erase 19 | end 20 | 21 | # @since SketchUp 2014 22 | def length 23 | end 24 | 25 | def parent 26 | end 27 | def remove_frame_change_observer 28 | end 29 | def remove_observer 30 | end 31 | def selected_page 32 | end 33 | def selected_page= 34 | end 35 | def show_frame_at 36 | end 37 | def size 38 | end 39 | def slideshow_time 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /lib/pagesobserver.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class PagesObserver < EntitiesObserver 3 | def onContentsModified 4 | end 5 | def onElementAdded 6 | end 7 | def onElementRemoved 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /lib/pickhelper.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | # @since SketchUp 6 4 | class PickHelper 5 | 6 | def all_picked 7 | end 8 | def best_picked 9 | end 10 | 11 | # @since SketchUp 2016 12 | # @return [Integer] the number of Entity objects picked 13 | def boundingbox_pick(bounding_box, pick_type, transformtion = nil) 14 | end 15 | 16 | def count 17 | end 18 | def depth_at 19 | end 20 | def do_pick 21 | end 22 | def element_at 23 | end 24 | def init 25 | end 26 | def leaf_at 27 | end 28 | def path_at 29 | end 30 | def pick_segment 31 | end 32 | def picked_edge 33 | end 34 | def picked_element 35 | end 36 | def picked_face 37 | end 38 | def test_point 39 | end 40 | def transformation_at 41 | end 42 | def view 43 | end 44 | 45 | # @since SketchUp 2016 46 | # @return [Integer] number of entities picked 47 | def window_pick(start_point, end_point, pick_type) 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /lib/point3d.rb: -------------------------------------------------------------------------------- 1 | module Geom 2 | class Point3d 3 | 4 | # Creates a new 3D point. 5 | # @overload initialize() 6 | # Creates a point at the origin with all coordinates set to zero. 7 | # @overload initialize(point) 8 | # @param [Geom::Point3d] point another point 9 | # @overload initialize(array) 10 | # @param [Array] array an array of two or three coordinates 11 | # @overload initialize(x, y, z=0.0) 12 | # @param [Numeric] x the x coordinate 13 | # @param [Numeric] y the y coordinate 14 | # @param [Numeric] z the z coordinate 15 | def initialize(*args) 16 | end 17 | 18 | # Returns a new point which is offset from the receiver by the given vector. 19 | # @example 20 | # pt = Geom::Point3d.new(1, 2, 3) 21 | # pt2 = pt + [1, 1, 1] 22 | # ==> Point3d(2, 3, 4) 23 | # @param [Geom::Vector3d] vector a Vector3d or Array used to offset the point 24 | # @return [Geom::Point3d] 25 | # @since SketchUp 6.0 26 | def +(vector) 27 | end 28 | 29 | # Subtracts from this point. 30 | # @overload -(vector) 31 | # Returns a point that is offset from this point in the opposite direction of the given vector. 32 | # @param [Geom::Vector3d,Array] vector 33 | # @return [Geom::Point3d] 34 | # @overload -(point2) 35 | # Returns a vector from another point to this point. 36 | # @param [Geom::Point3d] point2 37 | # @return [Geom::Vector3d] 38 | def -(vector) 39 | end 40 | 41 | # Compare two points coordinate by coordinate. First the x coordinates are compared, if they are equal, the y 42 | # coordinates are compared, if those are equal finally the z coordinates. 43 | # @param [Geom::Point3d,Array] point2 44 | # @return [Boolean] true if this point's x, y or z coordinate is less 45 | # @example 46 | # pt1 = Geom::Point3d.new(10, 10, 90) 47 | # pt2 = Geom::Point3d.new(10, 20, 20) 48 | # pt1 < pt2 # ==> true 49 | def < (point2) 50 | end 51 | 52 | # Compare {Point3d}s using SketchUp tolerance. 53 | # @params [Geom::Point3d,Array] point2 54 | # @return [Boolean] 55 | def ==(point2) 56 | end 57 | 58 | # Retrieves the coordinate of the point at the specified index. 59 | # @param [Integer] index The index 0, 1 or 2 for a specific x, y, or z value within the point. 60 | # @return [Numeric] The coordinate at the specified index. 61 | # @raise IndexError Raised if the index is outside the range [0,2]. Note that negative indices [-3,-1] don't raise. 62 | def [](index) 63 | end 64 | 65 | # Retrieves the coordinate of the point at the specified index. 66 | # @param [Integer] index The index 0, 1 or 2 for a specific x, y, or z value within the point. 67 | # @param [Numeric] value The new x, y or z value. 68 | # @return [Numeric] The argument passed for the new value. 69 | # @raise IndexError Raised if the index is outside the range [0,2]. Note that negative indices [-3,-1] don't raise. 70 | def []=(index, value) 71 | end 72 | 73 | # Creates another point identical to the point being cloned. 74 | # @return [Geom::Point3d] A new point that is a copy of this one. 75 | def clone 76 | end 77 | 78 | # Compute the distance from this point to another point. 79 | # @param [Geom::Point3d,Array] point2 The Point3d object to compute the distance to. 80 | # @return [Length] The distance as length object. 81 | def distance(point2) 82 | end 83 | 84 | # Computes the distance from this point to a line. 85 | # @param [Array(Geom::Point3d,Geom::Vector3d),Array(Geom::Point3d,Geom::Point3d)] line 86 | # @return [Length] The distance as length object. 87 | def distance_to_line(line) 88 | end 89 | 90 | # Computes the distance from this point to a plane. 91 | # @param [Array(Geom::Point3d,Geom::Vector3d),Array] plane 92 | # @return [Length] The distance as length object. 93 | def distance_to_plane(plane) 94 | end 95 | 96 | # Returns a string containing a human-readable representation of this point. 97 | # @return [String] A string representation of the point 98 | def inspect 99 | end 100 | 101 | # Creates a new point as a linear combination of two points. This method is generally used to get a point at some 102 | # percentage along a line connecting the two points. The weights should sum up to 1 if you want to get a on that 103 | # line. The weights should be between 0 and 1 if you want to get a point between the two points. 104 | # @param [Numeric] weight1 The weight of point1. 105 | # @param [Geom::Point3d,Array] point1 106 | # @param [Numeric] weight2 The weight of point2. 107 | # @param [Geom::Point3d,Array] point2 108 | # @return [Geom::Point3d] 109 | def self.linear_combination(weight1, point1, weight2, point2) 110 | end 111 | 112 | # Offsets a point by a vector and returns a new point. The length of the vector must not be zero. 113 | # @param [Geom::Vector3d,Array] vector A vector providing direction and distance to offset the point by. 114 | # @param [Numeric] length The distance to offset. If not provided, the offset is equal to the vector length. 115 | # @return [Geom::Point3d] a new Point3d object 116 | def offset(vector, length=vector.length) 117 | end 118 | 119 | # Applies an offset by a vector to this point. The length of the vector must not be zero. 120 | # @param [Geom::Vector3d,Array] vector A vector providing direction and distance to offset the point by. 121 | # @param [Numeric] length The distance to offset. If not provided, the offset is equal to the vector length. 122 | # @return [self] 123 | def offset!(vector, length=vector.length) 124 | end 125 | 126 | # Determines if this point is on a line. 127 | # @param [Array(Geom::Point3d,Geom::Vector3d),Array(Geom::Point3d,Geom::Point3d)] line 128 | # @return [Boolean] true if the point is on the line; false if the point is not on the line 129 | def on_line?(line) 130 | end 131 | 132 | # Determines if this point is on a plane. 133 | # @param [Array(Geom::Point3d,Geom::Vector3d),Array] plane 134 | # @return [Boolean] true if the point is on the plane; false if the point is not on the plane 135 | def on_plane?(plane) 136 | end 137 | 138 | # Retrieves the point on a line that is closest to this point. 139 | # @param [Array(Geom::Point3d,Geom::Vector3d),Array(Geom::Point3d,Geom::Point3d)] line 140 | # @return [Geom::Point3d] A new point that is on a line closest to the point 141 | def project_to_line 142 | end 143 | 144 | # Retrieves the point on a plane that is closest to this point. 145 | # @param [Array(Geom::Point3d,Geom::Vector3d),Array] plane 146 | # @return [Geom::Point3d] A new point that is on a plane closest to the point 147 | def project_to_plane 148 | end 149 | 150 | # Sets the values of this point. 151 | # @param [Numeric] x The location along the x axis. 152 | # @param [Numeric] y The location along the y axis. If not given, this coordinate is not modified. 153 | # @param [Numeric] z The location along the z axis. If not given, this coordinate is not modified. 154 | # @return [self] 155 | def set!(x, y=self.x, z=self.y) 156 | end 157 | 158 | # Returns an array representation of this point. 159 | # @return [Array(Length,Length,Length)] An array containing its x, y, z coordinates 160 | def to_a 161 | end 162 | 163 | # Returns a string representation of this point. 164 | # @return [String] A string of this point in the current model units, using the user's locale's decimal delimiter. 165 | def to_s 166 | end 167 | 168 | # Applies a transformation to a copy this point to create a new point. 169 | # @param [Geom::Transformation] transformation A Transformation object. 170 | # @return [Geom::Point3d] The new point 171 | def transform(transformation) 172 | end 173 | 174 | # Applies a transformation to this point. 175 | # Unlike the {#transform} method, the point itself is modified. 176 | # @param [Geom::Transformation] transformation A Transformation object. 177 | # @return [self] 178 | def transform!(transformation) 179 | end 180 | 181 | # Creates a vector between this point and another point. 182 | # @param [Geom::Point3d,Array] point2 The other point 183 | # @return [Geom::Vector3d] 184 | def vector_to(point2) 185 | end 186 | 187 | # Retrieves the x coordinate of this point. 188 | # @return [Length] 189 | def x 190 | end 191 | 192 | # Sets the x value of this point. 193 | # @param [Numeric] value The new x coordinate. 194 | # @return [Numeric] The argument passed for the new value. 195 | def x=(value) 196 | end 197 | 198 | # Retrieves the y coordinate of this point. 199 | # @return [Length] 200 | def y 201 | end 202 | 203 | # Sets the y value of this point. 204 | # @param [Numeric] value The new y coordinate. 205 | # @return [Numeric] The argument passed for the new value. 206 | def y=(value) 207 | end 208 | 209 | # Retrieves the z coordinate of this point. 210 | # @return [Length] 211 | def z 212 | end 213 | 214 | # Sets the z value of this point. 215 | # @param [Numeric] value The new z coordinate. 216 | # @return [Numeric] The argument passed for the new value. 217 | def z=(value) 218 | end 219 | 220 | end 221 | end 222 | -------------------------------------------------------------------------------- /lib/polygonmesh.rb: -------------------------------------------------------------------------------- 1 | module Geom 2 | class PolygonMesh 3 | 4 | NO_SMOOTH_OR_HIDE = 0 5 | HIDE_BASED_ON_INDEX = 1 # (Negative point index will hide the edge.) 6 | SOFTEN_BASED_ON_INDEX = 2 # (Negative point index will soften the edge.) 7 | AUTO_SOFTEN = 4 # (Interior edges are softened.) 8 | SMOOTH_SOFT_EDGES = 8 # (All soft edges will also be smooth.) 9 | 10 | def add_point 11 | end 12 | def add_polygon 13 | end 14 | def count_points 15 | end 16 | def count_polygons 17 | end 18 | def new 19 | end 20 | def normal_at 21 | end 22 | def point_at 23 | end 24 | def point_index 25 | end 26 | def points 27 | end 28 | def polygon_at 29 | end 30 | def polygon_points_at 31 | end 32 | def polygons 33 | end 34 | def set_point 35 | end 36 | 37 | # @param [Integer] index 38 | # @param [Geom::Point3d] uv 39 | # @param [Boolean] front 40 | # 41 | # @since SketchUp 2014 42 | def set_uv(index, uv, front) 43 | end 44 | 45 | def transform! 46 | end 47 | 48 | # @param [Integer] index 49 | # @param [Boolean] front 50 | # 51 | # @return [Geom::Point3d] 52 | def uv_at(index, front) 53 | end 54 | 55 | def uvs 56 | end 57 | 58 | end # class PolygonMesh 59 | end # module Geom 60 | -------------------------------------------------------------------------------- /lib/renderingoptions.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | class RenderingOptions < Entity 4 | 5 | include Enumerable 6 | 7 | ROPAssign = 0 8 | ROPSetRenderMode = 1 9 | ROPSetTransparencyObsolete = 2 10 | ROPSetTexture = 3 11 | ROPSetEdgeDisplayMode = 4 12 | ROPSetEdgeColorMode = 5 13 | ROPSetJitterEdges = 6 14 | ROPSetExtendEdges = 7 15 | ROPSetProfileEdges = 8 16 | ROPSetProfileWidth = 9 17 | ROPSetFaceColorMode = 10 18 | ROPSetDisplayInstanceAxes = 11 19 | ROPSetBackgroundColor = 12 20 | ROPSetForegroundColor = 13 21 | ROPSetHighlightColor = 14 22 | ROPSetConstructionColor = 15 23 | ROPSetDisplayColorByLayer = 16 24 | ROPSetExtendLines = 17 25 | ROPSetLineExtension = 18 26 | ROPSetDisplayFog = 19 27 | ROPSetFogColor = 22 28 | ROPSetFogDist = 23 29 | ROPSetFogHint = 24 30 | ROPSetSectionDisplayMode = 25 31 | ROPDrawHidden = 27 32 | ROPEditComponent = 28 33 | ROPTransparencySortMethod = 29 34 | ROPSetDepthQueEdges = 30 35 | ROPSetLineEndEdges = 31 36 | ROPSetDepthQueWidth = 32 37 | ROPSetLineEndWidth = 33 38 | ROPSetProfilesOnlyEdges = 34 39 | ROPSetLockedColor = 35 40 | ROPSetDisplaySketchAxes = 36 41 | ROPSetFaceColor = 37 42 | ROPSetEdgeType = 38 43 | ROPSetModelTransparency = 39 44 | ROPSetMaterialTransparency = 40 45 | ROPSetSectionActiveColor = 41 46 | ROPSetSectionInactiveColor = 42 47 | ROPSetSectionDefaultCutColor = 43 48 | ROPSetSectionCutWidth = 44 49 | ROPSetHideConstructionGeometry = 45 50 | ROPSetSkyColor = 46 51 | ROPSetGroundColor = 47 52 | ROPSetDrawHorizon = 48 53 | ROPSetDrawGround = 49 54 | ROPSetDrawUnderground = 50 55 | ROPSetGroundTransparency = 51 56 | ROPSetDisplayText = 52 57 | ROPSetDisplayDims = 53 58 | ROPSetFogUseBkColor = 54 59 | 60 | def [] 61 | end 62 | def []= 63 | end 64 | def add_observer 65 | end 66 | def each 67 | end 68 | def each_key 69 | end 70 | def each_pair 71 | end 72 | def keys 73 | end 74 | def remove_observer 75 | end 76 | 77 | # @since SketchUp 2014 78 | def count 79 | end 80 | 81 | 82 | # @since SketchUp 2014 83 | def length 84 | end 85 | 86 | # @since SketchUp 2014 87 | def size 88 | end 89 | 90 | end 91 | 92 | end 93 | 94 | -------------------------------------------------------------------------------- /lib/renderingoptionsobserver.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class RenderingOptionsObserver 3 | def onRenderingOptionsChanged 4 | end 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /lib/sectionplane.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | class SectionPlane < Drawingelement 4 | 5 | # @since SketchUp 2014 6 | def activate 7 | end 8 | 9 | # @since SketchUp 2014 10 | def active? 11 | end 12 | 13 | def get_plane 14 | end 15 | 16 | def set_plane 17 | end 18 | 19 | end 20 | 21 | end 22 | -------------------------------------------------------------------------------- /lib/selection.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Selection 3 | include Enumerable 4 | def [] 5 | end 6 | def add(*args) 7 | end 8 | def add_observer(observer) 9 | end 10 | def at(index) 11 | end 12 | def clear 13 | end 14 | def contains?(entity) 15 | end 16 | def count 17 | end 18 | def each 19 | end 20 | def empty? 21 | end 22 | def first 23 | end 24 | def include?(entity) 25 | end 26 | def is_curve? 27 | end 28 | def is_surface? 29 | end 30 | 31 | def length 32 | end 33 | alias_method :size, :length 34 | 35 | def model 36 | end 37 | def nitems 38 | end 39 | def remove(*args) 40 | end 41 | def remove_observer(observer) 42 | end 43 | def shift 44 | end 45 | def single_object? 46 | end 47 | 48 | def toggle(*args) 49 | end 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /lib/selectionobserver.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class SelectionObserver 3 | def onSelectionAdded 4 | end 5 | def onSelectionBulkChange 6 | end 7 | def onSelectionCleared 8 | end 9 | def onSelectionRemoved 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /lib/set.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Set 3 | def clear 4 | end 5 | def contains?(object) 6 | end 7 | def delete(object) 8 | end 9 | def each 10 | end 11 | def empty? 12 | end 13 | def include?(object) 14 | end 15 | def insert(object) 16 | end 17 | def length 18 | end 19 | def new 20 | end 21 | def size 22 | end 23 | def to_a 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /lib/shadow_info.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | class ShadowInfo < Entity 4 | 5 | include Enumerable 6 | 7 | 8 | # @since SketchUp2014 9 | def length 10 | end 11 | alias_method :size, :length 12 | 13 | def [] 14 | end 15 | def []= 16 | end 17 | def add_observer 18 | end 19 | def each 20 | end 21 | def each_key 22 | end 23 | def each_pair 24 | end 25 | def keys 26 | end 27 | def remove_observer 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /lib/shadowinfoobserver.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class ShadowInfoObserver 3 | def onShadowInfoChanged 4 | end 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /lib/sketchup.rb: -------------------------------------------------------------------------------- 1 | # 2 | # The Sketchup module namespace contains methods that might be considered "application" level methods. 3 | # The "entry-point" to most plugins. 4 | # 5 | 6 | module Sketchup 7 | 8 | # _The_ model! 9 | # 10 | # @example 11 | # model = Sketchup.active_model 12 | # 13 | # @return [Model] the current active model. 14 | # @note On Windows, there is only a single active model. 15 | # Since the Mac version of SketchUp 16 | # can have multiple models open, this returns the currently focused model. 17 | # 18 | def self.active_model 19 | if @model.class != Sketchup::Model 20 | @model = Sketchup::Model.new 21 | end 22 | end 23 | 24 | # Attaches an {AppObserver} to the current SketchUp Application. You should retain a 25 | # reference to the observer if you need to {remove_observer remove} it at a later time. 26 | # 27 | # @example 28 | # app_observer = AppObserver.new 29 | # status = Sketchup.add_observer(app_observer) 30 | # 31 | # @param [AppObserver] an instance of an AppObserver 32 | # 33 | # @return status true if successful, false if not. 34 | # 35 | # @see #remove_observer 36 | # 37 | def self.add_observer(app_observer) 38 | end 39 | 40 | def self.app_name 41 | end 42 | 43 | # When enabled (true): 44 | # 45 | # * Ruby Console now warns about Ruby operations left open. Leaving 46 | # operations open is typically a bad practice. We are warning developers 47 | # that they should try to find a different way of doing what they want to do. 48 | # * Ruby Console now warns when a user tries to create a nested operation. 49 | # Starting a new operation while one is still open is a bad practice. We 50 | # would like developers to be more aware that they are doing this so that 51 | # they can fix their code. 52 | # 53 | # @param [Boolean] mode true or false 54 | # @return [Boolean] mode 55 | # @since SketchUp 2016 56 | # 57 | def self.debug_mode=(mode) 58 | @debug_mode = mode 59 | end 60 | 61 | # @since SketchUp 2016 62 | # @return [Boolean] 63 | def self.debug_mode? 64 | @debug_mode 65 | end 66 | 67 | def self.break_edges= 68 | end 69 | def self.break_edges? 70 | end 71 | def self.create_texture_writer 72 | end 73 | def self.display_name_from_action 74 | end 75 | 76 | # @since SketchUp 8.0 M2 77 | # @return [ExtensionsManager] 78 | # @see https://developers.google.com/sketchup/docs/ourdoc/sketchup#extensions 79 | # @see https://developers.google.com/sketchup/docs/ourdoc/extensionsmanager 80 | def self.extensions 81 | end 82 | 83 | def self.file_new 84 | end 85 | def self.find_support_file 86 | end 87 | def self.find_support_files 88 | end 89 | def self.format_angle 90 | end 91 | def self.format_area 92 | end 93 | def self.format_degrees 94 | end 95 | def self.format_length 96 | end 97 | def self.get_datfile_info 98 | end 99 | def self.get_i18ndatfile_info 100 | end 101 | def self.get_locale 102 | end 103 | def self.get_resource_path 104 | end 105 | def self.get_shortcuts 106 | end 107 | # Installs the contents of a ZIP archive file into SketchUp's Plugins folder. If the ZIP contains subfolders, these will be preserved. 108 | # @since SketchUp 8.0 M2 109 | # @return [ExtensionManager] 110 | def self.install_from_archive(path) 111 | 112 | end 113 | 114 | # @since 2015 115 | def self.is_64bit? 116 | end 117 | 118 | def self.is_online 119 | end 120 | def self.is_pro? 121 | end 122 | def self.is_valid_filename? 123 | end 124 | 125 | # Loads both encrypted (.rbs) and non-encrypted Ruby files. 126 | # @example 127 | # status = Sketchup.load("C:/cool_plugins.rbs") 128 | # 129 | # @param [String] file path to a file 130 | # @return [Boolean] true if successful, otherwise false 131 | def self.load(file) 132 | end 133 | def self.open_file 134 | end 135 | def self.os_language 136 | end 137 | def self.parse_length 138 | end 139 | 140 | # @since SketchUp 2014 141 | def self.platform 142 | end 143 | 144 | # @since SketchUp 8.0 M2 145 | # @param [Boolean] true_or_false true or false 146 | def self.plugins_disabled=(true_or_false) 147 | end 148 | # @since SketchUp 8.0 M2 149 | def self.plugins_disabled? 150 | end 151 | 152 | # @since SketchUp 2014 153 | def self.quit 154 | end 155 | 156 | # @see write_default 157 | def self.read_default 158 | end 159 | 160 | def self.register_extension(extension, load_on_start) 161 | end 162 | 163 | def self.register_importer 164 | end 165 | 166 | # Removes an attached {AppObserver} 167 | # 168 | # @example 169 | # status = Sketchup.remove_observer(app_observer) 170 | # 171 | # @param [AppObserver] app_observer a reference to a AppObserver instance. 172 | # 173 | # @return [Boolean] status true if successful, false if not. 174 | def self.remove_observer(app_observer) 175 | end 176 | 177 | def self.require(filename) 178 | end 179 | 180 | def self.save_thumbnail(filename) 181 | end 182 | 183 | def self.send_action 184 | end 185 | 186 | # Display a message in SketchUp's Status Bar or VCB value or label. 187 | # @param [String] text the text to display in the staus bar. 188 | # @param position (optional) one of: 189 | # SB_PROMPT 190 | # SB_VCB_LABEL 191 | # SB_VCB_VALUE 192 | # @return [Boolean] true if successful, false if not. 193 | def self.set_status_text(text, position) 194 | end 195 | 196 | # @see set_status_text 197 | # @param [String] text the text to display in the staus bar. 198 | # @return [Boolean] true if successful, false if not. 199 | def self.status_text=(text) 200 | end 201 | 202 | # @since SketchUp 2014 203 | def self.temp_dir 204 | end 205 | 206 | def self.template 207 | end 208 | def self.template= 209 | end 210 | def self.template_dir 211 | end 212 | def self.undo 213 | end 214 | 215 | # Sets the label for the VCB, more recently known as the Measurements box. 216 | # @param [String] label the text label for the VCB 217 | def self.vcb_label=(label) 218 | end 219 | 220 | # Sets the value of the VCB, aka the Measurements box. 221 | # @param [String] str the text to place in the VCB. 222 | def self.vcb_value=(str) 223 | end 224 | 225 | def self.version 226 | end 227 | def self.version_number 228 | end 229 | 230 | # Write a key-value pair to the specified section of the Registry. Persistent storage. 231 | # Sections appear under HKCU\\Software\\Google\\SketchUp(v) where v is the SketchUp major version. 232 | # @example 233 | # status = Sketchup.write_default("MyPluginConfig", "OffsetAmount", 3.5) 234 | # 235 | # @param [String] section The Registry key 236 | # @param [String] key 237 | # @param [String, Array, Numeric] value the value to store 238 | # @return [Boolean] true if success, false if not. 239 | # @see read_default 240 | def self.write_default(section, key, value) 241 | end 242 | end 243 | -------------------------------------------------------------------------------- /lib/sketchupextension.rb: -------------------------------------------------------------------------------- 1 | class SketchupExtension 2 | 3 | # @since SketchUp 6 4 | def copyright 5 | end 6 | 7 | # @since SketchUp 6 8 | def copyright=(string) 9 | end 10 | 11 | # @since SketchUp 6 12 | def creator 13 | end 14 | 15 | # @since SketchUp 6 16 | def creator=(string) 17 | end 18 | 19 | # @since SketchUp 6 20 | def description 21 | end 22 | 23 | # @since SketchUp 6 24 | def description=(string) 25 | end 26 | 27 | # @since SketchUp 8.0 M2 28 | def load_on_start? 29 | end 30 | 31 | # @since SketchUp 8.0 M2 32 | def loaded? 33 | end 34 | 35 | # @since SketchUp 8.0 M2 36 | def registered? 37 | end 38 | 39 | # @since SketchUp 8.0 M2 40 | def uncheck 41 | end 42 | 43 | # @since SketchUp 6 44 | def name 45 | end 46 | 47 | # @since SketchUp 6 48 | def name=(string) 49 | end 50 | 51 | # @since SketchUp 6 52 | def new 53 | end 54 | 55 | # @since SketchUp 6 56 | def version 57 | end 58 | 59 | # @since SketchUp 6 60 | def version=(string) 61 | end 62 | end 63 | -------------------------------------------------------------------------------- /lib/sksocket.rb: -------------------------------------------------------------------------------- 1 | # @deprecated This class is undocumented and officially unsupported - use at your own risk. 2 | class SKSocket 3 | def add_socket_listener 4 | end 5 | def connect 6 | end 7 | def disconnect 8 | end 9 | def write 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /lib/string.rb: -------------------------------------------------------------------------------- 1 | class String 2 | # @return [Sketchup::Length] a Length in Model Units 3 | def to_l 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /lib/style.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Style < Entity 3 | def description 4 | end 5 | def description= 6 | end 7 | def name 8 | end 9 | def name= 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /lib/styles.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | class Styles < Entity 4 | 5 | include Enumerable 6 | 7 | def [] 8 | end 9 | def active_style 10 | end 11 | def active_style_changed 12 | end 13 | def add_style 14 | end 15 | def count 16 | end 17 | def each 18 | end 19 | 20 | # @since SketchUp 2014 21 | def length 22 | end 23 | 24 | def parent 25 | end 26 | def purge_unused 27 | end 28 | def selected_style 29 | end 30 | def selected_style= 31 | end 32 | def size 33 | end 34 | def update_selected_style 35 | end 36 | 37 | end 38 | 39 | end 40 | -------------------------------------------------------------------------------- /lib/text.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Text < Drawingelement 3 | def arrow_type 4 | end 5 | def arrow_type= 6 | end 7 | def display_leader= 8 | end 9 | def display_leader? 10 | end 11 | def has_leader? 12 | end 13 | def leader_type 14 | end 15 | def leader_type= 16 | end 17 | def line_weight 18 | end 19 | def line_weight= 20 | end 21 | def point 22 | end 23 | def point= 24 | end 25 | def set_text 26 | end 27 | def text 28 | end 29 | def text= 30 | end 31 | def vector 32 | end 33 | def vector= 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/texture.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | 3 | # @since SketchUp 6 4 | class Texture < Entity 5 | 6 | def average_color 7 | end 8 | def filename 9 | end 10 | def height 11 | end 12 | def image_height 13 | end 14 | def image_width 15 | end 16 | def size= 17 | end 18 | def valid? 19 | end 20 | def width 21 | end 22 | 23 | # @param [String] filename 24 | # @since SketchUp 2016 25 | # @return true or false 26 | def write(filename, colorize = false) 27 | end 28 | 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /lib/texturewriter.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class TextureWriter 3 | def count 4 | end 5 | def filename 6 | end 7 | def handle 8 | end 9 | def length 10 | end 11 | def load(entity, front = false) 12 | end 13 | def write(entity, filename, front = false) 14 | end 15 | def write_all 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /lib/tool.rb: -------------------------------------------------------------------------------- 1 | # @abstract 2 | class Tool 3 | def activate 4 | end 5 | def deactivate 6 | end 7 | def draw 8 | end 9 | def enableVCB? 10 | end 11 | def getExtents 12 | end 13 | def getInstructorContentDirectory 14 | end 15 | def getMenu 16 | end 17 | def onCancel 18 | end 19 | def onKeyDown 20 | end 21 | def onKeyUp 22 | end 23 | def onLButtonDoubleClick 24 | end 25 | def onLButtonDown 26 | end 27 | def onLButtonUp 28 | end 29 | def onMButtonDoubleClick 30 | end 31 | def onMButtonDown 32 | end 33 | def onMButtonUp 34 | end 35 | def onMouseEnter 36 | end 37 | def onMouseLeave 38 | end 39 | def onMouseMove 40 | end 41 | def onRButtonDoubleClick 42 | end 43 | def onRButtonDown 44 | end 45 | def onRButtonUp 46 | end 47 | def onReturn 48 | end 49 | def onSetCursor 50 | end 51 | def onUserText 52 | end 53 | def resume 54 | end 55 | def suspend 56 | end 57 | end 58 | -------------------------------------------------------------------------------- /lib/toolbar.rb: -------------------------------------------------------------------------------- 1 | module UI 2 | 3 | class Toolbar 4 | 5 | include Enumerable 6 | 7 | def length 8 | end 9 | alias_method :size, :length 10 | 11 | def add_item(command) 12 | end 13 | def add_separator 14 | end 15 | def get_last_state 16 | end 17 | def hide 18 | end 19 | def self.new(name) 20 | end 21 | def restore 22 | end 23 | def show 24 | end 25 | def visible? 26 | end 27 | 28 | end 29 | 30 | end 31 | -------------------------------------------------------------------------------- /lib/tools.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Tools 3 | def active_tool_id 4 | end 5 | def active_tool_name 6 | end 7 | def add_observer 8 | end 9 | def model 10 | end 11 | def pop_tool 12 | end 13 | def push_tool 14 | end 15 | def remove_observer 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /lib/toolsobserver.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class ToolsObserver 3 | def onActiveToolChanged 4 | end 5 | def onToolStateChanged 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /lib/transformation.rb: -------------------------------------------------------------------------------- 1 | module Geom 2 | class Transformation 3 | 4 | # Creates a new transformation object. 5 | # @overload initialize() 6 | # Creates a new identity transformation. 7 | # @overload initialize(point) 8 | # Creates a transformation that translates by the vector from the origin to the given point. 9 | # @param [Geom::Point3d] point 10 | # @overload initialize(vector) 11 | # Creates a transformation that translates by the given vector. 12 | # @param [Geom::Vector3d, Array] vector 13 | # @overload initialize(transformation) 14 | # Creates a transformation that is a copy of the given transformation. 15 | # This is equivalent to {clone}. 16 | # @param [Geom::Transformation] transformation 17 | # @overload initialize(array) 18 | # Creates a transformation from a 16 element array that represents a 19 | # transformation matrix in row major ordering. 20 | # @param [Array] array 21 | # @overload initialize(scale) 22 | # Creates a transformation that does uniform scaling. 23 | # @param [Numeric] scale 24 | # @overload initialize(origin, zaxis) 25 | # Creates an axis transformation where where xaxis and yaxis are arbitrarily chosen. 26 | # @param [Geom::Point3d, Array] origin 27 | # @param [Geom::Vector3d, Array] zaxis 28 | # @overload initialize(origin, xaxis, yaxis) 29 | # Creates an axis transformation from origin, xaxis and yaxis. The zaxis 30 | # is set orthogonal to the given axis according to the right-hand rule. 31 | # @param [Geom::Point3d, Array] origin 32 | # @param [Geom::Vector3d, Array] xaxis 33 | # @param [Geom::Vector3d, Array] yaxis 34 | # @overload initialize(point, axis, angle) 35 | # Creates a transformation that rotates counter-clockwise about an axis by given angle. 36 | # @param [Geom::Point3d, Array] point 37 | # @param [Geom::Vector3d, Array] axis 38 | # @param [Numeric] angle The angle in radians 39 | # @overload initialize(xaxis, yaxis, zaxis, origin) 40 | # Creates a transformation from 3 axis and an origin. 41 | # @param [Geom::Vector3d, Array] xaxis 42 | # @param [Geom::Vector3d, Array] yaxis 43 | # @param [Geom::Vector3d, Array] zaxis 44 | # @param [Geom::Point3d] origin 45 | def initialize(*args) 46 | end 47 | 48 | # Matrix multiplication 49 | # @overload *(point) 50 | # @param [Geom::Point3d] point 51 | # @overload *(vector) 52 | # @param [Geom::Vector3d] vector 53 | # @overload *(transformation) 54 | # @param [Geom::Transformation] transformation 55 | # @return [Geom::Transformation] 56 | def *(arg) 57 | end 58 | 59 | # Creates a transformation from 3 axis and an origin. 60 | # @param [Geom::Point3d, Array] origin 61 | # @param [Geom::Vector3d, Array] xaxis 62 | # @param [Geom::Vector3d, Array] yaxis 63 | # @param [Geom::Vector3d, Array] zaxis 64 | # @return [Geom::Transformation] 65 | def self.axes(origin, xaxis, yaxis, zaxis) 66 | end 67 | 68 | # Creates another transformation identical to the transformation being cloned. 69 | # @return [Geom::Transformation] A new transformation that is a copy of this one. 70 | def clone 71 | end 72 | 73 | # Determines if this transformation is an identity transformation, that means that applying it to a geometry 74 | # won't modify it. 75 | # @return [Boolean] true if this transformation is an identity transformation 76 | # @note There is an issue that this method returns only true for transformations initialized as 77 | # identity, either with {Transformation.new} or from the constant Geom::Transformation::Identity 78 | def identity? 79 | end 80 | 81 | # Create a new transformation that is the result of interpolating between two other transformations. 82 | # Creates a new point as a linear combination of two points. This method is generally used to get a point at some 83 | # percentage along a line connecting the two points. The weights should sum up to 1 if you want to get a on that 84 | # line. The weights should be between 0 and 1 if you want to get a point between the two points. 85 | # @param [Numeric] weight1 The weight of point1. 86 | # @param [Geom::Point3d, Array] point1 87 | # @param [Numeric] parameter The weight of point2. 88 | # @param [Geom::Point3d, Array] point2 89 | # @return [Geom::Point3d] 90 | # @note This method fails to interpolate if a uniform scaling is not realized by the three diagonal matrix elements 91 | # but by the last matrix element. In that case, it would return the first transformation for parameter 0 and 92 | # otherwise the second transformation. 93 | # @note Note transformation matrices are not suited for interpolating rotations: An rotation by 180 would "squeeze" 94 | # the transformed object through the rotation axis and then expand to the final state instead of rotating either 95 | # left way or right way. 96 | def self.interpolate 97 | end 98 | 99 | # Creates a new transformation that is the inverse of this transformation. 100 | # @return [Geom::Transformation] 101 | def inverse 102 | end 103 | 104 | # Modifies this transformation to its inverse. 105 | # @return [self] 106 | def invert! 107 | end 108 | 109 | # Retrieves the origin of a transformation. 110 | # @return [Geom::Point3d] 111 | def origin 112 | end 113 | 114 | # Creates a new transformation that does a counter-clockwise rotation about an axis by given angle. 115 | # @param [Geom::Point3d, Array] point A point on the axis of rotation 116 | # @param [Geom::Vector3d, Array] vector A vector defining the direction of the axis 117 | # @param [Numeric] angle The angle in radians 118 | # @return [Geom::Transformation] The new rotation transformation 119 | def self.rotation(point, vector, angle) 120 | end 121 | 122 | # Creates a new transformation that does a scaling. 123 | # @overload self.scaling(scale) 124 | # Uniform scaling about the origin. 125 | # @param [Numeric] scale Uniform scaling factor for all three axes 126 | # @overload self.scaling(point, scale) 127 | # Uniform scaling about a given point. 128 | # @param [Geom::Point3d, Array] point 129 | # @param [Numeric] scale Uniform scaling factor for all three axes 130 | # @overload self.scaling(xscale, yscale, zscale) 131 | # Non-uniform scaling about the origin. 132 | # @param [Numeric] xscale Scaling factor along the x-axis 133 | # @param [Numeric] yscale Scaling factor along the y-axis 134 | # @param [Numeric] zscale Scaling factor along the z-axis 135 | # @overload self.scaling(xscale, yscale, zscale) 136 | # Non-uniform scaling about a given point. 137 | # @param [Geom::Point3d, Array] point 138 | # @param [Numeric] xscale Scaling factor along the x-axis 139 | # @param [Numeric] yscale Scaling factor along the y-axis 140 | # @param [Numeric] zscale Scaling factor along the z-axis 141 | # @return [Geom::Transformation] The new scaling transformation 142 | def self.scaling 143 | end 144 | 145 | # Sets this transformation to match another one. 146 | # @overload set!(transformation) 147 | # @param [Geom::Transformation] transformation Another transformation object 148 | # @overload set!(array) 149 | # @param [Array] array A 16 element array of a transformation matrix in row major ordering. 150 | # @return [self] 151 | def set!(transformation) 152 | end 153 | 154 | # Returns an array representation of this transformation. 155 | # @return [Array] A 16 element array the matrix elements. 156 | def to_a 157 | end 158 | 159 | # Creates a new transformation that translates by the given vector. 160 | # @param [Geom::Vector3d, Geom::Point3d, Array] vector 161 | # @return [Geom::Transformation] The new rotation transformation 162 | def self.translation(vector) 163 | end 164 | 165 | # Retrieves the x-axis of this transformation. 166 | # @return [Geom::Vector3d] 167 | def xaxis 168 | end 169 | 170 | # Retrieves the y-axis of this transformation. 171 | # @return [Geom::Vector3d] 172 | def yaxis 173 | end 174 | 175 | # Retrieves the z-axis of this transformation. 176 | # @return [Geom::Vector3d] 177 | def zaxis 178 | end 179 | 180 | end 181 | end 182 | -------------------------------------------------------------------------------- /lib/ui.rb: -------------------------------------------------------------------------------- 1 | module UI 2 | def self.add_context_menu_handler 3 | end 4 | 5 | # @example 6 | # UI.beep 7 | def self.beep 8 | end 9 | 10 | # @since SketchUp 2016 - support for .svg icons added 11 | def self.create_cursor(filename, hot_x, hot_y) 12 | end 13 | def self.inputbox(*args) 14 | end 15 | def self.inspector_names 16 | end 17 | 18 | # Used to access SketchUp menus in order to add menu items. 19 | # 20 | # Valid Strings are: 21 | # File, Edit, View, Camera, Draw, Tools, Window, Plugins, Help 22 | # 23 | # User-defined top-level menus will not be added., although users may define {Sketchup::Menu#add_submenu sub-menus}. 24 | # 25 | # A mis-typed menu name _may_ return one of the valid menu with no error given, or 26 | # it may produce an error. 27 | # 28 | # The *Plugins* menu may or may not be visible when SketchUp starts. It will be created 29 | # upon the first access. 30 | # 31 | # References to Menus are time-sensitive. You have a limited amount of time to add your menu items 32 | # before the menu reference no longer works. No error given in this case. 33 | # 34 | # @example 35 | # menu = UI.menu("Plugins") 36 | # menu.add_item("My Plugin") { UI.messagebox("Hello!") } 37 | # 38 | # @param [String] menu_name the name of an existing SketchUp menu. 39 | # 40 | # @return [Sketchup::Menu] a menu object 41 | def self.menu(menu_name = nil) 42 | end 43 | 44 | def self.messagebox(message, type = IDOK) 45 | end 46 | 47 | # Display a list of the names of the available tabs in the Model Info Window. 48 | def self.model_info_pages 49 | end 50 | 51 | def self.openURL(url) 52 | end 53 | 54 | # File selection dialog. 55 | # @version 2014 56 | # @example 57 | # chosen_model = UI.openpanel("Open SKP File", "c:/", "model.skp") 58 | # chosen_image = UI.openpanel("Open Image File", "c:/", "Image Files|*.jpg;*.png;||") 59 | # chosen_file = UI.openpanel("Open CAD File", "c:/", "DXF|*.dxf|DWG|*.dwg||") 60 | # 61 | def self.openpanel(title, path, file_filter) 62 | end 63 | 64 | def self.play_sound(filename) 65 | end 66 | 67 | # @see show_preferences 68 | def self.preferences_pages 69 | end 70 | 71 | def self.refresh_inspectors 72 | end 73 | 74 | # File save dialog 75 | def self.savepanel(title, path, file_filter) 76 | end 77 | 78 | # @since 2015 79 | # @param [Hash] opts the options 80 | # @option opts [String] :title 81 | # @option opts [String] :directory 82 | # @option opts [Boolean] :select_multiple false 83 | # 84 | # @return [String, Array, nil] nil if user cancel 85 | def self.select_directory(opts = {}) 86 | end 87 | 88 | def self.set_cursor(cursor_id) 89 | end 90 | def self.set_toolbar_visible(name, visible) 91 | end 92 | def self.show_inspector(name) 93 | end 94 | def self.show_model_info(page) 95 | end 96 | def self.show_preferences(page) 97 | end 98 | 99 | # The start_timer method is used to start a timer and execute deferred code. 100 | # @param [Numeric] interval The time in seconds before your code should be called. 101 | # @param [Boolean] repeat whether to repeat the timer 102 | # @yield The procedure you want to execute after the amount of seconds has expired. 103 | # @return [Fixnum] id a timer ID to identify the timer for stopping it 104 | # @note In SketchUp 7.1 and lower, the interval was rounded down to the nearest integer. A timer with interval 0.9 105 | # would execute immediately. 106 | # @note There is a bug that if you open a modal window in a non-repeating timer the timer will repeat until the 107 | # window is closed. 108 | def self.start_timer(interval, repeat=false, &block) 109 | end 110 | 111 | # The stop_timer method is used to stop a timer based on its id. 112 | # @param [Fixnum] id The timer id for the timer that you want to stop. 113 | # @return [nil] 114 | def self.stop_timer(id) 115 | end 116 | 117 | def self.toolbar(name) 118 | end 119 | def self.toolbar_names 120 | end 121 | def self.toolbar_visible?(name) 122 | end 123 | end 124 | -------------------------------------------------------------------------------- /lib/utm.rb: -------------------------------------------------------------------------------- 1 | module Geom 2 | class UTM 3 | def to_a 4 | end 5 | def to_latlong 6 | end 7 | def to_s 8 | end 9 | def x 10 | end 11 | def y 12 | end 13 | def zone_letter 14 | end 15 | def zone_numer 16 | end 17 | end 18 | end # module Geom 19 | -------------------------------------------------------------------------------- /lib/uvhelper.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class UVHelper 3 | def get_back_UVQ 4 | end 5 | def get_front_UVQ 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /lib/vector3d.rb: -------------------------------------------------------------------------------- 1 | module Geom 2 | class Vector3d 3 | 4 | # Creates a new 3D vector. 5 | # @overload initialize() 6 | # Creates a vector with all coordinates set to zero. Note that such a zero-length vector is not valid. 7 | # @overload initialize(vector) 8 | # @param [Geom::Vector3d] vector another vector 9 | # @overload initialize(array) 10 | # @param [Array] array an array of two or three coordinates 11 | # @overload self.new(x, y, z=0.0) 12 | # @param [Numeric] x the x coordinate 13 | # @param [Numeric] y the y coordinate 14 | # @param [Numeric] z the z coordinate 15 | def initialize(*args) 16 | end 17 | 18 | # Dot product. 19 | # @param [Geom::Vector3d,Array] vector 20 | # @return [Float] 21 | def %(vector) 22 | end 23 | 24 | # Computes the cross product between 2 Vectors. 25 | # The cross product of two vectors produces a third vector which is perpendicular to the plane in which the first 26 | # two lie. 27 | # @param [Geom::Vector3d,Array] vector 28 | # @return [Geom::Vector3d] 29 | def *(vector) 30 | end 31 | 32 | # Vector Addition 33 | # @param [Geom::Vector3d,Array] vector 34 | # @return [Geom::Vector3d] 35 | def +(vector) 36 | end 37 | 38 | # Vector subtraction 39 | # @param [Geom::Vector3d,Array] vector 40 | # @return [Geom::Vector3d] 41 | def -(vector) 42 | end 43 | 44 | # Compare two vectors coordinate by coordinate. First the x coordinates are compared, if they are equal, the y 45 | # coordinates are compared, if those are equal finally the z coordinates. 46 | # @param [Geom::Vector3d,Array] vector 47 | # @return [Boolean] true if this vector's x, y or z coordinate is less 48 | # @example 49 | # v1 = Geom::Vector3d.new(10, 10, 90) 50 | # v2 = Geom::Vector3d.new(10, 20, 20) 51 | # v1 < v2 # ==> true 52 | def <(vector) 53 | end 54 | 55 | # Compare {Vector3d}s using SketchUp tolerance. 56 | # @params [Geom::Vector3d,Array] vector 57 | # @return [Boolean] 58 | def ==(vector) 59 | end 60 | 61 | # Retrieves the coordinate of the vector at the specified index. 62 | # @param [Integer] index The index 0, 1 or 2 for a specific x, y, or z value within the vector. 63 | # @return [Numeric] The coordinate at the specified index. 64 | # @raise IndexError Raised if the index is outside the range [0,2]. Note that negative indices [-3,-1] don't raise. 65 | def [](index) 66 | end 67 | 68 | # Retrieves the coordinate of the vector at the specified index. 69 | # @param [Integer] index The index 0, 1 or 2 for a specific x, y, or z value within the vector. 70 | # @param [Numeric] value The new x, y or z value. 71 | # @return [Numeric] The argument passed for the new value. 72 | # @raise IndexError Raised if the index is outside the range [0,2]. Note that negative indices [-3,-1] don't raise. 73 | def []=(index, value) 74 | end 75 | 76 | # Compute the angle between this vector and another vector. 77 | # @param [Geom::Vector3d,Array] vector 78 | # @return [Float] The smallest angle between the vectors in radians. 79 | def angle_between(vector) 80 | end 81 | 82 | # Compute an arbitrary set of orthogonal axes with this vector as the z-axis direction. If possible, the vector's 83 | # x-axis is the up vector, being in plane with the global z-axis. 84 | # @return [Array(Geom::Vector3d,Geom::Vector3d,Geom::Vector3d)] An array of normalized vectors for the x-axis, 85 | # y-axis and z-axis. 86 | def axes 87 | end 88 | 89 | # Creates another vector identical to the vector being cloned. 90 | # @return [Geom::Vector3d] A new vector that is a copy of this one. 91 | def clone 92 | end 93 | 94 | # Computes the cross product between another vector. 95 | # The cross product of two vectors produces a third vector which is perpendicular to the plane in which the first 96 | # two lie. 97 | # @param [Geom::Vector3d,Array] vector 98 | # @return [Geom::Vector3d] 99 | def cross(vector) 100 | end 101 | 102 | # Compute the dot product between another vector. 103 | def dot(vector) 104 | end 105 | 106 | # Returns a string containing a human-readable representation of this vector. 107 | # @return [String] A string representation of the vector 108 | def inspect 109 | end 110 | 111 | # Retrieves the length of this vector. 112 | # @return [Length] 113 | def length 114 | end 115 | 116 | # Sets length of this vector. 117 | # @param [Numeric] value The new length. 118 | # @return [Numeric] The argument passed for the new value. 119 | def length=(value) 120 | end 121 | 122 | # Creates a new vector as a linear combination of two vectors. This method is generally used to get a vector at some 123 | # percentage along a line connecting the two vectors. The weights should sum up to 1 if you want to get a on that 124 | # line. The weights should be between 0 and 1 if you want to get a vector between the two vectors. 125 | # @param [Numeric] weight1 The weight of vector1. 126 | # @param [Geom::Vector3d,Array] vector1 127 | # @param [Numeric] weight2 The weight of vector2. 128 | # @param [Geom::Vector3d,Array] vector2 129 | # @return [Geom::Vector3d] 130 | def self.linear_combination(weight1, vector1, weight2, vector2) 131 | end 132 | 133 | # Creates a copy of this vector that is a unit vector, that means its length is 1. 134 | # @return [Geom::Vector3d] The new normalized vector. 135 | def normalize 136 | end 137 | 138 | # Modifies this vector into a unit vector, that means this vector's length becomes 1. 139 | # @return [self] 140 | def normalize! 141 | end 142 | 143 | # Determines whether this vector is parallel to another vector within tolerance. 144 | # The vectors may have different length and be reversed but would still be parallel. 145 | # @param [Geom::Vector3d,] vector another vector 146 | # @return [Boolean] 147 | def parallel?(vector) 148 | end 149 | 150 | # Determines whether this vector is perpendicular to another vector within tolerance. 151 | # @param [Geom::Vector3d,] vector another vector 152 | # @return [Boolean] 153 | def perpendicular?(vector) 154 | end 155 | 156 | # Creates a copy of this vector in the opposite direction of same length. 157 | # @return [Geom::Vector3d] The new vector 158 | def reverse 159 | end 160 | 161 | # Turns this vector in the opposite direction. This is the same as multiplying its length with -1. 162 | # @return [self] 163 | def reverse! 164 | end 165 | 166 | # Determines if this vector is parallel to and in the same direction as another vector to within tolerance. 167 | # @param [Geom::Vector3d,] vector another vector 168 | # @return [Boolean] true if this vector and vector are in the same direction, false if they are not in the same direction 169 | def samedirection?(vector) 170 | end 171 | 172 | # Sets the values of this vector. 173 | # @param [Numeric] x The location along the x axis. 174 | # @param [Numeric] y The location along the y axis. If not given, this coordinate is not modified. 175 | # @param [Numeric] z The location along the z axis. If not given, this coordinate is not modified. 176 | # @return [self] 177 | def set!(x, y=self.x, z=self.y) 178 | end 179 | 180 | # Returns an array representation of this vector. 181 | # @return [Array(Length,Length,Length)] An array containing its x, y, z coordinates 182 | def to_a 183 | end 184 | 185 | # Returns a string representation of this vector. 186 | # @return [String] A string of this vector in the current model units, using the user's locale's decimal delimiter. 187 | def to_s 188 | end 189 | 190 | # Applies a transformation to a copy this vector to create a new vector. 191 | # @param [Geom::Transformation] transformation A Transformation object. 192 | # @return [Geom::Vector3d] The new vector 193 | def transform(transformation) 194 | end 195 | 196 | # Applies a transformation to this vector. 197 | # Unlike the {#transform} method, the vector itself is modified. 198 | # @param [Geom::Transformation] transformation A Transformation object. 199 | # @return [self] 200 | def transform!(transformation) 201 | end 202 | 203 | # Determines if this vector is a unit vector, that means if its length is 1.0. 204 | # @return [Boolean] true if the vector is a unit vector, false if it is not a unit vector. 205 | def unitvector? 206 | end 207 | 208 | # Verifies if this vector is valid. A vector is valid if its length is not zero. 209 | # @return [Boolean] true if the vector is valid, false if it is not valid 210 | def valid? 211 | end 212 | 213 | # Retrieves the x coordinate of this vector. 214 | # @return [Float] 215 | def x 216 | end 217 | 218 | # Sets the x value of this vector. 219 | # @param [Numeric] value The new x coordinate. 220 | # @return [Numeric] The argument passed for the new value. 221 | def x=(value) 222 | end 223 | 224 | # Retrieves the y coordinate of this vector. 225 | # @return [Float] 226 | def y 227 | end 228 | 229 | # Sets the y value of this vector. 230 | # @param [Numeric] value The new y coordinate. 231 | # @return [Numeric] The argument passed for the new value. 232 | def y=(value) 233 | end 234 | 235 | # Retrieves the z coordinate of this vector. 236 | # @return [Float] 237 | def z 238 | end 239 | 240 | # Sets the z value of this vector. 241 | # @param [Numeric] value The new z coordinate. 242 | # @return [Numeric] The argument passed for the new value. 243 | def z=(value) 244 | end 245 | 246 | end 247 | end # module Geom 248 | -------------------------------------------------------------------------------- /lib/vertex.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class Vertex < Entity 3 | def common_edge(vertex) 4 | end 5 | def curve_interior? 6 | end 7 | def edges 8 | end 9 | def faces 10 | end 11 | def loops 12 | end 13 | def position 14 | end 15 | def used_by?(face_or_edge) 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /lib/view.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class View 3 | 4 | # Attach a {Sketchup::ViewObserver} to the View 5 | # 6 | # @param [Sketchup::ViewObserver] view_observer an instance of a ViewObserver 7 | # @return [Boolean] true if successful, false if not 8 | def add_observer(view_observer) 9 | end 10 | 11 | def animation=(animation) 12 | end 13 | 14 | def average_refresh_time 15 | end 16 | 17 | # Returns a reference to the {Sketchup::Camera} 18 | # 19 | # @return [Camera] 20 | # 21 | def camera 22 | end 23 | 24 | def camera=(camera) 25 | end 26 | def center 27 | end 28 | def corner(index) 29 | end 30 | def draw(mode, *points) 31 | end 32 | 33 | # Used to draw temporary geometry on the screen rather than 3d space. 34 | # 35 | # Object.constants.grep(/GL_/).sort 36 | # ["GL_LINES", "GL_LINE_LOOP", "GL_LINE_STRIP", "GL_POINTS", "GL_POLYGON", "GL_QUADS", 37 | # "GL_QUAD_STRIP", "GL_TRIANGLES", "GL_TRIANGLE_FAN", "GL_TRIANGLE_STRIP"] 38 | # 39 | # @example 40 | # view.draw2d(GL_POINTS, [ [0, 0], [1, 0], [1, 1], [0, 1] ]) 41 | # 42 | # @param opengl_primitive Ruby Constant mapped to an OpenGL primitive type. 43 | # 44 | # @param [Array] points An Array of 2d screen coordinates in pixels. 45 | # 46 | # @return [View] the View 47 | def draw2d(opengl_primitive, *points) 48 | end 49 | def draw_line(*args) 50 | end 51 | def draw_lines(*args) 52 | end 53 | def draw_points(points, size, style, color) 54 | end 55 | def draw_polyline(*args) 56 | end 57 | 58 | # @return [View] 59 | # @overload draw_text(point, text) 60 | # @since SketchUp 6 61 | # @param [Point3d] point 62 | # @param [String] text 63 | # 64 | # @overload draw_text(point, text, opts = {}) 65 | # @since SketchUp 2016 66 | # @param [Point3d] point 67 | # @param [String] text 68 | # @param [Hash] opts 69 | # @option opts [String] :font_name The name of the font to use. If it does not # exist on the system, a default font will be used instead. 70 | # @option opts [Integer] :font_size The size of the font in points 71 | # @option opts [Boolean] :bold Controls the Bold property of the font. 72 | # @option opts [Boolean] :italic Controls the Italic property of the font. 73 | # @option opts [Color] :color The color to draw the text with. 74 | # @option opts [Integer] :align The text alignment, one of the following: 75 | # TextAlignLeft, TextAlignCenter or TextAlignRight. 76 | # 77 | def draw_text(point, string, options_hash) 78 | end 79 | 80 | def drawing_color=(color) 81 | end 82 | def dynamic=(boolean) 83 | end 84 | def field_of_view 85 | end 86 | def field_of_view=(fov) 87 | end 88 | def guess_target 89 | end 90 | def inference_locked? 91 | end 92 | def inputpoint(x, y, inputpoint = nil) 93 | end 94 | def invalidate 95 | end 96 | def last_refresh_time 97 | end 98 | def line_stipple=(pattern) 99 | end 100 | def line_width=(pixel_width) 101 | end 102 | def lock_inference(inputpoint1 = nil, inputpoint2 = nil) 103 | end 104 | def model 105 | end 106 | # @return [Sketchup::PickHelper] 107 | def pick_helper(x = nil, y = nil, aperture = nil) 108 | end 109 | def pickray(x = nil, y = nil) 110 | end 111 | def pixels_to_model(pixel_size, point) 112 | end 113 | def remove_observer(observer) 114 | end 115 | def screen_coords(point) 116 | end 117 | def set_color_from_line(point1, point2) 118 | end 119 | def show_frame(delay = 0) 120 | end 121 | def tooltip=(string) 122 | end 123 | def vpheight 124 | end 125 | def vpwidth 126 | end 127 | def write_image(filename_or_hash, width = nil, height = nil, antialias = nil, compression = nil) 128 | end 129 | def zoom(zoom_or_entities) 130 | end 131 | def zoom_extents 132 | end 133 | end 134 | end 135 | -------------------------------------------------------------------------------- /lib/viewobserver.rb: -------------------------------------------------------------------------------- 1 | module Sketchup 2 | class ViewObserver 3 | def onViewChanged 4 | end 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /lib/webdialog.rb: -------------------------------------------------------------------------------- 1 | module UI 2 | class WebDialog 3 | 4 | # @param [String] callback_name 5 | # 6 | # @yield [dialog, param] 7 | # @yieldparam [UI::WebDialog] dialog 8 | # @yieldparam [String] param 9 | # 10 | # @return [Nil] 11 | def add_action_callback(callback_name) 12 | end 13 | 14 | # @param [String] hostname 15 | # 16 | # @return [Nil] 17 | def allow_actions_from_host(hostname) 18 | end 19 | 20 | # @return [Nil] 21 | def bring_to_front 22 | end 23 | 24 | # @return [Nil] 25 | def close 26 | end 27 | 28 | # @param [String] script 29 | # 30 | # @return [Nil] 31 | def execute_script(script) 32 | end 33 | 34 | # @return [String] 35 | def get_default_dialog_color 36 | end 37 | 38 | # @param [String] element_id 39 | # 40 | # @return [Nil] 41 | def get_element_value(element_id) 42 | end 43 | 44 | # @return [Integer] 45 | def max_height 46 | end 47 | 48 | # @param [Integer] value 49 | # 50 | # @return [Integer] 51 | def max_height=(value) 52 | end 53 | 54 | # @return [Integer] 55 | def max_width 56 | end 57 | 58 | # @param [Integer] value 59 | # 60 | # @return [Integer] 61 | def max_width=(value) 62 | end 63 | 64 | # @return [Integer] 65 | def min_height 66 | end 67 | 68 | # @param [Integer] value 69 | # 70 | # @return [Integer] 71 | def min_height=(value) 72 | end 73 | 74 | # @return [Integer] 75 | def min_width 76 | end 77 | 78 | # @param [Integer] value 79 | # 80 | # @return [Integer] 81 | def min_width=(value) 82 | end 83 | 84 | # @param [Boolean] value 85 | # 86 | # @return [Boolean] 87 | def navigation_buttons_enabled=(value) 88 | end 89 | 90 | # @return [Boolean] 91 | def navigation_buttons_enabled? 92 | end 93 | 94 | # @overload new(title, scrollable, preferences_key, width, height, left, top, resizable) 95 | # @param [String] title 96 | # @param [Boolean] scrollable 97 | # @param [String] preferences_key 98 | # @param [Integer] width 99 | # @param [Integer] height 100 | # @param [Integer] left 101 | # @param [Integer] top 102 | # @param [Boolean] resizable 103 | # 104 | # @overload new(options) 105 | # @param preferences_key [Hash] options 106 | # @option options [String] :dialog_title 107 | # @option options [String] :preferences_key 108 | # @option options [Boolean] :scrollable 109 | # @option options [Boolean] :resizable 110 | # @option options [Integer] :top 111 | # @option options [Integer] :left 112 | # @option options [Integer] :width 113 | # @option options [Integer] :height 114 | # @option options [Boolean] :mac_only_use_nswindow 115 | # 116 | # @return [UI::WebDialog] 117 | def new(*args) 118 | end 119 | 120 | # @param [String] url 121 | # @param [String] data 122 | # 123 | # @return [Nil] 124 | def post_url 125 | end 126 | 127 | # @since SketchUp 2014 128 | # @return [Float] screen scale factor 129 | def screen_scale_factor 130 | end 131 | 132 | # @param [String] color 133 | # 134 | # @return [Nil] 135 | def set_background_color(color) 136 | end 137 | 138 | # @param [String] filename 139 | # @param [String] path 140 | # 141 | # @return [Nil] 142 | def set_file(filename, path = nil) 143 | end 144 | 145 | # @since SketchUp 7.1 146 | # 147 | # @param [Boolean] value 148 | # 149 | # @return [UI::WebDialog] 150 | def set_full_security(value) 151 | end 152 | 153 | # @param [String] html 154 | # 155 | # @return [Nil] 156 | def set_html(html) 157 | end 158 | 159 | # @yield [dialog] 160 | # @yieldparam [UI::WebDialog] dialog 161 | # 162 | # @return [Nil] 163 | def set_on_close 164 | end 165 | 166 | # @param [Integer] left 167 | # @param [Integer] top 168 | # 169 | # @return [Nil] 170 | def set_position(left, top) 171 | end 172 | 173 | # @param [Integer] width 174 | # @param [Integer] height 175 | # 176 | # @return [Nil] 177 | def set_size(width, height) 178 | end 179 | 180 | # @param [String] url 181 | # 182 | # @return [Nil] 183 | def set_url(url) 184 | end 185 | 186 | # @yield [dialog] 187 | # @yieldparam [UI::WebDialog] dialog 188 | # 189 | # @return [Nil] 190 | def show 191 | end 192 | 193 | # @yield [dialog] 194 | # @yieldparam [UI::WebDialog] dialog 195 | # 196 | # @return [Nil] 197 | def show_modal 198 | end 199 | 200 | def visible? 201 | end 202 | 203 | end 204 | end 205 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | **Update:** 2016-10-03 - The official SketchUp documentation is now updated and using a similar idea. Visit the official [SketchUp Ruby API Documentation](http://ruby.sketchup.com/). 2 | 3 | 4 | This is a project to document the [SketchUp Ruby API](http://www.sketchup.com/intl/en/developer/ "SketchUp Ruby API") using YARD the Ruby documentation tool. 5 | 6 | Although the official SketchUp Ruby API documentation is very good, it does have some problems. 7 | 8 | Lack of navigation between classes was a major feature missing although that has been recently address to some extent. 9 | 10 | The other major problem is accuracy. Many method parameters and return values are omitted, others are just wrong. Many of the code examples are poor or incorrect. 11 | 12 | 13 | 14 | Contributions of code or otherwise are happily accepted. If you aren't into writing yard docs, you can still [file issues](https://github.com/jimfoltz/SketchUp-Ruby-API-Doc/issues "issues") to report problems or discuss the documentation. 15 | 16 | 17 | The github page: https://github.com/jimfoltz/SketchUp-Ruby-API-Doc 18 | 19 | 20 | The generated documentation is available online at [RubyDoc.info](http://rubydoc.info/github/jimfoltz/SketchUp-Ruby-API-Doc/master/frames "RubyDoc.info page") 21 | 22 | 2015-01-08 23 | JF 24 | --------------------------------------------------------------------------------