scriptup 2026.0.1 → 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 (501) 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 -215
  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 -287
  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/Frameworks/libCommonGeometry.dylib +0 -0
  241. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonGeoutils.dylib +0 -0
  242. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonImage.dylib +0 -4
  243. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonPreferences.dylib +0 -0
  244. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonUnits.dylib +0 -0
  245. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonUtils.dylib +0 -0
  246. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonZip.dylib +0 -0
  247. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/application.h +0 -36
  248. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/model.h +0 -59
  249. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/overlay.h +0 -262
  250. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/ruby_api.h +0 -118
  251. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/color.h +0 -107
  252. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/common.h +0 -178
  253. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/defs.h +0 -19
  254. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/extension_license.h +0 -70
  255. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/bounding_box.h +0 -34
  256. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/plane3d.h +0 -153
  257. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/point2d.h +0 -96
  258. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/point3d.h +0 -98
  259. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/ray3d.h +0 -64
  260. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/transformation.h +0 -321
  261. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/transformation2d.h +0 -163
  262. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/vector2d.h +0 -235
  263. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/vector3d.h +0 -285
  264. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry.h +0 -154
  265. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/modelexporterplugin.h +0 -165
  266. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/modelimporterplugin.h +0 -187
  267. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/pluginprogresscallback.h +0 -84
  268. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/initialize.h +0 -43
  269. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/length_formatter.h +0 -424
  270. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/arccurve.h +0 -244
  271. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/arrow_type.h +0 -17
  272. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/attribute_dictionary.h +0 -161
  273. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/axes.h +0 -242
  274. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/camera.h +0 -398
  275. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classification_attribute.h +0 -89
  276. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classification_info.h +0 -125
  277. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classifications.h +0 -86
  278. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_definition.h +0 -629
  279. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_definition_snap_to_behavior_private.h +0 -46
  280. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_instance.h +0 -344
  281. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/curve.h +0 -143
  282. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/defs.h +0 -147
  283. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension.h +0 -224
  284. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_linear.h +0 -421
  285. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_radial.h +0 -194
  286. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_style.h +0 -253
  287. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/drawing_element.h +0 -198
  288. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dynamic_component_attribute.h +0 -92
  289. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dynamic_component_info.h +0 -70
  290. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/edge.h +0 -271
  291. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/edge_use.h +0 -214
  292. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entities.h +0 -879
  293. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity.h +0 -189
  294. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity_list.h +0 -80
  295. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity_list_iterator.h +0 -90
  296. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/environment.h +0 -382
  297. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/environments.h +0 -133
  298. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/face.h +0 -702
  299. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/font.h +0 -138
  300. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/geometry.h +0 -20
  301. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/geometry_input.h +0 -695
  302. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/group.h +0 -245
  303. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/guide_line.h +0 -155
  304. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/guide_point.h +0 -153
  305. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/image.h +0 -289
  306. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/image_rep.h +0 -275
  307. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/instancepath.h +0 -266
  308. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/layer.h +0 -265
  309. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/layer_folder.h +0 -301
  310. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/line_style.h +0 -211
  311. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/line_styles.h +0 -81
  312. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/location.h +0 -65
  313. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/loop.h +0 -182
  314. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/material.h +0 -797
  315. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/mesh_helper.h +0 -187
  316. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model.h +0 -1826
  317. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model_entity_type_private.h +0 -44
  318. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model_version.h +0 -49
  319. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/opening.h +0 -72
  320. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/options_manager.h +0 -79
  321. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/options_provider.h +0 -166
  322. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/polyline3d.h +0 -140
  323. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/rendering_options.h +0 -180
  324. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/scene.h +0 -1016
  325. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/schema.h +0 -56
  326. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/schema_type.h +0 -26
  327. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/section_plane.h +0 -212
  328. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/selection.h +0 -156
  329. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/shadow_info.h +0 -147
  330. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/skp.h +0 -45
  331. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/snap.h +0 -183
  332. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/space.h +0 -26
  333. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/style.h +0 -303
  334. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/styles.h +0 -192
  335. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/text.h +0 -392
  336. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/texture.h +0 -380
  337. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/texture_writer.h +0 -280
  338. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/typed_value.h +0 -390
  339. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/uv_helper.h +0 -79
  340. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/vertex.h +0 -154
  341. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/sketchup.h +0 -125
  342. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/sketchup_info.h +0 -65
  343. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/slapi.h +0 -16
  344. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/transformation.h +0 -16
  345. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/unicodestring.h +0 -239
  346. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/utils/math_helpers.h +0 -124
  347. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Resources/Info.plist +0 -50
  348. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/SketchUpAPI +0 -0
  349. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/_CodeSignature/CodeResources +0 -891
  350. data/sketchup-sdk-win/binaries/layout/x64/LayOutAPI.dll +0 -0
  351. data/sketchup-sdk-win/binaries/layout/x64/LayOutAPI.lib +0 -0
  352. data/sketchup-sdk-win/binaries/layout/x64/LayOutControllers.dll +0 -0
  353. data/sketchup-sdk-win/binaries/layout/x64/LayOutModel.dll +0 -0
  354. data/sketchup-sdk-win/binaries/layout/x64/LayOutRTF.dll +0 -0
  355. data/sketchup-sdk-win/binaries/layout/x64/LayOutUtils.dll +0 -0
  356. data/sketchup-sdk-win/binaries/layout/x64/LayOutView.dll +0 -4
  357. data/sketchup-sdk-win/binaries/layout/x64/SketchUpCommonPreferences.dll +0 -0
  358. data/sketchup-sdk-win/binaries/layout/x64/SketchUpViewerAPI.dll +0 -0
  359. data/sketchup-sdk-win/binaries/layout/x64/SketchUpViewerAPI.lib +0 -0
  360. data/sketchup-sdk-win/binaries/layout/x64/pdflib.dll +0 -0
  361. data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpAPI.dll +0 -0
  362. data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpAPI.lib +0 -0
  363. data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpCommonPreferences.dll +0 -0
  364. data/sketchup-sdk-win/binaries/sketchup/x64/sketchup.lib +0 -0
  365. data/sketchup-sdk-win/headers/LayOutAPI/application/application.h +0 -117
  366. data/sketchup-sdk-win/headers/LayOutAPI/common.h +0 -22
  367. data/sketchup-sdk-win/headers/LayOutAPI/geometry/geometry.h +0 -78
  368. data/sketchup-sdk-win/headers/LayOutAPI/initialize.h +0 -36
  369. data/sketchup-sdk-win/headers/LayOutAPI/layout.h +0 -49
  370. data/sketchup-sdk-win/headers/LayOutAPI/model/angulardimension.h +0 -468
  371. data/sketchup-sdk-win/headers/LayOutAPI/model/autotextdefinition.h +0 -569
  372. data/sketchup-sdk-win/headers/LayOutAPI/model/autotextdefinitionlist.h +0 -79
  373. data/sketchup-sdk-win/headers/LayOutAPI/model/connectionpoint.h +0 -107
  374. data/sketchup-sdk-win/headers/LayOutAPI/model/defs.h +0 -42
  375. data/sketchup-sdk-win/headers/LayOutAPI/model/dictionary.h +0 -120
  376. data/sketchup-sdk-win/headers/LayOutAPI/model/document.h +0 -937
  377. data/sketchup-sdk-win/headers/LayOutAPI/model/documentexportoptions.h +0 -78
  378. data/sketchup-sdk-win/headers/LayOutAPI/model/ellipse.h +0 -78
  379. data/sketchup-sdk-win/headers/LayOutAPI/model/entity.h +0 -402
  380. data/sketchup-sdk-win/headers/LayOutAPI/model/entityiterator.h +0 -49
  381. data/sketchup-sdk-win/headers/LayOutAPI/model/entitylist.h +0 -114
  382. data/sketchup-sdk-win/headers/LayOutAPI/model/formattedtext.h +0 -397
  383. data/sketchup-sdk-win/headers/LayOutAPI/model/grid.h +0 -251
  384. data/sketchup-sdk-win/headers/LayOutAPI/model/group.h +0 -244
  385. data/sketchup-sdk-win/headers/LayOutAPI/model/image.h +0 -146
  386. data/sketchup-sdk-win/headers/LayOutAPI/model/imagerep.h +0 -109
  387. data/sketchup-sdk-win/headers/LayOutAPI/model/label.h +0 -332
  388. data/sketchup-sdk-win/headers/LayOutAPI/model/layer.h +0 -207
  389. data/sketchup-sdk-win/headers/LayOutAPI/model/layerinstance.h +0 -117
  390. data/sketchup-sdk-win/headers/LayOutAPI/model/layerlist.h +0 -69
  391. data/sketchup-sdk-win/headers/LayOutAPI/model/lineardimension.h +0 -508
  392. data/sketchup-sdk-win/headers/LayOutAPI/model/page.h +0 -331
  393. data/sketchup-sdk-win/headers/LayOutAPI/model/pageinfo.h +0 -372
  394. data/sketchup-sdk-win/headers/LayOutAPI/model/pagelist.h +0 -81
  395. data/sketchup-sdk-win/headers/LayOutAPI/model/path.h +0 -464
  396. data/sketchup-sdk-win/headers/LayOutAPI/model/rectangle.h +0 -240
  397. data/sketchup-sdk-win/headers/LayOutAPI/model/referenceentity.h +0 -120
  398. data/sketchup-sdk-win/headers/LayOutAPI/model/sketchupmodel.h +0 -681
  399. data/sketchup-sdk-win/headers/LayOutAPI/model/style.h +0 -1116
  400. data/sketchup-sdk-win/headers/LayOutAPI/model/table.h +0 -472
  401. data/sketchup-sdk-win/headers/LayOutAPI/model/typed_value.h +0 -180
  402. data/sketchup-sdk-win/headers/SketchUpAPI/application/application.h +0 -36
  403. data/sketchup-sdk-win/headers/SketchUpAPI/application/model.h +0 -59
  404. data/sketchup-sdk-win/headers/SketchUpAPI/application/overlay.h +0 -262
  405. data/sketchup-sdk-win/headers/SketchUpAPI/application/ruby_api.h +0 -118
  406. data/sketchup-sdk-win/headers/SketchUpAPI/color.h +0 -107
  407. data/sketchup-sdk-win/headers/SketchUpAPI/common.h +0 -178
  408. data/sketchup-sdk-win/headers/SketchUpAPI/defs.h +0 -19
  409. data/sketchup-sdk-win/headers/SketchUpAPI/extension_license.h +0 -70
  410. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/bounding_box.h +0 -34
  411. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/plane3d.h +0 -153
  412. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/point2d.h +0 -96
  413. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/point3d.h +0 -98
  414. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/ray3d.h +0 -64
  415. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/transformation.h +0 -321
  416. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/transformation2d.h +0 -163
  417. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/vector2d.h +0 -235
  418. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/vector3d.h +0 -285
  419. data/sketchup-sdk-win/headers/SketchUpAPI/geometry.h +0 -154
  420. data/sketchup-sdk-win/headers/SketchUpAPI/import_export/modelexporterplugin.h +0 -165
  421. data/sketchup-sdk-win/headers/SketchUpAPI/import_export/modelimporterplugin.h +0 -187
  422. data/sketchup-sdk-win/headers/SketchUpAPI/import_export/pluginprogresscallback.h +0 -84
  423. data/sketchup-sdk-win/headers/SketchUpAPI/initialize.h +0 -43
  424. data/sketchup-sdk-win/headers/SketchUpAPI/length_formatter.h +0 -424
  425. data/sketchup-sdk-win/headers/SketchUpAPI/model/arccurve.h +0 -244
  426. data/sketchup-sdk-win/headers/SketchUpAPI/model/arrow_type.h +0 -17
  427. data/sketchup-sdk-win/headers/SketchUpAPI/model/attribute_dictionary.h +0 -161
  428. data/sketchup-sdk-win/headers/SketchUpAPI/model/axes.h +0 -242
  429. data/sketchup-sdk-win/headers/SketchUpAPI/model/camera.h +0 -398
  430. data/sketchup-sdk-win/headers/SketchUpAPI/model/classification_attribute.h +0 -89
  431. data/sketchup-sdk-win/headers/SketchUpAPI/model/classification_info.h +0 -125
  432. data/sketchup-sdk-win/headers/SketchUpAPI/model/classifications.h +0 -86
  433. data/sketchup-sdk-win/headers/SketchUpAPI/model/component_definition.h +0 -629
  434. data/sketchup-sdk-win/headers/SketchUpAPI/model/component_definition_snap_to_behavior_private.h +0 -46
  435. data/sketchup-sdk-win/headers/SketchUpAPI/model/component_instance.h +0 -344
  436. data/sketchup-sdk-win/headers/SketchUpAPI/model/curve.h +0 -143
  437. data/sketchup-sdk-win/headers/SketchUpAPI/model/defs.h +0 -147
  438. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension.h +0 -224
  439. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_linear.h +0 -421
  440. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_radial.h +0 -194
  441. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_style.h +0 -253
  442. data/sketchup-sdk-win/headers/SketchUpAPI/model/drawing_element.h +0 -198
  443. data/sketchup-sdk-win/headers/SketchUpAPI/model/dynamic_component_attribute.h +0 -92
  444. data/sketchup-sdk-win/headers/SketchUpAPI/model/dynamic_component_info.h +0 -70
  445. data/sketchup-sdk-win/headers/SketchUpAPI/model/edge.h +0 -271
  446. data/sketchup-sdk-win/headers/SketchUpAPI/model/edge_use.h +0 -214
  447. data/sketchup-sdk-win/headers/SketchUpAPI/model/entities.h +0 -879
  448. data/sketchup-sdk-win/headers/SketchUpAPI/model/entity.h +0 -189
  449. data/sketchup-sdk-win/headers/SketchUpAPI/model/entity_list.h +0 -80
  450. data/sketchup-sdk-win/headers/SketchUpAPI/model/entity_list_iterator.h +0 -90
  451. data/sketchup-sdk-win/headers/SketchUpAPI/model/environment.h +0 -382
  452. data/sketchup-sdk-win/headers/SketchUpAPI/model/environments.h +0 -133
  453. data/sketchup-sdk-win/headers/SketchUpAPI/model/face.h +0 -702
  454. data/sketchup-sdk-win/headers/SketchUpAPI/model/font.h +0 -138
  455. data/sketchup-sdk-win/headers/SketchUpAPI/model/geometry.h +0 -20
  456. data/sketchup-sdk-win/headers/SketchUpAPI/model/geometry_input.h +0 -695
  457. data/sketchup-sdk-win/headers/SketchUpAPI/model/group.h +0 -245
  458. data/sketchup-sdk-win/headers/SketchUpAPI/model/guide_line.h +0 -155
  459. data/sketchup-sdk-win/headers/SketchUpAPI/model/guide_point.h +0 -153
  460. data/sketchup-sdk-win/headers/SketchUpAPI/model/image.h +0 -289
  461. data/sketchup-sdk-win/headers/SketchUpAPI/model/image_rep.h +0 -275
  462. data/sketchup-sdk-win/headers/SketchUpAPI/model/instancepath.h +0 -266
  463. data/sketchup-sdk-win/headers/SketchUpAPI/model/layer.h +0 -265
  464. data/sketchup-sdk-win/headers/SketchUpAPI/model/layer_folder.h +0 -301
  465. data/sketchup-sdk-win/headers/SketchUpAPI/model/line_style.h +0 -211
  466. data/sketchup-sdk-win/headers/SketchUpAPI/model/line_styles.h +0 -81
  467. data/sketchup-sdk-win/headers/SketchUpAPI/model/location.h +0 -65
  468. data/sketchup-sdk-win/headers/SketchUpAPI/model/loop.h +0 -182
  469. data/sketchup-sdk-win/headers/SketchUpAPI/model/material.h +0 -797
  470. data/sketchup-sdk-win/headers/SketchUpAPI/model/mesh_helper.h +0 -187
  471. data/sketchup-sdk-win/headers/SketchUpAPI/model/model.h +0 -1826
  472. data/sketchup-sdk-win/headers/SketchUpAPI/model/model_entity_type_private.h +0 -44
  473. data/sketchup-sdk-win/headers/SketchUpAPI/model/model_version.h +0 -49
  474. data/sketchup-sdk-win/headers/SketchUpAPI/model/opening.h +0 -72
  475. data/sketchup-sdk-win/headers/SketchUpAPI/model/options_manager.h +0 -79
  476. data/sketchup-sdk-win/headers/SketchUpAPI/model/options_provider.h +0 -166
  477. data/sketchup-sdk-win/headers/SketchUpAPI/model/polyline3d.h +0 -140
  478. data/sketchup-sdk-win/headers/SketchUpAPI/model/rendering_options.h +0 -180
  479. data/sketchup-sdk-win/headers/SketchUpAPI/model/scene.h +0 -1016
  480. data/sketchup-sdk-win/headers/SketchUpAPI/model/schema.h +0 -56
  481. data/sketchup-sdk-win/headers/SketchUpAPI/model/schema_type.h +0 -26
  482. data/sketchup-sdk-win/headers/SketchUpAPI/model/section_plane.h +0 -212
  483. data/sketchup-sdk-win/headers/SketchUpAPI/model/selection.h +0 -156
  484. data/sketchup-sdk-win/headers/SketchUpAPI/model/shadow_info.h +0 -147
  485. data/sketchup-sdk-win/headers/SketchUpAPI/model/skp.h +0 -45
  486. data/sketchup-sdk-win/headers/SketchUpAPI/model/snap.h +0 -183
  487. data/sketchup-sdk-win/headers/SketchUpAPI/model/space.h +0 -26
  488. data/sketchup-sdk-win/headers/SketchUpAPI/model/style.h +0 -303
  489. data/sketchup-sdk-win/headers/SketchUpAPI/model/styles.h +0 -192
  490. data/sketchup-sdk-win/headers/SketchUpAPI/model/text.h +0 -392
  491. data/sketchup-sdk-win/headers/SketchUpAPI/model/texture.h +0 -380
  492. data/sketchup-sdk-win/headers/SketchUpAPI/model/texture_writer.h +0 -280
  493. data/sketchup-sdk-win/headers/SketchUpAPI/model/typed_value.h +0 -390
  494. data/sketchup-sdk-win/headers/SketchUpAPI/model/uv_helper.h +0 -79
  495. data/sketchup-sdk-win/headers/SketchUpAPI/model/vertex.h +0 -154
  496. data/sketchup-sdk-win/headers/SketchUpAPI/sketchup.h +0 -125
  497. data/sketchup-sdk-win/headers/SketchUpAPI/sketchup_info.h +0 -65
  498. data/sketchup-sdk-win/headers/SketchUpAPI/slapi.h +0 -16
  499. data/sketchup-sdk-win/headers/SketchUpAPI/transformation.h +0 -16
  500. data/sketchup-sdk-win/headers/SketchUpAPI/unicodestring.h +0 -239
  501. data/sketchup-sdk-win/headers/SketchUpAPI/utils/math_helpers.h +0 -124
@@ -0,0 +1,59 @@
1
+ #include <scriptup.h>
2
+
3
+ static VALUE constructionpoint_position(VALUE self)
4
+ {
5
+ struct SUPoint3D p = {0, 0, 0};
6
+ SUGuidePointGetPosition(SU_REF(SUGuidePointRef, self), &p);
7
+ return su_point3d_new(p);
8
+ }
9
+
10
+ struct guide_line
11
+ {
12
+ struct SUPoint3D start;
13
+ struct SUVector3D direction;
14
+ bool infinite;
15
+ };
16
+
17
+ static struct guide_line guide_line_data(VALUE self)
18
+ {
19
+ struct guide_line data = {{0, 0, 0}, {0, 0, 0}, false};
20
+ SUGuideLineGetData(SU_REF(SUGuideLineRef, self), &data.start, &data.direction, &data.infinite);
21
+ return data;
22
+ }
23
+
24
+ static VALUE constructionline_position(VALUE self)
25
+ {
26
+ return su_point3d_new(guide_line_data(self).start);
27
+ }
28
+
29
+ static VALUE constructionline_direction(VALUE self)
30
+ {
31
+ struct SUVector3D v = guide_line_data(self).direction;
32
+ SUVector3DNormalize(&v);
33
+ return su_vector3d_new(v);
34
+ }
35
+
36
+ static VALUE constructionline_start(VALUE self)
37
+ {
38
+ struct guide_line data = guide_line_data(self);
39
+ return data.infinite ? Qnil : su_point3d_new(data.start);
40
+ }
41
+
42
+ static VALUE constructionline_end(VALUE self)
43
+ {
44
+ struct guide_line data = guide_line_data(self);
45
+ if (data.infinite)
46
+ return Qnil;
47
+ struct SUPoint3D end;
48
+ SUPoint3DOffset(&data.start, &data.direction, &end);
49
+ return su_point3d_new(end);
50
+ }
51
+
52
+ void Init_construction(void)
53
+ {
54
+ rb_define_method(cConstructionPoint, "position", constructionpoint_position, 0);
55
+ rb_define_method(cConstructionLine, "position", constructionline_position, 0);
56
+ rb_define_method(cConstructionLine, "direction", constructionline_direction, 0);
57
+ rb_define_method(cConstructionLine, "start", constructionline_start, 0);
58
+ rb_define_method(cConstructionLine, "end", constructionline_end, 0);
59
+ }
data/ext/curve.c ADDED
@@ -0,0 +1,87 @@
1
+ #include <scriptup.h>
2
+
3
+ #define CURVE(self) SU_REF(SUCurveRef, self)
4
+
5
+ DEFINE_REF_LIST(curve_edge_list, SUCurveRef, SUCurveGetNumEdges, SUCurveGetEdges, SUEdgeRef, cEdge)
6
+ DEFINE_SIZE_GETTER(curve_count_edges, SUCurveRef, SUCurveGetNumEdges)
7
+ DEFINE_BOOL_GETTER(curve_is_polygon_p, SUCurveRef, SUCurveIsPolygon)
8
+
9
+ static VALUE curve_edges(VALUE self)
10
+ {
11
+ return curve_edge_list(CURVE(self));
12
+ }
13
+
14
+ static VALUE curve_each_edge(VALUE self)
15
+ {
16
+ su_yield_each(self, curve_edges(self));
17
+ return Qnil;
18
+ }
19
+
20
+ static VALUE curve_first_edge(VALUE self)
21
+ {
22
+ return rb_ary_entry(curve_edges(self), 0);
23
+ }
24
+
25
+ static VALUE curve_last_edge(VALUE self)
26
+ {
27
+ return rb_ary_entry(curve_edges(self), -1);
28
+ }
29
+
30
+ static VALUE curve_length(VALUE self)
31
+ {
32
+ VALUE edges = curve_edges(self);
33
+ double total = 0.0;
34
+ for (long i = 0; i < RARRAY_LEN(edges); i++)
35
+ total += NUM2DBL(rb_funcall(RARRAY_AREF(edges, i), (rb_intern)("length"), 0));
36
+ return su_length_new(total);
37
+ }
38
+
39
+ // Ordered vertices: the start of each edge, plus the end of the last unless the curve is closed.
40
+ static VALUE curve_vertices(VALUE self)
41
+ {
42
+ VALUE edges = curve_edges(self);
43
+ VALUE vertices = rb_ary_new();
44
+ for (long i = 0; i < RARRAY_LEN(edges); i++)
45
+ {
46
+ SUVertexRef start = SU_INVALID;
47
+ SUEdgeGetStartVertex(SU_REF(SUEdgeRef, RARRAY_AREF(edges, i)), &start);
48
+ rb_ary_push(vertices, su_wrap(cVertex, start.ptr));
49
+ }
50
+ if (RARRAY_LEN(edges) > 0)
51
+ {
52
+ SUVertexRef end = SU_INVALID;
53
+ SUEdgeGetEndVertex(SU_REF(SUEdgeRef, RARRAY_AREF(edges, RARRAY_LEN(edges) - 1)), &end);
54
+ VALUE last = su_wrap(cVertex, end.ptr);
55
+ if (!RTEST(rb_ary_includes(vertices, last)))
56
+ rb_ary_push(vertices, last);
57
+ }
58
+ return vertices;
59
+ }
60
+
61
+ static VALUE curve_move_vertices(VALUE self, VALUE points)
62
+ {
63
+ Check_Type(points, T_ARRAY);
64
+ VALUE vertices = curve_vertices(self);
65
+ if (RARRAY_LEN(points) != RARRAY_LEN(vertices))
66
+ rb_raise(rb_eArgError, "expected %ld points, got %ld", RARRAY_LEN(vertices), RARRAY_LEN(points));
67
+ for (long i = 0; i < RARRAY_LEN(points); i++)
68
+ {
69
+ struct SUPoint3D p = su_to_point3d(RARRAY_AREF(points, i));
70
+ if (SUVertexSetPosition(SU_REF(SUVertexRef, RARRAY_AREF(vertices, i)), &p) != SU_ERROR_NONE)
71
+ return Qfalse;
72
+ }
73
+ return Qtrue;
74
+ }
75
+
76
+ void Init_curve(void)
77
+ {
78
+ rb_define_method(cCurve, "edges", curve_edges, 0);
79
+ rb_define_method(cCurve, "each_edge", curve_each_edge, 0);
80
+ rb_define_method(cCurve, "count_edges", curve_count_edges, 0);
81
+ rb_define_method(cCurve, "first_edge", curve_first_edge, 0);
82
+ rb_define_method(cCurve, "last_edge", curve_last_edge, 0);
83
+ rb_define_method(cCurve, "is_polygon?", curve_is_polygon_p, 0);
84
+ rb_define_method(cCurve, "length", curve_length, 0);
85
+ rb_define_method(cCurve, "vertices", curve_vertices, 0);
86
+ rb_define_method(cCurve, "move_vertices", curve_move_vertices, 1);
87
+ }
@@ -1,146 +1,126 @@
1
- #include <stdbool.h>
2
- #include <definition_list.h>
3
- #include <utils.h>
4
- #include <SketchUpAPI/sketchup.h>
1
+ #include <scriptup.h>
5
2
 
6
- void Sketchup_ComponentDefinition_Iterator(SUComponentDefinitionRef definition, void* _)
3
+ DEFINE_REF_LIST(component_definitions, SUModelRef, SUModelGetNumComponentDefinitions,
4
+ SUModelGetComponentDefinitions, SUComponentDefinitionRef, cComponentDefinition)
5
+ DEFINE_REF_LIST(group_definitions, SUModelRef, SUModelGetNumGroupDefinitions,
6
+ SUModelGetGroupDefinitions, SUComponentDefinitionRef, cComponentDefinition)
7
+
8
+ static VALUE definitionlist_to_a(VALUE self)
7
9
  {
8
- rb_yield(Data_Wrap_Struct(rb_path2class(SKETCHUP_COMPONENTDEFINITION), 0, 0, definition.ptr));
10
+ SUModelRef model = SU_REF(SUModelRef, self);
11
+ return rb_ary_concat(component_definitions(model), group_definitions(model));
9
12
  }
10
13
 
11
- void Sketchup_Group_Iterator(SUComponentDefinitionRef group, void* _)
14
+ static VALUE definitionlist_each(VALUE self)
12
15
  {
13
- rb_yield(Data_Wrap_Struct(rb_path2class(SKETCHUP_COMPONENTDEFINITION), 0, 0, group.ptr));
16
+ return su_yield_each(self, definitionlist_to_a(self));
14
17
  }
15
18
 
16
- static VALUE Sketchup_DefinitionList_each(VALUE self)
19
+ static VALUE definitionlist_length(VALUE self)
17
20
  {
18
- SUModelRef model = {DATA_PTR(self)};
19
- FOREACH(SUModelGetNumComponentDefinitions, SUModelGetComponentDefinitions, SUComponentDefinitionRef, model, Sketchup_ComponentDefinition_Iterator, 0);
20
- FOREACH(SUModelGetNumGroupDefinitions, SUModelGetGroupDefinitions, SUComponentDefinitionRef, model, Sketchup_Group_Iterator, 0);
21
- return self;
21
+ SUModelRef model = SU_REF(SUModelRef, self);
22
+ size_t components = 0;
23
+ size_t groups = 0;
24
+ SUModelGetNumComponentDefinitions(model, &components);
25
+ SUModelGetNumGroupDefinitions(model, &groups);
26
+ return SIZET2NUM(components + groups);
22
27
  }
23
28
 
24
- static VALUE Sketchup_DefinitionList_count(VALUE self)
29
+ static VALUE definitionlist_aref(VALUE self, VALUE key)
25
30
  {
26
- SUModelRef model = {DATA_PTR(self)};
27
- size_t cd_count = 0;
28
- size_t gd_count = 0;
29
- SUModelGetNumComponentDefinitions(model, &cd_count);
30
- SUModelGetNumGroupDefinitions(model, &gd_count);
31
- return ULL2NUM(cd_count + gd_count);
31
+ VALUE definitions = definitionlist_to_a(self);
32
+ if (!RB_TYPE_P(key, T_STRING))
33
+ return su_fetch(definitions, key);
34
+ VALUE found = su_find_by(definitions, "name", key);
35
+ return NIL_P(found) ? su_find_by(definitions, "guid", key) : found;
32
36
  }
33
37
 
34
- static VALUE Sketchup_DefinitionList_load(VALUE self, VALUE path)
38
+ static VALUE definitionlist_load(int argc, VALUE* argv, VALUE self)
35
39
  {
36
- SUModelRef model = {DATA_PTR(self)};
40
+ VALUE path;
41
+ VALUE options;
42
+ rb_scan_args(argc, argv, "1:", &path, &options);
43
+ bool allow_newer = false;
44
+ if (!NIL_P(options))
45
+ {
46
+ ID ids[1] = {(rb_intern)("allow_newer")};
47
+ VALUE values[1];
48
+ rb_get_kwargs(options, ids, 0, 1, values);
49
+ allow_newer = values[0] != Qundef && RTEST(values[0]);
50
+ }
37
51
  SUComponentDefinitionRef definition = SU_INVALID;
38
- enum SUModelLoadStatus status;
39
- enum SUResult result = SUModelLoadDefinitionWithStatus(model, StringValuePtr(path), &definition, &status);
40
- if (result != SU_ERROR_NONE)
52
+ enum SUModelLoadStatus status = SUModelLoadStatus_Success;
53
+ if (SUModelLoadDefinitionWithStatus(SU_REF(SUModelRef, self), StringValueCStr(path), &definition, &status) != SU_ERROR_NONE)
41
54
  rb_raise(rb_eStandardError, "Unsuccessful loading of the definition!");
42
- return Data_Wrap_Struct(rb_path2class(SKETCHUP_COMPONENTDEFINITION), 0, 0, definition.ptr);
55
+ if (status == SUModelLoadStatus_Success_MoreRecent && !allow_newer)
56
+ rb_raise(rb_eStandardError, "The file was saved with a newer version of SketchUp");
57
+ return su_wrap(cComponentDefinition, definition.ptr);
43
58
  }
44
59
 
45
- struct DefinitionStringIterationContext
60
+ // Only SketchUp files can be imported through the C API.
61
+ static VALUE definitionlist_import(int argc, VALUE* argv, VALUE self)
46
62
  {
47
- VALUE key;
48
- SUComponentDefinitionRef definition;
49
- };
50
-
51
- void Sketchup_DefinitionList_Get_By_String_Iterator(SUComponentDefinitionRef definition, struct DefinitionStringIterationContext* definition_struct)
52
- {
53
- VALUE definition_name;
54
- VALUE definition_guid;
55
- GETSTRING(SUComponentDefinitionGetName, definition, definition_name);
56
- GETSTRING(SUComponentDefinitionGetGuid, definition, definition_guid);
57
- if (strcmp(StringValuePtr(definition_name), StringValuePtr(definition_struct->key)) == 0 ||
58
- strcmp(StringValuePtr(definition_guid), StringValuePtr(definition_struct->key)) == 0)
59
- definition_struct->definition = definition;
63
+ rb_check_arity(argc, 1, 2);
64
+ VALUE extension = rb_funcall(rb_funcall(rb_cFile, (rb_intern)("extname"), 1, argv[0]), (rb_intern)("downcase"), 0);
65
+ if (!RTEST(rb_str_equal(extension, rb_str_new_cstr(".skp"))))
66
+ rb_raise(rb_eNotImpError, "the C API can only import .skp files");
67
+ return definitionlist_load(1, argv, self);
60
68
  }
61
69
 
62
- struct DefinitionIndexIterationContext
63
- {
64
- int targetIndex;
65
- int currentIndex;
66
- SUComponentDefinitionRef definition;
67
- };
68
-
69
- void Sketchup_DefinitionList_Get_By_Index_Iterator(SUComponentDefinitionRef definition, struct DefinitionIndexIterationContext* definition_struct)
70
+ static VALUE definitionlist_purge_unused(VALUE self)
70
71
  {
71
- if (definition_struct->targetIndex == definition_struct->currentIndex)
72
- definition_struct->definition = definition;
73
- definition_struct->currentIndex += 1;
72
+ VALUE definitions = component_definitions(SU_REF(SUModelRef, self));
73
+ for (long i = 0; i < RARRAY_LEN(definitions); i++)
74
+ {
75
+ SUComponentDefinitionRef definition = SU_REF(SUComponentDefinitionRef, RARRAY_AREF(definitions, i));
76
+ size_t count = 0;
77
+ SUComponentDefinitionGetNumInstances(definition, &count);
78
+ if (count == 0)
79
+ SUModelRemoveComponentDefinitions(SU_REF(SUModelRef, self), 1, &definition);
80
+ }
81
+ return self;
74
82
  }
75
83
 
76
- static VALUE Sketchup_DefinitionList_get(VALUE self, VALUE key)
84
+ static VALUE definitionlist_unique_name(VALUE self, VALUE base)
77
85
  {
78
- SUModelRef model = {DATA_PTR(self)};
79
- if (rb_type(key) == T_STRING)
80
- {
81
- struct DefinitionStringIterationContext definition_struct = {key, SU_INVALID};
82
- FOREACH(
83
- SUModelGetNumComponentDefinitions,
84
- SUModelGetComponentDefinitions,
85
- SUComponentDefinitionRef,
86
- model,
87
- Sketchup_DefinitionList_Get_By_String_Iterator,
88
- &definition_struct);
89
- if (SUIsInvalid(definition_struct.definition))
90
- return Qnil;
91
- return Data_Wrap_Struct(rb_path2class(SKETCHUP_COMPONENTDEFINITION), 0, 0, definition_struct.definition.ptr);
92
- }
93
- else
94
- {
95
- struct DefinitionIndexIterationContext definition_struct = {NUM2INT(key), 0, SU_INVALID};
96
- FOREACH(
97
- SUModelGetNumComponentDefinitions,
98
- SUModelGetComponentDefinitions,
99
- SUComponentDefinitionRef,
100
- model,
101
- Sketchup_DefinitionList_Get_By_Index_Iterator,
102
- &definition_struct);
103
- if (SUIsInvalid(definition_struct.definition))
104
- {
105
- if (definition_struct.targetIndex >= definition_struct.currentIndex)
106
- rb_raise(rb_eIndexError, "index %d out of range [0, %d)", definition_struct.targetIndex, definition_struct.currentIndex);
107
- }
108
- return Data_Wrap_Struct(rb_path2class(SKETCHUP_COMPONENTDEFINITION), 0, 0, definition_struct.definition.ptr);
109
- }
86
+ StringValue(base);
87
+ VALUE definitions = definitionlist_to_a(self);
88
+ VALUE candidate = base;
89
+ for (long n = 1; !NIL_P(su_find_by(definitions, "name", candidate)); n++)
90
+ candidate = rb_sprintf("%"PRIsVALUE"#%ld", base, n);
91
+ return candidate;
110
92
  }
111
93
 
112
- static VALUE Sketchup_DefinitionList_add(VALUE self, VALUE name)
94
+ static VALUE definitionlist_add(VALUE self, VALUE name)
113
95
  {
114
- SUModelRef model = {DATA_PTR(self)};
96
+ const char* name_ptr = StringValueCStr(name);
115
97
  SUComponentDefinitionRef definition = SU_INVALID;
116
98
  SUComponentDefinitionCreate(&definition);
117
- SUComponentDefinitionSetName(definition, StringValuePtr(name));
118
- SUModelAddComponentDefinitions(model, 1, &definition);
119
- return Data_Wrap_Struct(rb_path2class(SKETCHUP_COMPONENTDEFINITION), 0, 0, definition.ptr);
99
+ SUComponentDefinitionSetName(definition, name_ptr);
100
+ SUModelAddComponentDefinitions(SU_REF(SUModelRef, self), 1, &definition);
101
+ return su_wrap(cComponentDefinition, definition.ptr);
120
102
  }
121
103
 
122
- static VALUE Sketchup_DefinitionList_remove(VALUE self, VALUE rb_definition)
104
+ static VALUE definitionlist_remove(VALUE self, VALUE definition)
123
105
  {
124
- if (!rb_obj_is_kind_of(rb_definition, rb_path2class(SKETCHUP_COMPONENTDEFINITION)))
125
- rb_raise(rb_eTypeError, "Wrong type of object given");
126
- SUModelRef model = {DATA_PTR(self)};
127
- SUComponentDefinitionRef definition = {DATA_PTR(rb_definition)};
128
- SUModelRemoveComponentDefinitions(model, 1, &definition);
106
+ SUComponentDefinitionRef ref = {su_unwrap(definition, cComponentDefinition)};
107
+ SUModelRemoveComponentDefinitions(SU_REF(SUModelRef, self), 1, &ref);
129
108
  return Qtrue;
130
109
  }
131
110
 
132
- VALUE DefinitionList_Init(VALUE Sketchup, VALUE Sketchup_Entity)
111
+ void Init_definition_list(void)
133
112
  {
134
- VALUE Sketchup_DefinitionList = rb_define_class_under(Sketchup, DEFINITIONLIST, Sketchup_Entity);
135
- rb_undef_alloc_func(Sketchup_DefinitionList);
136
- rb_include_module(Sketchup_DefinitionList, rb_mEnumerable);
137
- rb_define_method(Sketchup_DefinitionList, "each", Sketchup_DefinitionList_each, 0);
138
- rb_define_method(Sketchup_DefinitionList, "count", Sketchup_DefinitionList_count, 0);
139
- rb_define_method(Sketchup_DefinitionList, "size", Sketchup_DefinitionList_count, 0);
140
- rb_define_method(Sketchup_DefinitionList, "length", Sketchup_DefinitionList_count, 0);
141
- rb_define_method(Sketchup_DefinitionList, "load", Sketchup_DefinitionList_load, 1);
142
- rb_define_method(Sketchup_DefinitionList, "[]", Sketchup_DefinitionList_get, 1);
143
- rb_define_method(Sketchup_DefinitionList, "add", Sketchup_DefinitionList_add, 1);
144
- rb_define_method(Sketchup_DefinitionList, "remove", Sketchup_DefinitionList_remove, 1);
145
- return Sketchup_DefinitionList;
146
- }
113
+ rb_include_module(cDefinitionList, rb_mEnumerable);
114
+ rb_define_method(cDefinitionList, "each", definitionlist_each, 0);
115
+ rb_define_method(cDefinitionList, "count", definitionlist_length, 0);
116
+ rb_define_method(cDefinitionList, "size", definitionlist_length, 0);
117
+ rb_define_method(cDefinitionList, "length", definitionlist_length, 0);
118
+ rb_define_method(cDefinitionList, "load", definitionlist_load, -1);
119
+ rb_define_method(cDefinitionList, "import", definitionlist_import, -1);
120
+ rb_define_method(cDefinitionList, "purge_unused", definitionlist_purge_unused, 0);
121
+ rb_define_method(cDefinitionList, "unique_name", definitionlist_unique_name, 1);
122
+ rb_define_method(cDefinitionList, "[]", definitionlist_aref, 1);
123
+ rb_define_method(cDefinitionList, "at", definitionlist_aref, 1);
124
+ rb_define_method(cDefinitionList, "add", definitionlist_add, 1);
125
+ rb_define_method(cDefinitionList, "remove", definitionlist_remove, 1);
126
+ }
data/ext/depend ADDED
@@ -0,0 +1 @@
1
+ $(OBJS): $(srcdir)/scriptup.h
@@ -1,146 +1,125 @@
1
- #include <stdbool.h>
2
- #include <drawing_element.h>
3
- #include <not_implemented.h>
4
- #include <utils.h>
5
- #include <SketchUpAPI/sketchup.h>
1
+ #include <scriptup.h>
6
2
 
7
- static VALUE Sketchup_DrawingElement_bounds(VALUE self)
3
+ static bool not_rtest(VALUE value)
8
4
  {
9
- SUDrawingElementRef drawing_element = {DATA_PTR(self)};
10
- struct SUBoundingBox3D* bbox = 0;
11
- SUDrawingElementGetBoundingBox(drawing_element, bbox);
12
- return Data_Make_Struct(rb_path2class(GEOM_BOUNDINGBOX), struct SUBoundingBox3D, 0, RUBY_DEFAULT_FREE, bbox);
5
+ return !RTEST(value);
13
6
  }
14
7
 
15
- static VALUE Sketchup_DrawingElement_Get_casts_shadows(VALUE self)
8
+ DEFINE_BOOL_GETTER(drawingelement_casts_shadows_p, SUDrawingElementRef, SUDrawingElementGetCastsShadows)
9
+ DEFINE_BOOL_SETTER(drawingelement_set_casts_shadows, SUDrawingElementRef, SUDrawingElementSetCastsShadows)
10
+ DEFINE_BOOL_GETTER(drawingelement_receives_shadows_p, SUDrawingElementRef, SUDrawingElementGetReceivesShadows)
11
+ DEFINE_BOOL_SETTER(drawingelement_set_receives_shadows, SUDrawingElementRef, SUDrawingElementSetReceivesShadows)
12
+ DEFINE_BOOL_GETTER(drawingelement_hidden_p, SUDrawingElementRef, SUDrawingElementGetHidden)
13
+ DEFINE_BOOL_SETTER(drawingelement_set_hidden, SUDrawingElementRef, SUDrawingElementSetHidden)
14
+ DEFINE_SETTER(drawingelement_set_visible, SUDrawingElementRef, SUDrawingElementSetHidden, not_rtest)
15
+ DEFINE_REF_GETTER(drawingelement_material, SUDrawingElementRef, SUDrawingElementGetMaterial, SUMaterialRef, cMaterial)
16
+ DEFINE_REF_GETTER(drawingelement_layer, SUDrawingElementRef, SUDrawingElementGetLayer, SULayerRef, cLayer)
17
+
18
+ static VALUE drawingelement_visible_p(VALUE self)
16
19
  {
17
- SUDrawingElementRef drawing_element = {DATA_PTR(self)};
18
- bool casts_shadows_flag = false;
19
- SUDrawingElementGetCastsShadows(drawing_element, &casts_shadows_flag);
20
- return casts_shadows_flag ? Qtrue : Qfalse;
20
+ return RTEST(drawingelement_hidden_p(self)) ? Qfalse : Qtrue;
21
21
  }
22
22
 
23
- static VALUE Sketchup_DrawingElement_Set_casts_shadows(VALUE self, VALUE casts_shadows_flag)
23
+ static VALUE drawingelement_bounds(VALUE self)
24
24
  {
25
- SUDrawingElementRef drawing_element = {DATA_PTR(self)};
26
- SUDrawingElementSetCastsShadows(drawing_element, RTEST(casts_shadows_flag));
27
- return casts_shadows_flag;
25
+ struct SUBoundingBox3D bbox;
26
+ SUDrawingElementGetBoundingBox(SU_REF(SUDrawingElementRef, self), &bbox);
27
+ return su_bounding_box_new(bbox);
28
28
  }
29
29
 
30
- static VALUE Sketchup_DrawingElement_Get_receives_shadows(VALUE self)
30
+ static VALUE drawingelement_model(VALUE self)
31
31
  {
32
- SUDrawingElementRef drawing_element = {DATA_PTR(self)};
33
- bool receives_shadows_flag = false;
34
- SUDrawingElementGetReceivesShadows(drawing_element, &receives_shadows_flag);
35
- return receives_shadows_flag ? Qtrue : Qfalse;
32
+ SUModelRef model = SU_INVALID;
33
+ SUEntityGetModel(SU_REF(SUEntityRef, self), &model);
34
+ return su_wrap_or_nil(cModel, model.ptr);
36
35
  }
37
36
 
38
- static VALUE Sketchup_DrawingElement_Set_receives_shadows(VALUE self, VALUE receives_shadows_flag)
37
+ // Material, material name or Color (a new material is added to the model).
38
+ SUMaterialRef su_material_from_arg(VALUE entity, VALUE material)
39
39
  {
40
- SUDrawingElementRef drawing_element = {DATA_PTR(self)};
41
- SUDrawingElementSetReceivesShadows(drawing_element, RTEST(receives_shadows_flag));
42
- return receives_shadows_flag;
43
- }
44
-
45
- static VALUE Sketchup_DrawingElement_Get_hidden(VALUE self)
46
- {
47
- SUDrawingElementRef drawing_element = {DATA_PTR(self)};
48
- bool hide_flag = false;
49
- SUDrawingElementGetHidden(drawing_element, &hide_flag);
50
- return hide_flag ? Qtrue : Qfalse;
51
- }
52
-
53
- static VALUE Sketchup_DrawingElement_Set_hidden(VALUE self, VALUE hide_flag)
54
- {
55
- SUDrawingElementRef drawing_element = {DATA_PTR(self)};
56
- SUDrawingElementSetHidden(drawing_element, RTEST(hide_flag));
57
- return hide_flag;
58
- }
59
-
60
- static VALUE Sketchup_DrawingElement_Get_visible(VALUE self)
61
- {
62
- SUDrawingElementRef drawing_element = {DATA_PTR(self)};
63
- bool hide_flag = false;
64
- SUDrawingElementGetHidden(drawing_element, &hide_flag);
65
- return hide_flag ? Qfalse : Qtrue;
66
- }
67
-
68
- static VALUE Sketchup_DrawingElement_Set_visible(VALUE self, VALUE visible_flag)
69
- {
70
- SUDrawingElementRef drawing_element = {DATA_PTR(self)};
71
- SUDrawingElementSetHidden(drawing_element, RTEST(visible_flag));
72
- return visible_flag;
40
+ SUMaterialRef ref = SU_INVALID;
41
+ if (RB_TYPE_P(material, T_STRING))
42
+ {
43
+ VALUE found = rb_funcall(rb_funcall(drawingelement_model(entity), (rb_intern)("materials"), 0), (rb_intern)("[]"), 1, material);
44
+ if (NIL_P(found))
45
+ rb_raise(rb_eArgError, "material not found: %"PRIsVALUE, material);
46
+ ref.ptr = DATA_PTR(found);
47
+ }
48
+ else if (rb_obj_is_kind_of(material, cColor))
49
+ {
50
+ SUMaterialCreate(&ref);
51
+ SUMaterialSetColor(ref, DATA_PTR(material));
52
+ SUModelRef model = SU_REF(SUModelRef, drawingelement_model(entity));
53
+ SUModelAddMaterials(model, 1, &ref);
54
+ }
55
+ else if (!NIL_P(material))
56
+ ref.ptr = su_unwrap(material, cMaterial);
57
+ return ref;
73
58
  }
74
59
 
75
- static VALUE Sketchup_DrawingElement_Get_material(VALUE self)
60
+ static VALUE drawingelement_set_material(VALUE self, VALUE material)
76
61
  {
77
- SUDrawingElementRef drawing_element = {DATA_PTR(self)};
78
- SUMaterialRef material = SU_INVALID;
79
- SUDrawingElementGetMaterial(drawing_element, &material);
80
- if (SUIsInvalid(material))
81
- return Qnil;
82
- return Data_Wrap_Struct(rb_path2class(SKETCHUP_MATERIAL), 0, 0, material.ptr);
62
+ SUDrawingElementSetMaterial(SU_REF(SUDrawingElementRef, self), su_material_from_arg(self, material));
63
+ return material;
83
64
  }
84
65
 
85
- static VALUE Sketchup_DrawingElement_Set_material(VALUE self, VALUE material)
66
+ // Layer or layer name.
67
+ static VALUE drawingelement_set_layer(VALUE self, VALUE layer)
86
68
  {
87
- SUDrawingElementRef drawing_element = {DATA_PTR(self)};
88
- if (rb_type(material) == T_NIL)
69
+ SULayerRef ref = SU_INVALID;
70
+ if (RB_TYPE_P(layer, T_STRING))
89
71
  {
90
- SUMaterialRef empty_material = SU_INVALID;
91
- SUDrawingElementSetMaterial(drawing_element, empty_material);
92
- return Qnil;
72
+ SUModelRef model = SU_REF(SUModelRef, drawingelement_model(self));
73
+ size_t count = 0;
74
+ SUModelGetNumLayers(model, &count);
75
+ SULayerRef* layers = ZALLOC_N(SULayerRef, count > 0 ? count : 1);
76
+ SUModelGetLayers(model, count, layers, &count);
77
+ for (size_t i = 0; i < count && SUIsInvalid(ref); i++)
78
+ {
79
+ SUStringRef name = SU_INVALID;
80
+ SUStringCreate(&name);
81
+ SULayerGetName(layers[i], &name);
82
+ if (rb_str_equal(su_string_to_rb(name), layer) == Qtrue)
83
+ ref = layers[i];
84
+ SUStringRelease(&name);
85
+ }
86
+ xfree(layers);
87
+ if (SUIsInvalid(ref))
88
+ rb_raise(rb_eArgError, "layer not found: %"PRIsVALUE, layer);
93
89
  }
94
- if (!rb_obj_is_kind_of(material, rb_path2class(SKETCHUP_MATERIAL)))
95
- rb_raise(rb_eTypeError, "Wrong type of object given");
96
-
97
- SUMaterialRef drawing_element_material = {DATA_PTR(material)};
98
- SUDrawingElementSetMaterial(drawing_element, drawing_element_material);
99
- return material;
90
+ else if (!NIL_P(layer))
91
+ {
92
+ if (!rb_obj_is_kind_of(layer, cLayer))
93
+ rb_raise(rb_eArgError, "Wrong type of object given");
94
+ ref.ptr = DATA_PTR(layer);
95
+ }
96
+ SUDrawingElementSetLayer(SU_REF(SUDrawingElementRef, self), ref);
97
+ return layer;
100
98
  }
101
99
 
102
- static VALUE Sketchup_DrawingElement_Get_layer(VALUE self)
100
+ static VALUE drawingelement_erase_bang(VALUE self)
103
101
  {
104
- SUDrawingElementRef drawing_element = {DATA_PTR(self)};
105
- SULayerRef layer = SU_INVALID;
106
- SUDrawingElementGetLayer(drawing_element, &layer);
107
- return Data_Wrap_Struct(rb_path2class(SKETCHUP_LAYER), 0, 0, layer.ptr);
102
+ SUEntityRef entity = SU_REF(SUEntityRef, self);
103
+ SUEntitiesRef parent = SU_INVALID;
104
+ if (SUEntityGetParentEntities(entity, &parent) != SU_ERROR_NONE || SUEntitiesErase(parent, 1, &entity) != SU_ERROR_NONE)
105
+ rb_raise(rb_eTypeError, "cannot erase this entity");
106
+ return Qnil;
108
107
  }
109
108
 
110
- static VALUE Sketchup_DrawingElement_Set_layer(VALUE self, VALUE layer)
109
+ void Init_drawing_element(void)
111
110
  {
112
- if (rb_type(layer) == T_NIL)
113
- {
114
- SUDrawingElementRef drawing_element = {DATA_PTR(self)};
115
- SULayerRef drawing_element_layer = SU_INVALID;
116
- SUDrawingElementSetLayer(drawing_element, drawing_element_layer);
117
- return Qnil;
118
- }
119
- if (!rb_obj_is_kind_of(layer, rb_path2class(SKETCHUP_LAYER)))
120
- rb_raise(rb_eArgError, "Wrong type of object given");
121
-
122
- SUDrawingElementRef drawing_element = {DATA_PTR(self)};
123
- SULayerRef drawing_element_layer = {DATA_PTR(layer)};
124
- SUDrawingElementSetLayer(drawing_element, drawing_element_layer);
125
- return layer;
111
+ rb_define_method(cDrawingelement, "bounds", drawingelement_bounds, 0);
112
+ rb_define_method(cDrawingelement, "casts_shadows?", drawingelement_casts_shadows_p, 0);
113
+ rb_define_method(cDrawingelement, "casts_shadows=", drawingelement_set_casts_shadows, 1);
114
+ rb_define_method(cDrawingelement, "receives_shadows?", drawingelement_receives_shadows_p, 0);
115
+ rb_define_method(cDrawingelement, "receives_shadows=", drawingelement_set_receives_shadows, 1);
116
+ rb_define_method(cDrawingelement, "hidden?", drawingelement_hidden_p, 0);
117
+ rb_define_method(cDrawingelement, "hidden=", drawingelement_set_hidden, 1);
118
+ rb_define_method(cDrawingelement, "visible?", drawingelement_visible_p, 0);
119
+ rb_define_method(cDrawingelement, "visible=", drawingelement_set_visible, 1);
120
+ rb_define_method(cDrawingelement, "material", drawingelement_material, 0);
121
+ rb_define_method(cDrawingelement, "material=", drawingelement_set_material, 1);
122
+ rb_define_method(cDrawingelement, "layer", drawingelement_layer, 0);
123
+ rb_define_method(cDrawingelement, "layer=", drawingelement_set_layer, 1);
124
+ rb_define_method(cDrawingelement, "erase!", drawingelement_erase_bang, 0);
126
125
  }
127
-
128
- VALUE DrawingElement_Init(VALUE Sketchup, VALUE Sketchup_Entity)
129
- {
130
- VALUE Sketchup_DrawingElement = rb_define_class_under(Sketchup, DRAWINGELEMENT, Sketchup_Entity);
131
- rb_undef_alloc_func(Sketchup_DrawingElement);
132
- rb_define_method(Sketchup_DrawingElement, "bounds", Sketchup_DrawingElement_bounds, 0);
133
- rb_define_method(Sketchup_DrawingElement, "casts_shadows?", Sketchup_DrawingElement_Get_casts_shadows, 0);
134
- rb_define_method(Sketchup_DrawingElement, "casts_shadows=", Sketchup_DrawingElement_Set_casts_shadows, 1);
135
- rb_define_method(Sketchup_DrawingElement, "receives_shadows?", Sketchup_DrawingElement_Get_receives_shadows, 0);
136
- rb_define_method(Sketchup_DrawingElement, "receives_shadows=", Sketchup_DrawingElement_Set_receives_shadows, 1);
137
- rb_define_method(Sketchup_DrawingElement, "hidden?", Sketchup_DrawingElement_Get_hidden, 0);
138
- rb_define_method(Sketchup_DrawingElement, "hidden=", Sketchup_DrawingElement_Set_hidden, 1);
139
- rb_define_method(Sketchup_DrawingElement, "visible?", Sketchup_DrawingElement_Get_visible, 0);
140
- rb_define_method(Sketchup_DrawingElement, "visible=", Sketchup_DrawingElement_Set_visible, 1);
141
- rb_define_method(Sketchup_DrawingElement, "material", Sketchup_DrawingElement_Get_material, 0);
142
- rb_define_method(Sketchup_DrawingElement, "material=", Sketchup_DrawingElement_Set_material, 1);
143
- rb_define_method(Sketchup_DrawingElement, "layer", Sketchup_DrawingElement_Get_layer, 0);
144
- rb_define_method(Sketchup_DrawingElement, "layer=", Sketchup_DrawingElement_Set_layer, 1);
145
- return Sketchup_DrawingElement;
146
- }