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
@@ -0,0 +1,145 @@
1
+ #include <scriptup.h>
2
+
3
+ // Wraps the target entities. Geometry is added immediately, so it isn't merged.
4
+ #define VALID "__valid"
5
+
6
+ static VALUE builder_valid_p(VALUE self)
7
+ {
8
+ return BOOL2RB(RTEST(rb_attr_get(self, (rb_intern)(VALID))));
9
+ }
10
+
11
+ static VALUE builder_entities_obj(VALUE self)
12
+ {
13
+ if (!RTEST(builder_valid_p(self)))
14
+ rb_raise(rb_eRuntimeError, "the builder is no longer valid");
15
+ return su_entities_new(SU_REF(SUEntitiesRef, self));
16
+ }
17
+
18
+ static VALUE builder_entities(VALUE self)
19
+ {
20
+ return builder_entities_obj(self);
21
+ }
22
+
23
+ static VALUE builder_add_edge(int argc, VALUE* argv, VALUE self)
24
+ {
25
+ VALUE entities = builder_entities_obj(self);
26
+ VALUE points = argc == 1 ? argv[0] : rb_ary_new_from_values(argc, argv);
27
+ Check_Type(points, T_ARRAY);
28
+ if (RARRAY_LEN(points) != 2)
29
+ rb_raise(rb_eArgError, "expected 2 points");
30
+ return rb_funcall(entities, (rb_intern)("add_line"), 2, RARRAY_AREF(points, 0), RARRAY_AREF(points, 1));
31
+ }
32
+
33
+ static VALUE builder_add_edges(int argc, VALUE* argv, VALUE self)
34
+ {
35
+ return rb_funcallv(builder_entities_obj(self), (rb_intern)("add_edges"), argc, argv);
36
+ }
37
+
38
+ static void loop_points(VALUE points, struct SUPoint3D** out, long* count)
39
+ {
40
+ Check_Type(points, T_ARRAY);
41
+ *count = RARRAY_LEN(points);
42
+ if (*count < 3)
43
+ rb_raise(rb_eArgError, "a loop needs at least 3 points");
44
+ *out = ALLOC_N(struct SUPoint3D, *count);
45
+ for (long i = 0; i < *count; i++)
46
+ (*out)[i] = su_to_point3d_like(RARRAY_AREF(points, i));
47
+ }
48
+
49
+ static VALUE builder_add_face(int argc, VALUE* argv, VALUE self)
50
+ {
51
+ VALUE positional;
52
+ VALUE options;
53
+ rb_scan_args(argc, argv, "*:", &positional, &options);
54
+ SUEntitiesRef entities = SU_REF(SUEntitiesRef, builder_entities_obj(self));
55
+ VALUE outer = RARRAY_LEN(positional) == 1 && RB_TYPE_P(RARRAY_AREF(positional, 0), T_ARRAY) &&
56
+ !rb_obj_is_kind_of(rb_ary_entry(RARRAY_AREF(positional, 0), 0), rb_cNumeric)
57
+ ? RARRAY_AREF(positional, 0) : positional;
58
+ VALUE holes = Qnil;
59
+ if (!NIL_P(options))
60
+ {
61
+ ID ids[1] = {(rb_intern)("holes")};
62
+ VALUE values[1];
63
+ rb_get_kwargs(options, ids, 0, 1, values);
64
+ holes = values[0] == Qundef ? Qnil : values[0];
65
+ }
66
+ struct SUPoint3D* points;
67
+ long count;
68
+ loop_points(outer, &points, &count);
69
+ SUFaceRef face = SU_INVALID;
70
+ enum SUResult result = SUFaceCreateSimple(&face, points, (size_t)count);
71
+ xfree(points);
72
+ if (result != SU_ERROR_NONE)
73
+ rb_raise(rb_eArgError, "points are not planar or don't form a valid face");
74
+ if (!NIL_P(holes))
75
+ {
76
+ Check_Type(holes, T_ARRAY);
77
+ for (long h = 0; h < RARRAY_LEN(holes); h++)
78
+ {
79
+ struct SUPoint3D* hole;
80
+ long hole_count;
81
+ loop_points(RARRAY_AREF(holes, h), &hole, &hole_count);
82
+ SULoopInputRef loop = SU_INVALID;
83
+ SULoopInputCreate(&loop);
84
+ for (long i = 0; i < hole_count; i++)
85
+ SULoopInputAddVertexIndex(loop, (size_t)i);
86
+ result = SUFaceAddInnerLoop(face, hole, &loop);
87
+ xfree(hole);
88
+ if (result != SU_ERROR_NONE)
89
+ rb_raise(rb_eArgError, "invalid hole");
90
+ }
91
+ }
92
+ SUEntitiesAddFaces(entities, 1, &face);
93
+ return su_wrap(cFace, face.ptr);
94
+ }
95
+
96
+ static VALUE builder_vertex_at(VALUE self, VALUE position)
97
+ {
98
+ struct SUPoint3D p = su_to_point3d(position);
99
+ VALUE edges = rb_funcall(rb_funcall(builder_entities_obj(self), (rb_intern)("grep"), 1, cEdge), (rb_intern)("to_a"), 0);
100
+ for (long i = 0; i < RARRAY_LEN(edges); i++)
101
+ {
102
+ VALUE vertices = rb_funcall(RARRAY_AREF(edges, i), (rb_intern)("vertices"), 0);
103
+ for (long j = 0; j < RARRAY_LEN(vertices); j++)
104
+ {
105
+ struct SUPoint3D v = su_to_point3d_like(RARRAY_AREF(vertices, j));
106
+ bool equal = false;
107
+ SUPoint3DGetEqual(&v, &p, &equal);
108
+ if (equal)
109
+ return RARRAY_AREF(vertices, j);
110
+ }
111
+ }
112
+ return Qnil;
113
+ }
114
+
115
+ static VALUE builder_invalidate(VALUE builder)
116
+ {
117
+ rb_ivar_set(builder, (rb_intern)(VALID), Qfalse);
118
+ return Qnil;
119
+ }
120
+
121
+ static VALUE builder_yield(VALUE builder)
122
+ {
123
+ return rb_yield(builder);
124
+ }
125
+
126
+ // Entities#build: yields a builder that is only valid inside the block.
127
+ static VALUE entities_build(VALUE entities)
128
+ {
129
+ VALUE builder = su_wrap(cEntitiesBuilder, DATA_PTR(entities));
130
+ rb_ivar_set(builder, (rb_intern)(VALID), Qtrue);
131
+ rb_ensure(builder_yield, builder, builder_invalidate, builder);
132
+ return Qnil;
133
+ }
134
+
135
+ void Init_entities_builder(void)
136
+ {
137
+ rb_undef_method(rb_singleton_class(cEntitiesBuilder), "new");
138
+ rb_define_method(cEntitiesBuilder, "valid?", builder_valid_p, 0);
139
+ rb_define_method(cEntitiesBuilder, "entities", builder_entities, 0);
140
+ rb_define_method(cEntitiesBuilder, "add_edge", builder_add_edge, -1);
141
+ rb_define_method(cEntitiesBuilder, "add_edges", builder_add_edges, -1);
142
+ rb_define_method(cEntitiesBuilder, "add_face", builder_add_face, -1);
143
+ rb_define_method(cEntitiesBuilder, "vertex_at", builder_vertex_at, 1);
144
+ rb_define_method(cEntities, "build", entities_build, 0);
145
+ }
data/ext/entity.c CHANGED
@@ -1,259 +1,222 @@
1
- #include <stdbool.h>
2
- #include <entity.h>
3
- #include <SketchUpAPI/sketchup.h>
4
- #include <utils.h>
1
+ #include <scriptup.h>
5
2
 
6
- static VALUE Sketchup_Entity_persistentId(VALUE self)
7
- {
8
- SUEntityRef entity = {DATA_PTR(self)};
9
- int64_t presistent_id = 0;
10
- SUEntityGetPersistentID(entity, &presistent_id);
11
- return LONG2NUM(presistent_id);
12
- }
13
-
14
- static VALUE Sketchup_Entity_entityId(VALUE self)
15
- {
16
- SUEntityRef entity = {DATA_PTR(self)};
17
- int32_t entityId = 0;
18
- SUEntityGetID(entity, &entityId);
19
- return LONG2NUM(entityId);
20
- }
3
+ #define REF_TYPE_NAMES(X) \
4
+ X(AttributeDictionary) X(Camera) X(ComponentDefinition) X(ComponentInstance) X(Curve) X(Edge) X(EdgeUse) \
5
+ X(Entities) X(Face) X(Group) X(Image) X(Layer) X(Location) X(Loop) X(MeshHelper) X(Material) X(Model) \
6
+ X(Polyline3D) X(Scene) X(Texture) X(TextureWriter) X(TypedValue) X(UVHelper) X(Vertex) X(RenderingOptions) \
7
+ X(GuidePoint) X(GuideLine) X(Schema) X(SchemaType) X(ShadowInfo) X(Axes) X(ArcCurve) X(SectionPlane) \
8
+ X(DynamicComponentInfo) X(DynamicComponentAttribute) X(Style) X(Styles) X(ImageRep) X(InstancePath) X(Font) \
9
+ X(Dimension) X(DimensionLinear) X(DimensionRadial) X(DimensionStyle) X(Text) X(EntityList) \
10
+ X(EntityListIterator) X(DrawingElement) X(Entity) X(LengthFormatter) X(LineStyle) X(LineStyleManager) \
11
+ X(Selection) X(LayerFolder) X(Environment) X(Environments) X(Snap)
21
12
 
22
- static VALUE Sketchup_Entity_typename(VALUE self)
13
+ static const char* ref_type_name(enum SURefType type)
23
14
  {
24
- SUEntityRef entity = {DATA_PTR(self)};
25
- switch (SUEntityGetType(entity))
15
+ switch (type)
26
16
  {
27
- case SURefType_Unknown: return rb_str_new2("Unknown");
28
- case SURefType_AttributeDictionary: return rb_str_new2("AttributeDictionary");
29
- case SURefType_Camera: return rb_str_new2("Camera");
30
- case SURefType_ComponentDefinition: return rb_str_new2("ComponentDefinition");
31
- case SURefType_ComponentInstance: return rb_str_new2("ComponentInstance");
32
- case SURefType_Curve: return rb_str_new2("Curve");
33
- case SURefType_Edge: return rb_str_new2("Edge");
34
- case SURefType_EdgeUse: return rb_str_new2("EdgeUse");
35
- case SURefType_Entities: return rb_str_new2("Entities");
36
- case SURefType_Face: return rb_str_new2("Face");
37
- case SURefType_Group: return rb_str_new2("Group");
38
- case SURefType_Image: return rb_str_new2("Image");
39
- case SURefType_Layer: return rb_str_new2("Layer");
40
- case SURefType_Location: return rb_str_new2("Location");
41
- case SURefType_Loop: return rb_str_new2("Loop");
42
- case SURefType_MeshHelper: return rb_str_new2("MeshHelper");
43
- case SURefType_Material: return rb_str_new2("Material");
44
- case SURefType_Model: return rb_str_new2("Model");
45
- case SURefType_Polyline3D: return rb_str_new2("Polyline3D");
46
- case SURefType_Scene: return rb_str_new2("Scene");
47
- case SURefType_Texture: return rb_str_new2("Texture");
48
- case SURefType_TextureWriter: return rb_str_new2("TextureWriter");
49
- case SURefType_TypedValue: return rb_str_new2("TypedValue");
50
- case SURefType_UVHelper: return rb_str_new2("UVHelper");
51
- case SURefType_Vertex: return rb_str_new2("Vertex");
52
- case SURefType_RenderingOptions: return rb_str_new2("RenderingOptions");
53
- case SURefType_GuidePoint: return rb_str_new2("GuidePoint");
54
- case SURefType_GuideLine: return rb_str_new2("GuideLine");
55
- case SURefType_Schema: return rb_str_new2("Schema");
56
- case SURefType_SchemaType: return rb_str_new2("SchemaType");
57
- case SURefType_ShadowInfo: return rb_str_new2("ShadowInfo");
58
- case SURefType_Axes: return rb_str_new2("Axes");
59
- case SURefType_ArcCurve: return rb_str_new2("ArcCurve");
60
- case SURefType_SectionPlane: return rb_str_new2("SectionPlane");
61
- case SURefType_DynamicComponentInfo: return rb_str_new2("DynamicComponentInfo");
62
- case SURefType_DynamicComponentAttribute: return rb_str_new2("DynamicComponentAttribute");
63
- case SURefType_Style: return rb_str_new2("Style");
64
- case SURefType_Styles: return rb_str_new2("Styles");
65
- case SURefType_ImageRep: return rb_str_new2("ImageRep");
66
- case SURefType_InstancePath: return rb_str_new2("InstancePath");
67
- case SURefType_Font: return rb_str_new2("Font");
68
- case SURefType_Dimension: return rb_str_new2("Dimension");
69
- case SURefType_DimensionLinear: return rb_str_new2("DimensionLinear");
70
- case SURefType_DimensionRadial: return rb_str_new2("DimensionRadial");
71
- case SURefType_DimensionStyle: return rb_str_new2("DimensionStyle");
72
- case SURefType_Text: return rb_str_new2("Text");
73
- case SURefType_EntityList: return rb_str_new2("EntityList");
74
- case SURefType_EntityListIterator: return rb_str_new2("EntityListIterator");
75
- case SURefType_DrawingElement: return rb_str_new2("DrawingElement");
76
- case SURefType_Entity: return rb_str_new2("Entity");
77
- case SURefType_LengthFormatter: return rb_str_new2("LengthFormatter");
78
- case SURefType_LineStyle: return rb_str_new2("LineStyle");
79
- case SURefType_LineStyleManager: return rb_str_new2("LineStyleManager");
80
- case SURefType_Selection: return rb_str_new2("Selection");
81
- case SURefType_LayerFolder: return rb_str_new2("LayerFolder");
17
+ #define REF_TYPE_CASE(name) case SURefType_##name: return #name;
18
+ REF_TYPE_NAMES(REF_TYPE_CASE)
19
+ default: return "Unknown";
82
20
  }
83
21
  }
84
22
 
85
- static VALUE Sketchup_Entity_parent(VALUE self)
86
- {
87
- SUEntityRef entity = {DATA_PTR(self)};
88
- SUEntitiesRef entities = SU_INVALID;
89
- SUEntityGetParentEntities(entity, &entities);
90
- return Data_Wrap_Struct(rb_path2class(SKETCHUP_DEFINITIONLIST), 0, 0, entities.ptr);
91
- }
92
-
93
- static VALUE Sketchup_Entity_model(VALUE self)
94
- {
95
- SUEntityRef entity = {DATA_PTR(self)};
96
- SUModelRef model = SU_INVALID;
97
- SUEntityGetModel(entity, &model);
98
- return Data_Wrap_Struct(rb_path2class(SKETCHUP_MODEL), 0, 0, model.ptr);
99
- }
23
+ DEFINE_GETTER(entity_persistent_id, SUEntityRef, SUEntityGetPersistentID, int64_t, 0, LL2NUM)
24
+ DEFINE_GETTER(entity_entityID, SUEntityRef, SUEntityGetID, int32_t, 0, INT2NUM)
25
+ DEFINE_REF_GETTER(entity_model, SUEntityRef, SUEntityGetModel, SUModelRef, cModel)
26
+ DEFINE_REF_LIST(entity_dictionary_list, SUEntityRef, SUEntityGetNumAttributeDictionaries,
27
+ SUEntityGetAttributeDictionaries, SUAttributeDictionaryRef, cAttributeDictionary)
28
+
29
+ static VALUE entity_typename(VALUE self)
30
+ {
31
+ return rb_str_new_cstr(ref_type_name(SUEntityGetType(SU_REF(SUEntityRef, self))));
32
+ }
33
+
34
+ static const struct { enum SURefType type; VALUE* klass; } entity_classes[] = {
35
+ {SURefType_ArcCurve, &cArcCurve},
36
+ {SURefType_AttributeDictionary, &cAttributeDictionary},
37
+ {SURefType_Axes, &cAxes},
38
+ {SURefType_Curve, &cCurve},
39
+ {SURefType_EdgeUse, &cEdgeUse},
40
+ {SURefType_Loop, &cLoop},
41
+ {SURefType_Vertex, &cVertex},
42
+ {SURefType_ComponentDefinition, &cComponentDefinition},
43
+ {SURefType_ComponentInstance, &cComponentInstance},
44
+ {SURefType_Dimension, &cDimension},
45
+ {SURefType_DimensionLinear, &cDimension},
46
+ {SURefType_DimensionRadial, &cDimension},
47
+ {SURefType_Edge, &cEdge},
48
+ {SURefType_Face, &cFace},
49
+ {SURefType_Group, &cGroup},
50
+ {SURefType_GuideLine, &cConstructionLine},
51
+ {SURefType_GuidePoint, &cConstructionPoint},
52
+ {SURefType_Image, &cImage},
53
+ {SURefType_Layer, &cLayer},
54
+ {SURefType_LayerFolder, &cLayerFolder},
55
+ {SURefType_LineStyle, &cLineStyle},
56
+ {SURefType_Material, &cMaterial},
57
+ {SURefType_Scene, &cPage},
58
+ {SURefType_RenderingOptions, &cRenderingOptions},
59
+ {SURefType_ShadowInfo, &cShadowInfo},
60
+ {SURefType_Style, &cStyle},
61
+ {SURefType_Styles, &cStyles},
62
+ {SURefType_Environment, &cEnvironment},
63
+ {SURefType_Environments, &cEnvironments},
64
+ {SURefType_SectionPlane, &cSectionPlane},
65
+ {SURefType_Text, &cText},
66
+ {SURefType_Texture, &cTexture},
67
+ };
100
68
 
101
- static VALUE Sketchup_Entity_remove_observer(VALUE self, VALUE observer)
69
+ // Wraps an entity as the Ruby class matching its runtime type.
70
+ VALUE su_wrap_entity(SUEntityRef entity)
102
71
  {
103
- #pragma clang diagnostic push
104
- #pragma clang diagnostic ignored "-Wcompound-token-split-by-macro"
105
- if (!RTEST(rb_ivar_defined(self, rb_intern("@observers"))))
106
- #pragma clang diagnostic pop
107
- return Qfalse;
108
-
109
- VALUE result = rb_hash_delete(rb_iv_get(self, "@observers"), observer);
110
-
111
- return RTEST(result) ? Qtrue : Qfalse;
72
+ if (SUIsInvalid(entity))
73
+ return Qnil;
74
+ enum SURefType type = SUEntityGetType(entity);
75
+ for (size_t i = 0; i < sizeof(entity_classes) / sizeof(entity_classes[0]); i++)
76
+ if (entity_classes[i].type == type)
77
+ return su_wrap(*entity_classes[i].klass, entity.ptr);
78
+ return su_wrap(cEntity, entity.ptr);
112
79
  }
113
80
 
114
- #pragma clang diagnostic push
115
- #pragma clang diagnostic ignored "-Wcompound-token-split-by-macro"
116
- #pragma clang diagnostic ignored "-Wunused-but-set-variable"
117
- static VALUE Sketchup_Entity_add_observer(VALUE self, VALUE observer)
81
+ static VALUE entity_parent(VALUE self)
118
82
  {
119
- VALUE observers = Qnil;
120
- if (RTEST(rb_ivar_defined(self, rb_intern("@observers"))))
83
+ SUEntityRef entity = SU_REF(SUEntityRef, self);
84
+ if (SUEntityGetType(entity) == SURefType_ComponentDefinition)
121
85
  {
122
- observers = rb_iv_get(self, "@observers");
86
+ SUModelRef model = SU_INVALID;
87
+ SUEntityGetModel(entity, &model);
88
+ return su_wrap_or_nil(cDefinitionList, model.ptr);
123
89
  }
124
- else
125
- {
126
- observers = rb_hash_new();
127
- rb_iv_set(self, "@observers", rb_hash_new());
128
- }
129
- rb_hash_aset(self, observer, observer);
130
- return Qtrue;
90
+ SUEntitiesRef entities = SU_INVALID;
91
+ struct SUEntitiesParent parent = {SU_INVALID, SU_INVALID};
92
+ if (SUEntityGetParentEntities(entity, &entities) != SU_ERROR_NONE || SUEntitiesGetParent(entities, &parent) != SU_ERROR_NONE)
93
+ return Qnil;
94
+ if (SUIsValid(parent.definition))
95
+ return su_wrap(cComponentDefinition, parent.definition.ptr);
96
+ return su_wrap_or_nil(cModel, parent.model.ptr);
131
97
  }
132
- #pragma clang diagnostic pop
133
98
 
134
- void Sketchup_Entity_attribute_dictionaries_Iterator(SUAttributeDictionaryRef dictionary, VALUE* ary)
99
+ // Entities are equal when they wrap the same ref or share an entity ID (refs aren't unique on every platform).
100
+ static int32_t entity_id(VALUE self)
135
101
  {
136
- rb_ary_push(*ary, Data_Wrap_Struct(rb_path2class(SKETCHUP_ATTRIBUTEDICTIONARY), 0, 0, dictionary.ptr));
102
+ int32_t id = 0;
103
+ SUEntityGetID(SU_REF(SUEntityRef, self), &id);
104
+ return id;
137
105
  }
138
106
 
139
- static VALUE Sketchup_Entity_attribute_dictionaries(VALUE self)
107
+ static VALUE entity_eq(VALUE self, VALUE other)
140
108
  {
141
- SUEntityRef entity = {DATA_PTR(self)};
142
- return Data_Wrap_Struct(rb_path2class(SKETCHUP_ATTRIBUTEDICTIONARIES), 0, 0, entity.ptr);
109
+ if (!rb_obj_is_kind_of(other, cEntity))
110
+ return Qfalse;
111
+ if (DATA_PTR(self) == DATA_PTR(other))
112
+ return Qtrue;
113
+ int32_t id = entity_id(self);
114
+ return BOOL2RB(id != 0 && id == entity_id(other) && rb_obj_class(self) == rb_obj_class(other));
143
115
  }
144
116
 
145
- struct AttributeDictionaryIterationContext
117
+ static VALUE entity_hash(VALUE self)
146
118
  {
147
- VALUE key;
148
- SUAttributeDictionaryRef dictionary;
149
- };
150
-
119
+ int32_t id = entity_id(self);
120
+ VALUE key = id != 0 ? INT2NUM(id) : ULL2NUM((unsigned long long)(uintptr_t)DATA_PTR(self));
121
+ return rb_funcall(key, (rb_intern)("hash"), 0);
122
+ }
151
123
 
152
- void Sketchup_Entity_attribute_dictionary_Iterator(SUAttributeDictionaryRef dictionary, struct AttributeDictionaryIterationContext* attribute_dictionary_struct)
124
+ static VALUE entity_attribute_dictionaries(VALUE self)
153
125
  {
154
- VALUE output;
155
- GETSTRING(SUAttributeDictionaryGetName, dictionary, output);
156
- if (strcmp(StringValuePtr(output), StringValuePtr(attribute_dictionary_struct->key)) == 0)
157
- attribute_dictionary_struct->dictionary = dictionary;
126
+ return su_wrap(cAttributeDictionaries, DATA_PTR(self));
158
127
  }
159
128
 
160
- static VALUE Sketchup_Entity_attribute_dictionary(int argc, VALUE* argv, VALUE self)
129
+ static VALUE entity_find_dictionary(VALUE self, VALUE name)
161
130
  {
162
- if (rb_obj_is_kind_of(self, rb_path2class(SKETCHUP_MATERIALS)))
163
- return Qnil;
164
- if (rb_obj_is_kind_of(self, rb_path2class(SKETCHUP_DEFINITIONLIST)))
165
- return Qnil;
166
- SUEntityRef entity = {DATA_PTR(self)};
167
- struct AttributeDictionaryIterationContext attribute_dictionary_struct = {argv[0], SU_INVALID};
168
- FOREACH(SUEntityGetNumAttributeDictionaries, SUEntityGetAttributeDictionaries, SUAttributeDictionaryRef, entity, Sketchup_Entity_attribute_dictionary_Iterator, &attribute_dictionary_struct);
169
- if (SUIsInvalid(attribute_dictionary_struct.dictionary) && argc > 1 && argv[1])
170
- {
171
- SUAttributeDictionaryCreate(&attribute_dictionary_struct.dictionary, StringValuePtr(argv[0]));
172
- SUEntityAddAttributeDictionary(entity, attribute_dictionary_struct.dictionary);
173
- return Data_Wrap_Struct(rb_path2class(SKETCHUP_ATTRIBUTEDICTIONARY), 0, 0, attribute_dictionary_struct.dictionary.ptr);
174
- }
175
- else if(SUIsValid(attribute_dictionary_struct.dictionary))
176
- return Data_Wrap_Struct(rb_path2class(SKETCHUP_ATTRIBUTEDICTIONARY), 0, 0, attribute_dictionary_struct.dictionary.ptr);
177
- else
178
- return Qnil;
131
+ return su_find_by(entity_dictionary_list(SU_REF(SUEntityRef, self)), "name", name);
179
132
  }
180
133
 
181
- static VALUE Sketchup_Entity_delete_attribute(int argc, VALUE* argv, VALUE self)
134
+ static VALUE entity_attribute_dictionary(int argc, VALUE* argv, VALUE self)
182
135
  {
183
- SUEntityRef entity = {DATA_PTR(self)};
184
- if (argc == 0)
185
- {
186
- rb_raise(rb_eArgError, "Dictionary name required");
187
- }
188
- else if (argc == 1 && rb_type(argv[0]) == T_STRING)
189
- {
190
- if (strcmp(StringValuePtr(argv[0]), "SU_InstanceSet") == 0 || strcmp(StringValuePtr(argv[0]), "SU_DefinitionSet") == 0)
191
- rb_raise(rb_eArgError, "Cannot delete internal");
136
+ VALUE name;
137
+ VALUE create;
138
+ rb_scan_args(argc, argv, "11", &name, &create);
139
+ StringValue(name);
140
+ if (rb_obj_is_kind_of(self, cMaterials) || rb_obj_is_kind_of(self, cDefinitionList))
141
+ return Qnil;
192
142
 
193
- struct AttributeDictionaryIterationContext attribute_dictionary_struct = {argv[0], SU_INVALID};
194
- FOREACH(SUEntityGetNumAttributeDictionaries, SUEntityGetAttributeDictionaries, SUAttributeDictionaryRef, entity, Sketchup_Entity_attribute_dictionary_Iterator, &attribute_dictionary_struct);
195
- if (SUIsValid(attribute_dictionary_struct.dictionary))
196
- {
197
- SUAttributeDictionaryRelease(&attribute_dictionary_struct.dictionary);
198
- return Qtrue;
199
- }
200
- }
201
- else if (argc > 1)
143
+ VALUE dictionary = entity_find_dictionary(self, name);
144
+ if (NIL_P(dictionary) && RTEST(create))
202
145
  {
203
- //ToDo use Sketchup_AttributeDictionary_delete_key
146
+ SUAttributeDictionaryRef created = SU_INVALID;
147
+ SUAttributeDictionaryCreate(&created, StringValueCStr(name));
148
+ SUEntityAddAttributeDictionary(SU_REF(SUEntityRef, self), created);
149
+ dictionary = su_wrap(cAttributeDictionary, created.ptr);
204
150
  }
205
- return Qfalse;
151
+ return dictionary;
206
152
  }
207
153
 
208
- static VALUE Sketchup_Entity_deleted(VALUE self)
154
+ static VALUE entity_delete_attribute(int argc, VALUE* argv, VALUE self)
209
155
  {
210
- SUEntityRef entity = {DATA_PTR(self)};
211
- return SUIsInvalid(entity) ? Qtrue : Qfalse;
156
+ VALUE name;
157
+ VALUE key;
158
+ rb_scan_args(argc, argv, "11", &name, &key);
159
+ const char* name_ptr = StringValueCStr(name);
160
+ if (strcmp(name_ptr, "SU_InstanceSet") == 0 || strcmp(name_ptr, "SU_DefinitionSet") == 0)
161
+ rb_raise(rb_eArgError, "Cannot delete internal");
162
+ if (!NIL_P(key))
163
+ rb_raise(rb_eNotImpError, "the C API cannot delete a single attribute key");
164
+
165
+ VALUE dictionary = entity_find_dictionary(self, name);
166
+ if (NIL_P(dictionary))
167
+ return Qfalse;
168
+ SUAttributeDictionaryRef ref = SU_REF(SUAttributeDictionaryRef, dictionary);
169
+ SUAttributeDictionaryRelease(&ref);
170
+ return Qtrue;
212
171
  }
213
172
 
214
- static VALUE Sketchup_Entity_valid(VALUE self)
173
+ static VALUE entity_valid_p(VALUE self)
215
174
  {
216
- SUEntityRef entity = {DATA_PTR(self)};
217
- return SUIsValid(entity) ? Qtrue : Qfalse;
175
+ return BOOL2RB(DATA_PTR(self) != NULL);
218
176
  }
219
177
 
220
- static VALUE Sketchup_Entity_get_attribute(int argc, VALUE* argv, VALUE self)
178
+ static VALUE entity_deleted_p(VALUE self)
221
179
  {
222
- SUEntityRef entity = {DATA_PTR(self)};
223
- struct AttributeDictionaryIterationContext attribute_dictionary_struct = {argv[0], SU_INVALID};
224
- FOREACH(SUEntityGetNumAttributeDictionaries, SUEntityGetAttributeDictionaries, SUAttributeDictionaryRef, entity, Sketchup_Entity_attribute_dictionary_Iterator, &attribute_dictionary_struct);
225
- // use Sketchup_AttributeDictionary_get
226
- return Qnil;
227
-
180
+ return BOOL2RB(DATA_PTR(self) == NULL);
228
181
  }
229
182
 
230
- static VALUE Sketchup_Entity_set_attribute(int argc, VALUE* argv, VALUE self)
183
+ static VALUE entity_get_attribute(int argc, VALUE* argv, VALUE self)
231
184
  {
232
- SUEntityRef entity = {DATA_PTR(self)};
233
- struct AttributeDictionaryIterationContext attribute_dictionary_struct = {argv[0], SU_INVALID};
234
- FOREACH(SUEntityGetNumAttributeDictionaries, SUEntityGetAttributeDictionaries, SUAttributeDictionaryRef, entity, Sketchup_Entity_attribute_dictionary_Iterator, &attribute_dictionary_struct);
235
- // use Sketchup_AttributeDictionary_set
236
- return Qnil;
237
-
185
+ VALUE name;
186
+ VALUE key;
187
+ VALUE default_value;
188
+ rb_scan_args(argc, argv, "21", &name, &key, &default_value);
189
+ StringValue(key);
190
+ VALUE dictionary = entity_find_dictionary(self, name);
191
+ VALUE value = NIL_P(dictionary) ? Qnil : rb_funcall(dictionary, (rb_intern)("[]"), 1, key);
192
+ return NIL_P(value) ? default_value : value;
193
+ }
194
+
195
+ static VALUE entity_set_attribute(VALUE self, VALUE name, VALUE key, VALUE value)
196
+ {
197
+ VALUE args[2] = {name, Qtrue};
198
+ VALUE dictionary = entity_attribute_dictionary(2, args, self);
199
+ if (NIL_P(dictionary))
200
+ rb_raise(rb_eArgError, "cannot set attributes on %"PRIsVALUE, rb_obj_class(self));
201
+ rb_funcall(dictionary, (rb_intern)("[]="), 2, key, value);
202
+ return value;
203
+ }
204
+
205
+ void Init_entity(void)
206
+ {
207
+ rb_define_method(cEntity, "persistent_id", entity_persistent_id, 0);
208
+ rb_define_method(cEntity, "entityID", entity_entityID, 0);
209
+ rb_define_method(cEntity, "typename", entity_typename, 0);
210
+ rb_define_method(cEntity, "parent", entity_parent, 0);
211
+ rb_define_method(cEntity, "model", entity_model, 0);
212
+ rb_define_method(cEntity, "==", entity_eq, 1);
213
+ rb_define_method(cEntity, "eql?", entity_eq, 1);
214
+ rb_define_method(cEntity, "hash", entity_hash, 0);
215
+ rb_define_method(cEntity, "attribute_dictionaries", entity_attribute_dictionaries, 0);
216
+ rb_define_method(cEntity, "attribute_dictionary", entity_attribute_dictionary, -1);
217
+ rb_define_method(cEntity, "delete_attribute", entity_delete_attribute, -1);
218
+ rb_define_method(cEntity, "deleted?", entity_deleted_p, 0);
219
+ rb_define_method(cEntity, "valid?", entity_valid_p, 0);
220
+ rb_define_method(cEntity, "get_attribute", entity_get_attribute, -1);
221
+ rb_define_method(cEntity, "set_attribute", entity_set_attribute, 3);
238
222
  }
239
-
240
- VALUE Entity_Init(VALUE Sketchup, VALUE rb_cObject)
241
- {
242
- VALUE Sketchup_Entity = rb_define_class_under(Sketchup, ENTITY, rb_cObject);
243
- rb_undef_alloc_func(Sketchup_Entity);
244
- rb_define_method(Sketchup_Entity, "persistent_id", Sketchup_Entity_persistentId, 0);
245
- rb_define_method(Sketchup_Entity, "entityID", Sketchup_Entity_entityId, 0);
246
- rb_define_method(Sketchup_Entity, "typename", Sketchup_Entity_typename, 0);
247
- rb_define_method(Sketchup_Entity, "parent", Sketchup_Entity_parent, 0);
248
- rb_define_method(Sketchup_Entity, "model", Sketchup_Entity_model, 0);
249
- rb_define_method(Sketchup_Entity, "remove_observer", Sketchup_Entity_remove_observer, 1);
250
- rb_define_method(Sketchup_Entity, "add_observer", Sketchup_Entity_add_observer, 1);
251
- rb_define_method(Sketchup_Entity, "attribute_dictionaries", Sketchup_Entity_attribute_dictionaries, 0);
252
- rb_define_method(Sketchup_Entity, "attribute_dictionary", Sketchup_Entity_attribute_dictionary, -1);
253
- rb_define_method(Sketchup_Entity, "delete_attribute", Sketchup_Entity_delete_attribute, -1);
254
- rb_define_method(Sketchup_Entity, "deleted?", Sketchup_Entity_deleted, 0);
255
- rb_define_method(Sketchup_Entity, "valid?", Sketchup_Entity_valid, 0);
256
- rb_define_method(Sketchup_Entity, "get_attribute", Sketchup_Entity_get_attribute, -1);
257
- rb_define_method(Sketchup_Entity, "set_attribute", Sketchup_Entity_set_attribute, -1);
258
- return Sketchup_Entity;
259
- }