scriptup 2026.0.0 → 2026.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (489) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +43 -24
  3. data/ext/arc_curve.c +50 -0
  4. data/ext/attribute_dictionaries.c +49 -32
  5. data/ext/attribute_dictionary.c +54 -127
  6. data/ext/axes.c +79 -0
  7. data/ext/behavior.c +100 -9
  8. data/ext/bounding_box.c +195 -0
  9. data/ext/camera.c +178 -0
  10. data/ext/classifications.c +85 -0
  11. data/ext/color.c +91 -163
  12. data/ext/component_definition.c +78 -162
  13. data/ext/component_instance.c +88 -9
  14. data/ext/construction.c +59 -0
  15. data/ext/curve.c +87 -0
  16. data/ext/definition_list.c +89 -109
  17. data/ext/depend +1 -0
  18. data/ext/drawing_element.c +96 -117
  19. data/ext/edge.c +147 -0
  20. data/ext/edge_use.c +37 -0
  21. data/ext/entities.c +573 -16
  22. data/ext/entities_builder.c +145 -0
  23. data/ext/entity.c +175 -212
  24. data/ext/environments.c +149 -0
  25. data/ext/extconf.rb +54 -10
  26. data/ext/face.c +331 -0
  27. data/ext/geom.c +172 -0
  28. data/ext/group.c +86 -0
  29. data/ext/helpers.c +244 -0
  30. data/ext/image.c +182 -0
  31. data/ext/image_rep.c +158 -0
  32. data/ext/instance_path.c +185 -0
  33. data/ext/lat_long.c +88 -0
  34. data/ext/layer.c +98 -0
  35. data/ext/layer_folder.c +99 -0
  36. data/ext/layers.c +122 -0
  37. data/ext/length.c +253 -0
  38. data/ext/line_styles.c +60 -0
  39. data/ext/loop.c +24 -0
  40. data/ext/material.c +144 -197
  41. data/ext/materials.c +49 -60
  42. data/ext/model.c +232 -26
  43. data/ext/options_store.c +188 -0
  44. data/ext/page.c +168 -0
  45. data/ext/pages.c +135 -0
  46. data/ext/point2d.c +195 -0
  47. data/ext/point3d.c +340 -0
  48. data/ext/polygon_mesh.c +253 -0
  49. data/ext/scriptup.h +279 -0
  50. data/ext/section_plane.c +44 -0
  51. data/ext/sketchup.c +102 -76
  52. data/ext/styles.c +91 -0
  53. data/ext/text.c +135 -0
  54. data/ext/texture.c +74 -83
  55. data/ext/texture_writer.c +104 -0
  56. data/ext/transformation.c +309 -0
  57. data/ext/transformation2d.c +190 -0
  58. data/ext/uv_helper.c +41 -0
  59. data/ext/vector2d.c +238 -0
  60. data/ext/vector3d.c +294 -0
  61. data/ext/vertex.c +67 -0
  62. data/lib/sketchup.rb +2 -2
  63. data/sig/_top_level.rbs +188 -0
  64. data/sig/array.rbs +52 -0
  65. data/sig/geom/bounding_box.rbs +28 -0
  66. data/sig/geom/bounds2d.rbs +20 -0
  67. data/sig/geom/lat_long.rbs +13 -0
  68. data/sig/geom/oriented_bounds2d.rbs +10 -0
  69. data/sig/geom/point2d.rbs +32 -0
  70. data/sig/geom/point3d.rbs +46 -0
  71. data/sig/geom/polygon_mesh.rbs +35 -0
  72. data/sig/geom/transformation.rbs +44 -0
  73. data/sig/geom/transformation2d.rbs +26 -0
  74. data/sig/geom/utm.rbs +14 -0
  75. data/sig/geom/vector2d.rbs +40 -0
  76. data/sig/geom/vector3d.rbs +49 -0
  77. data/sig/geom.rbs +25 -0
  78. data/sig/language_handler.rbs +8 -0
  79. data/sig/layout/angular_dimension.rbs +32 -0
  80. data/sig/layout/auto_text_definition.rbs +73 -0
  81. data/sig/layout/auto_text_definitions.rbs +15 -0
  82. data/sig/layout/connection_point.rbs +6 -0
  83. data/sig/layout/dictionary.rbs +18 -0
  84. data/sig/layout/document.rbs +61 -0
  85. data/sig/layout/ellipse.rbs +5 -0
  86. data/sig/layout/entities.rbs +10 -0
  87. data/sig/layout/entity.rbs +28 -0
  88. data/sig/layout/formatted_text.rbs +30 -0
  89. data/sig/layout/grid.rbs +24 -0
  90. data/sig/layout/group.rbs +17 -0
  91. data/sig/layout/image.rbs +7 -0
  92. data/sig/layout/label.rbs +31 -0
  93. data/sig/layout/layer.rbs +21 -0
  94. data/sig/layout/layer_instance.rbs +9 -0
  95. data/sig/layout/layers.rbs +18 -0
  96. data/sig/layout/linear_dimension.rbs +39 -0
  97. data/sig/layout/locked_entity_error.rbs +4 -0
  98. data/sig/layout/locked_layer_error.rbs +4 -0
  99. data/sig/layout/page.rbs +20 -0
  100. data/sig/layout/page_info.rbs +37 -0
  101. data/sig/layout/pages.rbs +17 -0
  102. data/sig/layout/path.rbs +34 -0
  103. data/sig/layout/rectangle.rbs +15 -0
  104. data/sig/layout/reference_entity.rbs +7 -0
  105. data/sig/layout/sketch_up_model.rbs +54 -0
  106. data/sig/layout/style.rbs +150 -0
  107. data/sig/layout/table.rbs +17 -0
  108. data/sig/layout/table_cell.rbs +13 -0
  109. data/sig/layout/table_column.rbs +10 -0
  110. data/sig/layout/table_row.rbs +10 -0
  111. data/sig/layout.rbs +4 -0
  112. data/sig/length.rbs +37 -0
  113. data/sig/numeric.rbs +23 -0
  114. data/sig/sketchup/animation.rbs +8 -0
  115. data/sig/sketchup/app_observer.rbs +11 -0
  116. data/sig/sketchup/arc_curve.rbs +14 -0
  117. data/sig/sketchup/attribute_dictionaries.rbs +11 -0
  118. data/sig/sketchup/attribute_dictionary.rbs +18 -0
  119. data/sig/sketchup/axes.rbs +13 -0
  120. data/sig/sketchup/behavior.rbs +19 -0
  121. data/sig/sketchup/camera.rbs +33 -0
  122. data/sig/sketchup/classification_schema.rbs +8 -0
  123. data/sig/sketchup/classifications.rbs +12 -0
  124. data/sig/sketchup/color.rbs +22 -0
  125. data/sig/sketchup/component_definition.rbs +43 -0
  126. data/sig/sketchup/component_instance.rbs +32 -0
  127. data/sig/sketchup/console.rbs +8 -0
  128. data/sig/sketchup/construction_line.rbs +17 -0
  129. data/sig/sketchup/construction_point.rbs +5 -0
  130. data/sig/sketchup/curve.rbs +13 -0
  131. data/sig/sketchup/definition_list.rbs +26 -0
  132. data/sig/sketchup/definition_observer.rbs +6 -0
  133. data/sig/sketchup/definitions_observer.rbs +8 -0
  134. data/sig/sketchup/dimension.rbs +18 -0
  135. data/sig/sketchup/dimension_linear.rbs +24 -0
  136. data/sig/sketchup/dimension_observer.rbs +5 -0
  137. data/sig/sketchup/dimension_radial.rbs +9 -0
  138. data/sig/sketchup/drawingelement.rbs +18 -0
  139. data/sig/sketchup/edge.rbs +24 -0
  140. data/sig/sketchup/edge_use.rbs +13 -0
  141. data/sig/sketchup/entities.rbs +61 -0
  142. data/sig/sketchup/entities_builder.rbs +15 -0
  143. data/sig/sketchup/entities_observer.rbs +9 -0
  144. data/sig/sketchup/entity.rbs +21 -0
  145. data/sig/sketchup/entity_observer.rbs +6 -0
  146. data/sig/sketchup/environment.rbs +25 -0
  147. data/sig/sketchup/environments.rbs +18 -0
  148. data/sig/sketchup/environments_observer.rbs +8 -0
  149. data/sig/sketchup/extensions_manager.rbs +11 -0
  150. data/sig/sketchup/face.rbs +44 -0
  151. data/sig/sketchup/frame_change_observer.rbs +5 -0
  152. data/sig/sketchup/group.rbs +38 -0
  153. data/sig/sketchup/http/request.rbs +17 -0
  154. data/sig/sketchup/http/response.rbs +7 -0
  155. data/sig/sketchup/http.rbs +27 -0
  156. data/sig/sketchup/image.rbs +23 -0
  157. data/sig/sketchup/image_rep.rbs +17 -0
  158. data/sig/sketchup/importer.rbs +14 -0
  159. data/sig/sketchup/input_point.rbs +25 -0
  160. data/sig/sketchup/instance_observer.rbs +6 -0
  161. data/sig/sketchup/instance_path.rbs +20 -0
  162. data/sig/sketchup/layer.rbs +20 -0
  163. data/sig/sketchup/layer_folder.rbs +26 -0
  164. data/sig/sketchup/layers.rbs +30 -0
  165. data/sig/sketchup/layers_observer.rbs +13 -0
  166. data/sig/sketchup/licensing/extension_license.rbs +8 -0
  167. data/sig/sketchup/licensing.rbs +15 -0
  168. data/sig/sketchup/line_style.rbs +5 -0
  169. data/sig/sketchup/line_styles.rbs +13 -0
  170. data/sig/sketchup/load_handler.rbs +8 -0
  171. data/sig/sketchup/loop.rbs +10 -0
  172. data/sig/sketchup/material.rbs +74 -0
  173. data/sig/sketchup/materials.rbs +22 -0
  174. data/sig/sketchup/materials_observer.rbs +10 -0
  175. data/sig/sketchup/menu.rbs +9 -0
  176. data/sig/sketchup/model.rbs +105 -0
  177. data/sig/sketchup/model_observer.rbs +23 -0
  178. data/sig/sketchup/options_manager.rbs +12 -0
  179. data/sig/sketchup/options_provider.rbs +23 -0
  180. data/sig/sketchup/options_provider_observer.rbs +5 -0
  181. data/sig/sketchup/overlay.rbs +21 -0
  182. data/sig/sketchup/overlays_manager.rbs +10 -0
  183. data/sig/sketchup/page.rbs +55 -0
  184. data/sig/sketchup/pages.rbs +25 -0
  185. data/sig/sketchup/pages_observer.rbs +7 -0
  186. data/sig/sketchup/pick_helper.rbs +28 -0
  187. data/sig/sketchup/regional_settings.rbs +7 -0
  188. data/sig/sketchup/rendering_options.rbs +89 -0
  189. data/sig/sketchup/rendering_options_observer.rbs +5 -0
  190. data/sig/sketchup/section_plane.rbs +12 -0
  191. data/sig/sketchup/selection.rbs +31 -0
  192. data/sig/sketchup/selection_observer.rbs +8 -0
  193. data/sig/sketchup/set.rbs +15 -0
  194. data/sig/sketchup/shadow_info.rbs +18 -0
  195. data/sig/sketchup/shadow_info_observer.rbs +5 -0
  196. data/sig/sketchup/skp.rbs +5 -0
  197. data/sig/sketchup/snap.rbs +10 -0
  198. data/sig/sketchup/style.rbs +9 -0
  199. data/sig/sketchup/styles.rbs +21 -0
  200. data/sig/sketchup/text.rbs +22 -0
  201. data/sig/sketchup/texture.rbs +14 -0
  202. data/sig/sketchup/texture_writer.rbs +14 -0
  203. data/sig/sketchup/tool.rbs +45 -0
  204. data/sig/sketchup/tools.rbs +14 -0
  205. data/sig/sketchup/tools_observer.rbs +6 -0
  206. data/sig/sketchup/uv_helper.rbs +6 -0
  207. data/sig/sketchup/vertex.rbs +11 -0
  208. data/sig/sketchup/view.rbs +87 -0
  209. data/sig/sketchup/view_observer.rbs +6 -0
  210. data/sig/sketchup.rbs +137 -0
  211. data/sig/sketchup_extension.rbs +23 -0
  212. data/sig/string.rbs +5 -0
  213. data/sig/ui/command.rbs +20 -0
  214. data/sig/ui/html_dialog.rbs +29 -0
  215. data/sig/ui/notification.rbs +16 -0
  216. data/sig/ui/toolbar.rbs +18 -0
  217. data/sig/ui/web_dialog.rbs +38 -0
  218. data/sig/ui.rbs +66 -0
  219. metadata +204 -275
  220. data/ext/attribute_dictionaries.h +0 -8
  221. data/ext/attribute_dictionary.h +0 -8
  222. data/ext/behavior.h +0 -8
  223. data/ext/color.h +0 -8
  224. data/ext/component_definition.h +0 -8
  225. data/ext/component_instance.h +0 -8
  226. data/ext/definition_list.h +0 -8
  227. data/ext/drawing_element.h +0 -8
  228. data/ext/entities.h +0 -8
  229. data/ext/entity.h +0 -8
  230. data/ext/material.h +0 -8
  231. data/ext/materials.h +0 -8
  232. data/ext/model.h +0 -8
  233. data/ext/not_implemented.c +0 -88
  234. data/ext/not_implemented.h +0 -20
  235. data/ext/sketchup.h +0 -9
  236. data/ext/texture.h +0 -8
  237. data/ext/typed_value.c +0 -84
  238. data/ext/typed_value.h +0 -11
  239. data/ext/utils.h +0 -111
  240. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/application.h +0 -36
  241. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/model.h +0 -59
  242. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/overlay.h +0 -248
  243. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/ruby_api.h +0 -118
  244. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/color.h +0 -107
  245. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/common.h +0 -178
  246. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/defs.h +0 -19
  247. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/extension_license.h +0 -62
  248. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/bounding_box.h +0 -34
  249. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/plane3d.h +0 -153
  250. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/point2d.h +0 -96
  251. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/point3d.h +0 -98
  252. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/ray3d.h +0 -64
  253. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/transformation.h +0 -321
  254. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/transformation2d.h +0 -163
  255. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/vector2d.h +0 -235
  256. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/vector3d.h +0 -285
  257. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry.h +0 -152
  258. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/modelexporterplugin.h +0 -165
  259. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/modelimporterplugin.h +0 -183
  260. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/pluginprogresscallback.h +0 -84
  261. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/initialize.h +0 -43
  262. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/length_formatter.h +0 -424
  263. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/arccurve.h +0 -244
  264. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/arrow_type.h +0 -17
  265. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/attribute_dictionary.h +0 -161
  266. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/axes.h +0 -242
  267. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/camera.h +0 -398
  268. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classification_attribute.h +0 -89
  269. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classification_info.h +0 -125
  270. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classifications.h +0 -86
  271. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_definition.h +0 -588
  272. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_instance.h +0 -344
  273. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/curve.h +0 -143
  274. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/defs.h +0 -142
  275. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension.h +0 -222
  276. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_linear.h +0 -421
  277. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_radial.h +0 -194
  278. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_style.h +0 -253
  279. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/drawing_element.h +0 -198
  280. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dynamic_component_attribute.h +0 -92
  281. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dynamic_component_info.h +0 -70
  282. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/edge.h +0 -271
  283. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/edge_use.h +0 -214
  284. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entities.h +0 -834
  285. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity.h +0 -186
  286. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity_list.h +0 -80
  287. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity_list_iterator.h +0 -90
  288. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/face.h +0 -686
  289. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/font.h +0 -138
  290. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/geometry.h +0 -20
  291. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/geometry_input.h +0 -685
  292. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/group.h +0 -244
  293. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/guide_line.h +0 -155
  294. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/guide_point.h +0 -153
  295. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/image.h +0 -288
  296. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/image_rep.h +0 -275
  297. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/instancepath.h +0 -266
  298. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/layer.h +0 -265
  299. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/layer_folder.h +0 -301
  300. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/line_style.h +0 -211
  301. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/line_styles.h +0 -81
  302. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/location.h +0 -65
  303. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/loop.h +0 -182
  304. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/material.h +0 -390
  305. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/mesh_helper.h +0 -187
  306. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model.h +0 -1663
  307. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model_version.h +0 -49
  308. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/opening.h +0 -72
  309. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/options_manager.h +0 -79
  310. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/options_provider.h +0 -166
  311. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/polyline3d.h +0 -140
  312. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/rendering_options.h +0 -179
  313. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/scene.h +0 -836
  314. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/schema.h +0 -56
  315. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/schema_type.h +0 -26
  316. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/section_plane.h +0 -212
  317. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/selection.h +0 -156
  318. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/shadow_info.h +0 -147
  319. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/skp.h +0 -45
  320. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/style.h +0 -303
  321. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/styles.h +0 -190
  322. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/text.h +0 -384
  323. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/texture.h +0 -358
  324. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/texture_writer.h +0 -280
  325. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/typed_value.h +0 -390
  326. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/uv_helper.h +0 -79
  327. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/vertex.h +0 -154
  328. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/sketchup.h +0 -122
  329. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/sketchup_info.h +0 -65
  330. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/slapi.h +0 -16
  331. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/transformation.h +0 -16
  332. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/unicodestring.h +0 -239
  333. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/utils/math_helpers.h +0 -124
  334. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonGeometry.dylib +0 -0
  335. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonGeoutils.dylib +0 -0
  336. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonImage.dylib +0 -4
  337. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonPreferences.dylib +0 -0
  338. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonUnits.dylib +0 -0
  339. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonUtils.dylib +0 -0
  340. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonZip.dylib +0 -0
  341. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Resources/Info.plist +0 -50
  342. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/SketchUpAPI +0 -0
  343. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/_CodeSignature/CodeResources +0 -835
  344. data/sketchup-sdk-win/binaries/layout/x64/LayOutAPI.dll +0 -0
  345. data/sketchup-sdk-win/binaries/layout/x64/LayOutAPI.lib +0 -0
  346. data/sketchup-sdk-win/binaries/layout/x64/LayOutControllers.dll +0 -0
  347. data/sketchup-sdk-win/binaries/layout/x64/LayOutModel.dll +0 -0
  348. data/sketchup-sdk-win/binaries/layout/x64/LayOutRTF.dll +0 -0
  349. data/sketchup-sdk-win/binaries/layout/x64/LayOutUtils.dll +0 -0
  350. data/sketchup-sdk-win/binaries/layout/x64/SketchUpCommonPreferences.dll +0 -0
  351. data/sketchup-sdk-win/binaries/layout/x64/SketchUpViewerAPI.dll +0 -0
  352. data/sketchup-sdk-win/binaries/layout/x64/SketchUpViewerAPI.lib +0 -0
  353. data/sketchup-sdk-win/binaries/layout/x64/pdflib.dll +0 -0
  354. data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpAPI.dll +0 -0
  355. data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpAPI.lib +0 -0
  356. data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpCommonPreferences.dll +0 -0
  357. data/sketchup-sdk-win/binaries/sketchup/x64/sketchup.lib +0 -0
  358. data/sketchup-sdk-win/headers/LayOutAPI/application/application.h +0 -117
  359. data/sketchup-sdk-win/headers/LayOutAPI/common.h +0 -22
  360. data/sketchup-sdk-win/headers/LayOutAPI/geometry/geometry.h +0 -78
  361. data/sketchup-sdk-win/headers/LayOutAPI/initialize.h +0 -36
  362. data/sketchup-sdk-win/headers/LayOutAPI/layout.h +0 -49
  363. data/sketchup-sdk-win/headers/LayOutAPI/model/angulardimension.h +0 -468
  364. data/sketchup-sdk-win/headers/LayOutAPI/model/autotextdefinition.h +0 -569
  365. data/sketchup-sdk-win/headers/LayOutAPI/model/autotextdefinitionlist.h +0 -79
  366. data/sketchup-sdk-win/headers/LayOutAPI/model/connectionpoint.h +0 -107
  367. data/sketchup-sdk-win/headers/LayOutAPI/model/defs.h +0 -42
  368. data/sketchup-sdk-win/headers/LayOutAPI/model/dictionary.h +0 -120
  369. data/sketchup-sdk-win/headers/LayOutAPI/model/document.h +0 -864
  370. data/sketchup-sdk-win/headers/LayOutAPI/model/documentexportoptions.h +0 -59
  371. data/sketchup-sdk-win/headers/LayOutAPI/model/ellipse.h +0 -78
  372. data/sketchup-sdk-win/headers/LayOutAPI/model/entity.h +0 -330
  373. data/sketchup-sdk-win/headers/LayOutAPI/model/entityiterator.h +0 -49
  374. data/sketchup-sdk-win/headers/LayOutAPI/model/entitylist.h +0 -114
  375. data/sketchup-sdk-win/headers/LayOutAPI/model/formattedtext.h +0 -397
  376. data/sketchup-sdk-win/headers/LayOutAPI/model/grid.h +0 -251
  377. data/sketchup-sdk-win/headers/LayOutAPI/model/group.h +0 -243
  378. data/sketchup-sdk-win/headers/LayOutAPI/model/image.h +0 -146
  379. data/sketchup-sdk-win/headers/LayOutAPI/model/imagerep.h +0 -109
  380. data/sketchup-sdk-win/headers/LayOutAPI/model/label.h +0 -332
  381. data/sketchup-sdk-win/headers/LayOutAPI/model/layer.h +0 -207
  382. data/sketchup-sdk-win/headers/LayOutAPI/model/layerinstance.h +0 -117
  383. data/sketchup-sdk-win/headers/LayOutAPI/model/layerlist.h +0 -69
  384. data/sketchup-sdk-win/headers/LayOutAPI/model/lineardimension.h +0 -456
  385. data/sketchup-sdk-win/headers/LayOutAPI/model/page.h +0 -261
  386. data/sketchup-sdk-win/headers/LayOutAPI/model/pageinfo.h +0 -372
  387. data/sketchup-sdk-win/headers/LayOutAPI/model/pagelist.h +0 -81
  388. data/sketchup-sdk-win/headers/LayOutAPI/model/path.h +0 -464
  389. data/sketchup-sdk-win/headers/LayOutAPI/model/rectangle.h +0 -240
  390. data/sketchup-sdk-win/headers/LayOutAPI/model/referenceentity.h +0 -120
  391. data/sketchup-sdk-win/headers/LayOutAPI/model/sketchupmodel.h +0 -624
  392. data/sketchup-sdk-win/headers/LayOutAPI/model/skpfilereference.h +0 -94
  393. data/sketchup-sdk-win/headers/LayOutAPI/model/style.h +0 -1080
  394. data/sketchup-sdk-win/headers/LayOutAPI/model/table.h +0 -470
  395. data/sketchup-sdk-win/headers/LayOutAPI/model/typed_value.h +0 -156
  396. data/sketchup-sdk-win/headers/SketchUpAPI/application/application.h +0 -36
  397. data/sketchup-sdk-win/headers/SketchUpAPI/application/model.h +0 -59
  398. data/sketchup-sdk-win/headers/SketchUpAPI/application/overlay.h +0 -248
  399. data/sketchup-sdk-win/headers/SketchUpAPI/application/ruby_api.h +0 -118
  400. data/sketchup-sdk-win/headers/SketchUpAPI/color.h +0 -107
  401. data/sketchup-sdk-win/headers/SketchUpAPI/common.h +0 -178
  402. data/sketchup-sdk-win/headers/SketchUpAPI/defs.h +0 -19
  403. data/sketchup-sdk-win/headers/SketchUpAPI/extension_license.h +0 -62
  404. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/bounding_box.h +0 -34
  405. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/plane3d.h +0 -153
  406. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/point2d.h +0 -96
  407. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/point3d.h +0 -98
  408. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/ray3d.h +0 -64
  409. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/transformation.h +0 -321
  410. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/transformation2d.h +0 -163
  411. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/vector2d.h +0 -235
  412. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/vector3d.h +0 -285
  413. data/sketchup-sdk-win/headers/SketchUpAPI/geometry.h +0 -152
  414. data/sketchup-sdk-win/headers/SketchUpAPI/import_export/modelexporterplugin.h +0 -165
  415. data/sketchup-sdk-win/headers/SketchUpAPI/import_export/modelimporterplugin.h +0 -183
  416. data/sketchup-sdk-win/headers/SketchUpAPI/import_export/pluginprogresscallback.h +0 -84
  417. data/sketchup-sdk-win/headers/SketchUpAPI/initialize.h +0 -43
  418. data/sketchup-sdk-win/headers/SketchUpAPI/length_formatter.h +0 -424
  419. data/sketchup-sdk-win/headers/SketchUpAPI/model/arccurve.h +0 -244
  420. data/sketchup-sdk-win/headers/SketchUpAPI/model/arrow_type.h +0 -17
  421. data/sketchup-sdk-win/headers/SketchUpAPI/model/attribute_dictionary.h +0 -161
  422. data/sketchup-sdk-win/headers/SketchUpAPI/model/axes.h +0 -242
  423. data/sketchup-sdk-win/headers/SketchUpAPI/model/camera.h +0 -398
  424. data/sketchup-sdk-win/headers/SketchUpAPI/model/classification_attribute.h +0 -89
  425. data/sketchup-sdk-win/headers/SketchUpAPI/model/classification_info.h +0 -125
  426. data/sketchup-sdk-win/headers/SketchUpAPI/model/classifications.h +0 -86
  427. data/sketchup-sdk-win/headers/SketchUpAPI/model/component_definition.h +0 -588
  428. data/sketchup-sdk-win/headers/SketchUpAPI/model/component_instance.h +0 -344
  429. data/sketchup-sdk-win/headers/SketchUpAPI/model/curve.h +0 -143
  430. data/sketchup-sdk-win/headers/SketchUpAPI/model/defs.h +0 -142
  431. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension.h +0 -222
  432. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_linear.h +0 -421
  433. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_radial.h +0 -194
  434. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_style.h +0 -253
  435. data/sketchup-sdk-win/headers/SketchUpAPI/model/drawing_element.h +0 -198
  436. data/sketchup-sdk-win/headers/SketchUpAPI/model/dynamic_component_attribute.h +0 -92
  437. data/sketchup-sdk-win/headers/SketchUpAPI/model/dynamic_component_info.h +0 -70
  438. data/sketchup-sdk-win/headers/SketchUpAPI/model/edge.h +0 -271
  439. data/sketchup-sdk-win/headers/SketchUpAPI/model/edge_use.h +0 -214
  440. data/sketchup-sdk-win/headers/SketchUpAPI/model/entities.h +0 -834
  441. data/sketchup-sdk-win/headers/SketchUpAPI/model/entity.h +0 -186
  442. data/sketchup-sdk-win/headers/SketchUpAPI/model/entity_list.h +0 -80
  443. data/sketchup-sdk-win/headers/SketchUpAPI/model/entity_list_iterator.h +0 -90
  444. data/sketchup-sdk-win/headers/SketchUpAPI/model/face.h +0 -686
  445. data/sketchup-sdk-win/headers/SketchUpAPI/model/font.h +0 -138
  446. data/sketchup-sdk-win/headers/SketchUpAPI/model/geometry.h +0 -20
  447. data/sketchup-sdk-win/headers/SketchUpAPI/model/geometry_input.h +0 -685
  448. data/sketchup-sdk-win/headers/SketchUpAPI/model/group.h +0 -244
  449. data/sketchup-sdk-win/headers/SketchUpAPI/model/guide_line.h +0 -155
  450. data/sketchup-sdk-win/headers/SketchUpAPI/model/guide_point.h +0 -153
  451. data/sketchup-sdk-win/headers/SketchUpAPI/model/image.h +0 -288
  452. data/sketchup-sdk-win/headers/SketchUpAPI/model/image_rep.h +0 -275
  453. data/sketchup-sdk-win/headers/SketchUpAPI/model/instancepath.h +0 -266
  454. data/sketchup-sdk-win/headers/SketchUpAPI/model/layer.h +0 -265
  455. data/sketchup-sdk-win/headers/SketchUpAPI/model/layer_folder.h +0 -301
  456. data/sketchup-sdk-win/headers/SketchUpAPI/model/line_style.h +0 -211
  457. data/sketchup-sdk-win/headers/SketchUpAPI/model/line_styles.h +0 -81
  458. data/sketchup-sdk-win/headers/SketchUpAPI/model/location.h +0 -65
  459. data/sketchup-sdk-win/headers/SketchUpAPI/model/loop.h +0 -182
  460. data/sketchup-sdk-win/headers/SketchUpAPI/model/material.h +0 -390
  461. data/sketchup-sdk-win/headers/SketchUpAPI/model/mesh_helper.h +0 -187
  462. data/sketchup-sdk-win/headers/SketchUpAPI/model/model.h +0 -1663
  463. data/sketchup-sdk-win/headers/SketchUpAPI/model/model_version.h +0 -49
  464. data/sketchup-sdk-win/headers/SketchUpAPI/model/opening.h +0 -72
  465. data/sketchup-sdk-win/headers/SketchUpAPI/model/options_manager.h +0 -79
  466. data/sketchup-sdk-win/headers/SketchUpAPI/model/options_provider.h +0 -166
  467. data/sketchup-sdk-win/headers/SketchUpAPI/model/polyline3d.h +0 -140
  468. data/sketchup-sdk-win/headers/SketchUpAPI/model/rendering_options.h +0 -179
  469. data/sketchup-sdk-win/headers/SketchUpAPI/model/scene.h +0 -836
  470. data/sketchup-sdk-win/headers/SketchUpAPI/model/schema.h +0 -56
  471. data/sketchup-sdk-win/headers/SketchUpAPI/model/schema_type.h +0 -26
  472. data/sketchup-sdk-win/headers/SketchUpAPI/model/section_plane.h +0 -212
  473. data/sketchup-sdk-win/headers/SketchUpAPI/model/selection.h +0 -156
  474. data/sketchup-sdk-win/headers/SketchUpAPI/model/shadow_info.h +0 -147
  475. data/sketchup-sdk-win/headers/SketchUpAPI/model/skp.h +0 -45
  476. data/sketchup-sdk-win/headers/SketchUpAPI/model/style.h +0 -303
  477. data/sketchup-sdk-win/headers/SketchUpAPI/model/styles.h +0 -190
  478. data/sketchup-sdk-win/headers/SketchUpAPI/model/text.h +0 -384
  479. data/sketchup-sdk-win/headers/SketchUpAPI/model/texture.h +0 -358
  480. data/sketchup-sdk-win/headers/SketchUpAPI/model/texture_writer.h +0 -280
  481. data/sketchup-sdk-win/headers/SketchUpAPI/model/typed_value.h +0 -390
  482. data/sketchup-sdk-win/headers/SketchUpAPI/model/uv_helper.h +0 -79
  483. data/sketchup-sdk-win/headers/SketchUpAPI/model/vertex.h +0 -154
  484. data/sketchup-sdk-win/headers/SketchUpAPI/sketchup.h +0 -122
  485. data/sketchup-sdk-win/headers/SketchUpAPI/sketchup_info.h +0 -65
  486. data/sketchup-sdk-win/headers/SketchUpAPI/slapi.h +0 -16
  487. data/sketchup-sdk-win/headers/SketchUpAPI/transformation.h +0 -16
  488. data/sketchup-sdk-win/headers/SketchUpAPI/unicodestring.h +0 -239
  489. data/sketchup-sdk-win/headers/SketchUpAPI/utils/math_helpers.h +0 -124
data/ext/sketchup.c CHANGED
@@ -1,104 +1,130 @@
1
- #include <ruby.h>
2
- #include <stdbool.h>
3
- #include <sketchup.h>
4
- #include <entity.h>
5
- #include <entities.h>
6
- #include <model.h>
7
- #include <material.h>
8
- #include <materials.h>
9
- #include <texture.h>
10
- #include <color.h>
11
- #include <attribute_dictionary.h>
12
- #include <attribute_dictionaries.h>
13
- #include <component_definition.h>
14
- #include <component_instance.h>
15
- #include <definition_list.h>
16
- #include <drawing_element.h>
17
- #include <behavior.h>
18
- #include <not_implemented.h>
19
- #include <utils.h>
1
+ #include <scriptup.h>
20
2
 
21
- SUModelRef active_model = SU_INVALID;
3
+ VALUE mSketchup;
4
+ VALUE mGeom;
22
5
 
23
- SUModelRef Sketchup_get_active_model()
6
+ #define SCRIPTUP_DEFINE_CLASS(var, ns, name, parent) VALUE var;
7
+ SCRIPTUP_CLASSES(SCRIPTUP_DEFINE_CLASS)
8
+
9
+ static SUModelRef active_model = SU_INVALID;
10
+
11
+ SUModelRef Sketchup_get_active_model(void)
24
12
  {
25
13
  return active_model;
26
14
  }
15
+
27
16
  void Sketchup_set_active_model(SUModelRef model)
28
17
  {
29
18
  active_model = model;
30
19
  }
31
20
 
32
- static VALUE Sketchup_open_file(int argc, VALUE *argv, VALUE self)
21
+ static VALUE sketchup_open_file(int argc, VALUE* argv, VALUE self)
33
22
  {
34
23
  VALUE path;
35
- VALUE kwarg_hash;
36
- rb_scan_args(argc, argv, "1:", &path, &kwarg_hash);
24
+ VALUE options;
25
+ rb_scan_args(argc, argv, "1:", &path, &options);
37
26
 
38
- const VALUE kwarg_ids[1] = {
39
- rb_intern_const("with_status")
40
- };
41
- VALUE kwargs[1];
42
- rb_get_kwargs(kwarg_hash, kwarg_ids, 0, 1, kwargs);
43
27
  bool with_status = true;
44
- if (RDEF(kwargs[0]))
45
- with_status = RTEST(kwargs[0]);
28
+ if (!NIL_P(options))
29
+ {
30
+ ID ids[1] = { (rb_intern)("with_status") };
31
+ VALUE values[1];
32
+ rb_get_kwargs(options, ids, 0, 1, values);
33
+ if (values[0] != Qundef)
34
+ with_status = RTEST(values[0]);
35
+ }
46
36
 
47
37
  enum SUModelLoadStatus status;
48
38
  SUModelRef model = SU_INVALID;
49
- enum SUResult result = SUModelCreateFromFileWithStatus(&model, StringValuePtr(path), &status);
50
- if (result != SU_ERROR_NONE)
51
- return false;
39
+ if (SUModelCreateFromFileWithStatus(&model, StringValueCStr(path), &status) != SU_ERROR_NONE)
40
+ return Qfalse;
41
+
42
+ Sketchup_set_active_model(model);
43
+ return with_status ? INT2FIX(status) : Qtrue;
44
+ }
52
45
 
46
+ // Creates an empty model and makes it the active one.
47
+ static VALUE sketchup_file_new(VALUE self)
48
+ {
49
+ SUModelRef model = SU_INVALID;
50
+ if (SUModelCreate(&model) != SU_ERROR_NONE)
51
+ rb_raise(rb_eRuntimeError, "cannot create a model");
53
52
  Sketchup_set_active_model(model);
54
- if (with_status)
55
- return INT2FIX(status);
56
- else
57
- return Qtrue;
53
+ return self;
58
54
  }
59
55
 
60
- static VALUE Sketchup_active_model(VALUE self)
56
+ static VALUE sketchup_active_model(VALUE self)
61
57
  {
62
- if (SUIsValid(active_model))
63
- return Data_Wrap_Struct(rb_path2class(SKETCHUP_MODEL), 0, 0, active_model.ptr);
64
- else
65
- return Qnil;
58
+ return su_wrap_or_nil(cModel, active_model.ptr);
66
59
  }
67
60
 
68
- void Init_sketchup() {
61
+ void Init_sketchup(void)
62
+ {
69
63
  SUInitialize();
70
- VALUE Sketchup = rb_define_module(SKETCHUP);
71
- rb_define_singleton_method(Sketchup, "open_file", Sketchup_open_file, -1);
72
- rb_define_singleton_method(Sketchup, "active_model", Sketchup_active_model, 0);
64
+ mSketchup = rb_define_module("Sketchup");
65
+ mGeom = rb_define_module("Geom");
73
66
 
74
- Model_Init(Sketchup, rb_cObject);
75
- Color_Init(Sketchup, rb_cObject);
76
- ImageRep_Init(Sketchup, rb_cObject);
67
+ #define SCRIPTUP_CREATE_CLASS(var, ns, name, parent) \
68
+ var = rb_define_class_under(ns, name, parent); \
69
+ rb_undef_alloc_func(var);
70
+ SCRIPTUP_CLASSES(SCRIPTUP_CREATE_CLASS)
77
71
 
78
- Entities_Init(Sketchup, rb_cObject);
79
- VALUE Sketchup_Entity = Entity_Init(Sketchup, rb_cObject);
80
- Materials_Init(Sketchup, Sketchup_Entity);
81
- Material_Init(Sketchup, Sketchup_Entity);
82
- DefinitionList_Init(Sketchup, Sketchup_Entity);
83
- AttributeDictionary_Init(Sketchup, Sketchup_Entity);
84
- AttributeDictionaries_Init(Sketchup, Sketchup_Entity);
85
- Texture_Init(Sketchup, Sketchup_Entity);
86
- Behavior_Init(Sketchup, Sketchup_Entity);
87
- Layer_Init(Sketchup, Sketchup_Entity);
88
-
89
- VALUE Geom = rb_define_module(GEOM);
90
- BoundingBox_Init(Geom, rb_cObject);
72
+ rb_define_singleton_method(mSketchup, "open_file", sketchup_open_file, -1);
73
+ rb_define_singleton_method(mSketchup, "active_model", sketchup_active_model, 0);
74
+ rb_define_singleton_method(mSketchup, "file_new", sketchup_file_new, 0);
91
75
 
92
- VALUE Sketchup_DrawingElement = DrawingElement_Init(Sketchup, Sketchup_Entity);
93
- ComponentInstance_Init(Sketchup, Sketchup_DrawingElement);
94
- ComponentDefinition_Init(Sketchup, Sketchup_DrawingElement);
95
- Face_Init(Sketchup, Sketchup_DrawingElement);
96
- ConstructionLine_Init(Sketchup, Sketchup_DrawingElement);
97
- ConstructionPoint_Init(Sketchup, Sketchup_DrawingElement);
98
- Dimension_Init(Sketchup, Sketchup_DrawingElement);
99
- Edge_Init(Sketchup, Sketchup_DrawingElement);
100
- Group_Init(Sketchup, Sketchup_DrawingElement);
101
- Image_Init(Sketchup, Sketchup_DrawingElement);
102
- SectionPlane_Init(Sketchup, Sketchup_DrawingElement);
103
- Text_Init(Sketchup, Sketchup_DrawingElement);
104
- }
76
+ Init_arc_curve();
77
+ Init_attribute_dictionaries();
78
+ Init_attribute_dictionary();
79
+ Init_axes();
80
+ Init_behavior();
81
+ Init_bounding_box();
82
+ Init_camera();
83
+ Init_classifications();
84
+ Init_color();
85
+ Init_component_definition();
86
+ Init_component_instance();
87
+ Init_construction();
88
+ Init_curve();
89
+ Init_definition_list();
90
+ Init_drawing_element();
91
+ Init_entities();
92
+ Init_entities_builder();
93
+ Init_edge();
94
+ Init_edge_use();
95
+ Init_entity();
96
+ Init_environments();
97
+ Init_face();
98
+ Init_geom();
99
+ Init_group();
100
+ Init_image();
101
+ Init_image_rep();
102
+ Init_instance_path();
103
+ Init_lat_long();
104
+ Init_layer();
105
+ Init_layer_folder();
106
+ Init_layers();
107
+ Init_length();
108
+ Init_line_styles();
109
+ Init_loop();
110
+ Init_material();
111
+ Init_materials();
112
+ Init_model();
113
+ Init_options_store();
114
+ Init_page();
115
+ Init_pages();
116
+ Init_point2d();
117
+ Init_point3d();
118
+ Init_polygon_mesh();
119
+ Init_section_plane();
120
+ Init_styles();
121
+ Init_text();
122
+ Init_texture();
123
+ Init_texture_writer();
124
+ Init_transformation();
125
+ Init_transformation2d();
126
+ Init_uv_helper();
127
+ Init_vector2d();
128
+ Init_vector3d();
129
+ Init_vertex();
130
+ }
data/ext/styles.c ADDED
@@ -0,0 +1,91 @@
1
+ #include <scriptup.h>
2
+
3
+ #define STYLES(self) SU_REF(SUStylesRef, self)
4
+
5
+ DEFINE_STRING_GETTER(style_name, SUStyleRef, SUStyleGetName)
6
+ DEFINE_STRING_SETTER(style_set_name, SUStyleRef, SUStyleSetName)
7
+ DEFINE_STRING_GETTER(style_description, SUStyleRef, SUStyleGetDescription)
8
+ DEFINE_STRING_SETTER(style_set_description, SUStyleRef, SUStyleSetDescription)
9
+ DEFINE_STRING_GETTER(style_path, SUStyleRef, SUStyleGetPath)
10
+
11
+ DEFINE_REF_LIST(styles_list, SUStylesRef, SUStylesGetNumStyles, SUStylesGetStyles, SUStyleRef, cStyle)
12
+ DEFINE_REF_GETTER(styles_active_style, SUStylesRef, SUStylesGetActiveStyle, SUStyleRef, cStyle)
13
+ DEFINE_REF_GETTER(styles_selected_style, SUStylesRef, SUStylesGetSelectedStyle, SUStyleRef, cStyle)
14
+ DEFINE_BOOL_GETTER(styles_active_style_changed, SUStylesRef, SUStylesGetActiveStyleChanged)
15
+
16
+ static VALUE styles_to_a(VALUE self) { return styles_list(STYLES(self)); }
17
+ static VALUE styles_each(VALUE self) { su_yield_each(self, styles_to_a(self)); return Qnil; }
18
+
19
+ static VALUE styles_length(VALUE self)
20
+ {
21
+ size_t count = 0;
22
+ SUStylesGetNumStyles(STYLES(self), &count);
23
+ return SIZET2NUM(count);
24
+ }
25
+
26
+ static VALUE styles_aref(VALUE self, VALUE key)
27
+ {
28
+ VALUE styles = styles_to_a(self);
29
+ if (RB_TYPE_P(key, T_STRING))
30
+ return su_find_by(styles, "name", key);
31
+ return rb_ary_entry(styles, NUM2LONG(key));
32
+ }
33
+
34
+ static VALUE styles_add_style(int argc, VALUE* argv, VALUE self)
35
+ {
36
+ VALUE path, select;
37
+ rb_scan_args(argc, argv, "11", &path, &select);
38
+ return BOOL2RB(SUStylesAddStyle(STYLES(self), StringValueCStr(path), RTEST(select)) == SU_ERROR_NONE);
39
+ }
40
+
41
+ static VALUE styles_remove_style(VALUE self, VALUE style)
42
+ {
43
+ SUStyleRef ref = {su_unwrap(style, cStyle)};
44
+ if (SUStylesRemoveStyle(STYLES(self), &ref) != SU_ERROR_NONE)
45
+ rb_raise(rb_eArgError, "cannot remove this style");
46
+ return Qnil;
47
+ }
48
+
49
+ static VALUE styles_set_selected_style(VALUE self, VALUE style)
50
+ {
51
+ SUStylesSetSelectedStyle(STYLES(self), (SUStyleRef){su_unwrap(style, cStyle)});
52
+ return Qnil;
53
+ }
54
+
55
+ static VALUE styles_parent(VALUE self)
56
+ {
57
+ SUModelRef model = SU_INVALID;
58
+ SUEntityGetModel(SU_REF(SUEntityRef, self), &model);
59
+ return su_wrap_or_nil(cModel, model.ptr);
60
+ }
61
+
62
+ // Model#styles
63
+ static VALUE model_styles(VALUE model)
64
+ {
65
+ SUStylesRef styles = SU_INVALID;
66
+ SUModelGetStyles(SU_REF(SUModelRef, model), &styles);
67
+ return su_wrap_or_nil(cStyles, styles.ptr);
68
+ }
69
+
70
+ void Init_styles(void)
71
+ {
72
+ rb_define_method(cStyle, "name", style_name, 0);
73
+ rb_define_method(cStyle, "name=", style_set_name, 1);
74
+ rb_define_method(cStyle, "description", style_description, 0);
75
+ rb_define_method(cStyle, "description=", style_set_description, 1);
76
+ rb_define_method(cStyle, "path", style_path, 0);
77
+ rb_include_module(cStyles, rb_mEnumerable);
78
+ rb_define_method(cStyles, "each", styles_each, 0);
79
+ rb_define_method(cStyles, "[]", styles_aref, 1);
80
+ rb_define_method(cStyles, "count", styles_length, 0);
81
+ rb_define_method(cStyles, "length", styles_length, 0);
82
+ rb_define_method(cStyles, "size", styles_length, 0);
83
+ rb_define_method(cStyles, "active_style", styles_active_style, 0);
84
+ rb_define_method(cStyles, "active_style_changed", styles_active_style_changed, 0);
85
+ rb_define_method(cStyles, "selected_style", styles_selected_style, 0);
86
+ rb_define_method(cStyles, "selected_style=", styles_set_selected_style, 1);
87
+ rb_define_method(cStyles, "add_style", styles_add_style, -1);
88
+ rb_define_method(cStyles, "remove_style", styles_remove_style, 1);
89
+ rb_define_method(cStyles, "parent", styles_parent, 0);
90
+ rb_define_method(cModel, "styles", model_styles, 0);
91
+ }
data/ext/text.c ADDED
@@ -0,0 +1,135 @@
1
+ #include <scriptup.h>
2
+
3
+ #define TEXT_REF(self) SU_REF(SUTextRef, self)
4
+
5
+ DEFINE_STRING_GETTER(text_text, SUTextRef, SUTextGetString)
6
+ DEFINE_STRING_SETTER(text_set_text, SUTextRef, SUTextSetString)
7
+ DEFINE_ENUM_GETTER(text_leader_type, SUTextRef, SUTextGetLeaderType, enum SUTextLeaderType)
8
+ DEFINE_ENUM_GETTER(text_arrow_type, SUTextRef, SUTextGetArrowType, enum SUArrowType)
9
+
10
+ static VALUE text_set_text_bang(VALUE self, VALUE string)
11
+ {
12
+ text_set_text(self, string);
13
+ return self;
14
+ }
15
+
16
+ static VALUE text_set_leader_type(VALUE self, VALUE type)
17
+ {
18
+ int t = NUM2INT(type);
19
+ if (t < SUTextLeaderType_None || t > SUTextLeaderType_PushPin)
20
+ rb_raise(rb_eArgError, "invalid leader type");
21
+ SUTextSetLeaderType(TEXT_REF(self), (enum SUTextLeaderType)t);
22
+ return type;
23
+ }
24
+
25
+ static VALUE text_set_arrow_type(VALUE self, VALUE type)
26
+ {
27
+ int t = NUM2INT(type);
28
+ if (t < SUArrowNone || t > SUArrowOpen)
29
+ rb_raise(rb_eArgError, "invalid arrow type");
30
+ SUTextSetArrowType(TEXT_REF(self), (enum SUArrowType)t);
31
+ return type;
32
+ }
33
+
34
+ static VALUE text_has_leader_p(VALUE self)
35
+ {
36
+ enum SUTextLeaderType type = SUTextLeaderType_None;
37
+ SUTextGetLeaderType(TEXT_REF(self), &type);
38
+ return BOOL2RB(type != SUTextLeaderType_None);
39
+ }
40
+
41
+ static VALUE text_set_display_leader(VALUE self, VALUE display)
42
+ {
43
+ enum SUTextLeaderType type = SUTextLeaderType_None;
44
+ SUTextGetLeaderType(TEXT_REF(self), &type);
45
+ if (!RTEST(display))
46
+ type = SUTextLeaderType_None;
47
+ else if (type == SUTextLeaderType_None)
48
+ type = SUTextLeaderType_ViewBased;
49
+ SUTextSetLeaderType(TEXT_REF(self), type);
50
+ return display;
51
+ }
52
+
53
+ static VALUE text_point(VALUE self)
54
+ {
55
+ struct SUPoint3D p = {0, 0, 0};
56
+ SUInstancePathRef path = SU_INVALID;
57
+ SUTextGetPoint(TEXT_REF(self), &p, &path);
58
+ return su_point3d_new(p);
59
+ }
60
+
61
+ static VALUE text_set_point(VALUE self, VALUE point)
62
+ {
63
+ struct SUPoint3D p = su_to_point3d_like(point);
64
+ SUInstancePathRef none = SU_INVALID;
65
+ SUTextSetPoint(TEXT_REF(self), &p, none);
66
+ return point;
67
+ }
68
+
69
+ static VALUE text_attached_to(VALUE self)
70
+ {
71
+ struct SUPoint3D p = {0, 0, 0};
72
+ SUInstancePathRef path = SU_INVALID;
73
+ SUTextGetPoint(TEXT_REF(self), &p, &path);
74
+ if (SUIsInvalid(path))
75
+ return Qnil;
76
+ VALUE copy = su_instance_path_copy(path);
77
+ if (NIL_P(copy) || RTEST(rb_funcall(copy, (rb_intern)("empty?"), 0)))
78
+ return Qnil;
79
+ return rb_ary_new_from_args(2, copy, su_point3d_new(p));
80
+ }
81
+
82
+ static VALUE text_set_attached_to(VALUE self, VALUE attachment)
83
+ {
84
+ Check_Type(attachment, T_ARRAY);
85
+ if (RARRAY_LEN(attachment) != 2)
86
+ rb_raise(rb_eArgError, "expected [instance_path, point]");
87
+ SUInstancePathRef path = su_to_instance_path(RARRAY_AREF(attachment, 0));
88
+ struct SUPoint3D p = su_to_point3d(RARRAY_AREF(attachment, 1));
89
+ if (SUTextSetPoint(TEXT_REF(self), &p, path) != SU_ERROR_NONE)
90
+ rb_raise(rb_eArgError, "cannot attach text to this path");
91
+ return attachment;
92
+ }
93
+
94
+ static VALUE text_vector(VALUE self)
95
+ {
96
+ struct SUVector3D v = {0, 0, 0};
97
+ SUTextGetLeaderVector(TEXT_REF(self), &v);
98
+ return su_vector3d_new(v);
99
+ }
100
+
101
+ static VALUE text_set_vector(VALUE self, VALUE vector)
102
+ {
103
+ struct SUVector3D v = su_to_vector3d(vector);
104
+ SUTextSetLeaderVector(TEXT_REF(self), &v);
105
+ return vector;
106
+ }
107
+
108
+ void Init_text(void)
109
+ {
110
+ rb_define_const(rb_cObject, "ALeaderNone", INT2FIX(SUTextLeaderType_None));
111
+ rb_define_const(rb_cObject, "ALeaderView", INT2FIX(SUTextLeaderType_ViewBased));
112
+ rb_define_const(rb_cObject, "ALeaderModel", INT2FIX(SUTextLeaderType_PushPin));
113
+ static const struct { const char* name; int value; } arrows[] = {
114
+ {"ARROW_NONE", SUArrowNone}, {"ARROW_SLASH", SUArrowSlash}, {"ARROW_DOT", SUArrowDot},
115
+ {"ARROW_CLOSED", SUArrowClosed}, {"ARROW_OPEN", SUArrowOpen},
116
+ };
117
+ for (size_t i = 0; i < sizeof(arrows) / sizeof(arrows[0]); i++)
118
+ rb_define_const(cDimension, arrows[i].name, INT2FIX(arrows[i].value));
119
+ rb_define_method(cText, "text", text_text, 0);
120
+ rb_define_method(cText, "text=", text_set_text, 1);
121
+ rb_define_method(cText, "set_text", text_set_text_bang, 1);
122
+ rb_define_method(cText, "leader_type", text_leader_type, 0);
123
+ rb_define_method(cText, "leader_type=", text_set_leader_type, 1);
124
+ rb_define_method(cText, "arrow_type", text_arrow_type, 0);
125
+ rb_define_method(cText, "arrow_type=", text_set_arrow_type, 1);
126
+ rb_define_method(cText, "has_leader?", text_has_leader_p, 0);
127
+ rb_define_method(cText, "display_leader?", text_has_leader_p, 0);
128
+ rb_define_method(cText, "display_leader=", text_set_display_leader, 1);
129
+ rb_define_method(cText, "point", text_point, 0);
130
+ rb_define_method(cText, "point=", text_set_point, 1);
131
+ rb_define_method(cText, "attached_to", text_attached_to, 0);
132
+ rb_define_method(cText, "attached_to=", text_set_attached_to, 1);
133
+ rb_define_method(cText, "vector", text_vector, 0);
134
+ rb_define_method(cText, "vector=", text_set_vector, 1);
135
+ }
data/ext/texture.c CHANGED
@@ -1,109 +1,100 @@
1
- #include <stdbool.h>
2
- #include <texture.h>
3
- #include <SketchUpAPI/sketchup.h>
4
- #include <not_implemented.h>
5
- #include <utils.h>
1
+ #include <scriptup.h>
6
2
 
7
- static VALUE Sketchup_Texture_average_color(VALUE self)
3
+ struct texture_dimensions
8
4
  {
9
- SUTextureRef texture = {DATA_PTR(self)};
10
- VALUE c = rb_obj_alloc(rb_path2class(SKETCHUP_COLOR));
11
- SUColor* color = DATA_PTR(c);
12
- enum SUResult result = SUTextureGetAverageColor(texture, color);
13
- if (result != SU_ERROR_NONE)
14
- return Qnil;
15
- return c;
16
- }
5
+ size_t width;
6
+ size_t height;
7
+ double s_scale;
8
+ double t_scale;
9
+ };
17
10
 
18
- static VALUE Sketchup_Texture_filename(VALUE self)
11
+ static struct texture_dimensions texture_dimensions(VALUE self)
19
12
  {
20
- SUTextureRef texture = {DATA_PTR(self)};
21
- VALUE output;
22
- GETSTRING(SUTextureGetFileName, texture, output);
23
- return output;
13
+ struct texture_dimensions d = {0, 0, 0.0, 0.0};
14
+ SUTextureGetDimensions(SU_REF(SUTextureRef, self), &d.width, &d.height, &d.s_scale, &d.t_scale);
15
+ return d;
24
16
  }
25
17
 
26
- static VALUE Sketchup_Texture_image_height(VALUE self)
27
- {
28
- SUTextureRef texture = {DATA_PTR(self)};
29
- size_t width = 0;
30
- size_t height = 0;
31
- double s_scale = 0.0;
32
- double t_scale = 0.0;
33
- SUTextureGetDimensions(texture, &width, &height, &s_scale, &t_scale);
34
- return ULL2NUM(height);
35
- }
18
+ DEFINE_STRING_GETTER(texture_filename, SUTextureRef, SUTextureGetFileName)
36
19
 
37
- static VALUE Sketchup_Texture_height(VALUE self)
20
+ // The caller owns the image rep, so it is released when the Ruby object is collected.
21
+ static VALUE texture_image_rep(int argc, VALUE* argv, VALUE self)
38
22
  {
39
- SUTextureRef texture = {DATA_PTR(self)};
40
- size_t width = 0;
41
- size_t height = 0;
42
- double s_scale = 0.0;
43
- double t_scale = 0.0;
44
- SUTextureGetDimensions(texture, &width, &height, &s_scale, &t_scale);
45
- return DBL2NUM(1.0 / t_scale);
23
+ VALUE colorized;
24
+ rb_scan_args(argc, argv, "01", &colorized);
25
+ SUImageRepRef image = SU_INVALID;
26
+ SUImageRepCreate(&image);
27
+ SUTextureRef texture = SU_REF(SUTextureRef, self);
28
+ enum SUResult result = RTEST(colorized) ? SUTextureGetColorizedImageRep(texture, &image) : SUTextureGetImageRep(texture, &image);
29
+ if (result != SU_ERROR_NONE)
30
+ {
31
+ SUImageRepRelease(&image);
32
+ return Qnil;
33
+ }
34
+ return su_image_rep_new(image);
46
35
  }
47
36
 
48
- static VALUE Sketchup_Texture_width(VALUE self)
37
+ static VALUE texture_average_color(VALUE self)
49
38
  {
50
- SUTextureRef texture = {DATA_PTR(self)};
51
- size_t width = 0;
52
- size_t height = 0;
53
- double s_scale = 0.0;
54
- double t_scale = 0.0;
55
- SUTextureGetDimensions(texture, &width, &height, &s_scale, &t_scale);
56
- return DBL2NUM(1.0 / s_scale);
39
+ SUColor color = {0, 0, 0, 255};
40
+ if (SUTextureGetAverageColor(SU_REF(SUTextureRef, self), &color) != SU_ERROR_NONE)
41
+ return Qnil;
42
+ return su_color_new(color);
57
43
  }
58
44
 
59
- static VALUE Sketchup_Texture_image_width(VALUE self)
60
- {
61
- SUTextureRef texture = {DATA_PTR(self)};
62
- size_t width = 0;
63
- size_t height = 0;
64
- double s_scale = 0.0;
65
- double t_scale = 0.0;
66
- SUTextureGetDimensions(texture, &width, &height, &s_scale, &t_scale);
67
- return ULL2NUM(width);
68
- }
45
+ static VALUE texture_image_width(VALUE self) { return SIZET2NUM(texture_dimensions(self).width); }
46
+ static VALUE texture_image_height(VALUE self) { return SIZET2NUM(texture_dimensions(self).height); }
47
+ static VALUE texture_width(VALUE self) { return DBL2NUM(1.0 / texture_dimensions(self).s_scale); }
48
+ static VALUE texture_height(VALUE self) { return DBL2NUM(1.0 / texture_dimensions(self).t_scale); }
69
49
 
70
- static VALUE Sketchup_Texture_image_rep(VALUE self)
50
+ static VALUE texture_valid_p(VALUE self)
71
51
  {
72
- SUTextureRef texture = {DATA_PTR(self)};
73
- SUImageRepRef image = SU_INVALID;
74
- SUTextureGetImageRep(texture, &image);
75
- return Data_Wrap_Struct(rb_path2class(SKETCHUP_IMAGEREP), 0, 0, image.ptr);
52
+ return BOOL2RB(DATA_PTR(self) != NULL);
76
53
  }
77
54
 
78
- static VALUE Sketchup_Texture_Get_valid(VALUE self)
55
+ static VALUE texture_write(VALUE self, VALUE path, VALUE colorize)
79
56
  {
80
- SUTextureRef texture = {DATA_PTR(self)};
81
- return SUIsValid(texture) ? Qtrue : Qfalse;
57
+ SUTextureRef texture = SU_REF(SUTextureRef, self);
58
+ const char* file = StringValueCStr(path);
59
+ enum SUResult result = RTEST(colorize) ? SUTextureWriteToFile(texture, file) : SUTextureWriteOriginalToFile(texture, file);
60
+ return BOOL2RB(result == SU_ERROR_NONE);
82
61
  }
83
62
 
84
- static VALUE Sketchup_Texture_write(VALUE self, VALUE path, VALUE colorize)
63
+ // A single size keeps the image's aspect ratio; [width, height] sets both (in inches).
64
+ static VALUE texture_set_size(VALUE self, VALUE size)
85
65
  {
86
- SUTextureRef texture = {DATA_PTR(self)};
87
- const char* path_ptr = StringValuePtr(path);
88
- enum SUResult result = SU_ERROR_UNSUPPORTED;
89
- if (RTEST(colorize))
90
- result = SUTextureWriteToFile(texture, path_ptr);
66
+ struct texture_dimensions d = texture_dimensions(self);
67
+ double width;
68
+ double height;
69
+ if (RB_TYPE_P(size, T_ARRAY))
70
+ {
71
+ double wh[2];
72
+ su_array_to_xy(size, wh);
73
+ width = wh[0];
74
+ height = wh[1];
75
+ }
91
76
  else
92
- result = SUTextureWriteOriginalToFile(texture, path_ptr);
93
- return result != SU_ERROR_NONE ? Qfalse : Qtrue;
77
+ {
78
+ width = NUM2DBL(size);
79
+ height = d.width > 0 ? width * (double)d.height / (double)d.width : width;
80
+ }
81
+ if (width <= 0 || height <= 0)
82
+ rb_raise(rb_eArgError, "texture size must be positive");
83
+ // Set takes the size in inches while Get reports its reciprocal as the scale.
84
+ SUTextureSetDimensions(SU_REF(SUTextureRef, self), width, height);
85
+ return size;
94
86
  }
95
87
 
96
- void Texture_Init(VALUE Sketchup, VALUE Sketchup_Entity)
88
+ void Init_texture(void)
97
89
  {
98
- VALUE Sketchup_Texture = rb_define_class_under(Sketchup, TEXTURE, Sketchup_Entity);
99
- rb_undef_alloc_func(Sketchup_Texture);
100
- rb_define_method(Sketchup_Texture, "average_color", Sketchup_Texture_average_color, 0);
101
- rb_define_method(Sketchup_Texture, "filename", Sketchup_Texture_filename, 0);
102
- rb_define_method(Sketchup_Texture, "image_height", Sketchup_Texture_image_height, 0);
103
- rb_define_method(Sketchup_Texture, "height", Sketchup_Texture_height, 0);
104
- rb_define_method(Sketchup_Texture, "image_width", Sketchup_Texture_image_width, 0);
105
- rb_define_method(Sketchup_Texture, "width", Sketchup_Texture_width, 0);
106
- rb_define_method(Sketchup_Texture, "image_rep", Sketchup_Texture_image_rep, 0);
107
- rb_define_method(Sketchup_Texture, "valid?", Sketchup_Texture_Get_valid, 0);
108
- rb_define_method(Sketchup_Texture, "write", Sketchup_Texture_write, 2);
90
+ rb_define_method(cTexture, "size=", texture_set_size, 1);
91
+ rb_define_method(cTexture, "average_color", texture_average_color, 0);
92
+ rb_define_method(cTexture, "filename", texture_filename, 0);
93
+ rb_define_method(cTexture, "image_height", texture_image_height, 0);
94
+ rb_define_method(cTexture, "height", texture_height, 0);
95
+ rb_define_method(cTexture, "image_width", texture_image_width, 0);
96
+ rb_define_method(cTexture, "width", texture_width, 0);
97
+ rb_define_method(cTexture, "image_rep", texture_image_rep, -1);
98
+ rb_define_method(cTexture, "valid?", texture_valid_p, 0);
99
+ rb_define_method(cTexture, "write", texture_write, 2);
109
100
  }