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
data/ext/entities.c CHANGED
@@ -1,25 +1,582 @@
1
- #include <stdbool.h>
2
- #include <entities.h>
3
- #include <SketchUpAPI/sketchup.h>
4
- #include <utils.h>
1
+ #include <scriptup.h>
5
2
 
6
- void Sketchup_Entities_Iterator(SUFaceRef face, void* _)
3
+ #define ENTITIES(self) SU_REF(SUEntitiesRef, self)
4
+
5
+ DEFINE_REF_LIST(entities_faces, SUEntitiesRef, SUEntitiesGetNumFaces, SUEntitiesGetFaces, SUFaceRef, cFace)
6
+ DEFINE_REF_LIST(entities_guide_points, SUEntitiesRef, SUEntitiesGetNumGuidePoints, SUEntitiesGetGuidePoints, SUGuidePointRef, cConstructionPoint)
7
+ DEFINE_REF_LIST(entities_guide_lines, SUEntitiesRef, SUEntitiesGetNumGuideLines, SUEntitiesGetGuideLines, SUGuideLineRef, cConstructionLine)
8
+ DEFINE_REF_LIST(entities_groups, SUEntitiesRef, SUEntitiesGetNumGroups, SUEntitiesGetGroups, SUGroupRef, cGroup)
9
+ DEFINE_REF_LIST(entities_images, SUEntitiesRef, SUEntitiesGetNumImages, SUEntitiesGetImages, SUImageRef, cImage)
10
+ DEFINE_REF_LIST(entities_instances, SUEntitiesRef, SUEntitiesGetNumInstances, SUEntitiesGetInstances, SUComponentInstanceRef, cComponentInstance)
11
+ DEFINE_REF_LIST(entities_section_planes, SUEntitiesRef, SUEntitiesGetNumSectionPlanes, SUEntitiesGetSectionPlanes, SUSectionPlaneRef, cSectionPlane)
12
+ DEFINE_REF_LIST(entities_texts, SUEntitiesRef, SUEntitiesGetNumTexts, SUEntitiesGetTexts, SUTextRef, cText)
13
+ DEFINE_REF_LIST(entities_dimensions, SUEntitiesRef, SUEntitiesGetNumDimensions, SUEntitiesGetDimensions, SUDimensionRef, cDimension)
14
+ DEFINE_REF_LIST(curve_edges, SUCurveRef, SUCurveGetNumEdges, SUCurveGetEdges, SUEdgeRef, cEdge)
15
+
16
+ VALUE su_entities_new(SUEntitiesRef entities)
17
+ {
18
+ return su_wrap_or_nil(cEntities, entities.ptr);
19
+ }
20
+
21
+ static VALUE entities_edges(SUEntitiesRef entities)
22
+ {
23
+ size_t count = 0;
24
+ SUEntitiesGetNumEdges(entities, false, &count);
25
+ VALUE ary = rb_ary_new_capa((long)count);
26
+ if (count == 0)
27
+ return ary;
28
+ SUEdgeRef* edges = ZALLOC_N(SUEdgeRef, count);
29
+ SUEntitiesGetEdges(entities, false, count, edges, &count);
30
+ for (size_t i = 0; i < count; i++)
31
+ rb_ary_push(ary, su_wrap(cEdge, edges[i].ptr));
32
+ xfree(edges);
33
+ return ary;
34
+ }
35
+
36
+ // Every entity, wrapped as its runtime class.
37
+ static VALUE entities_to_a(VALUE self)
38
+ {
39
+ SUEntitiesRef entities = ENTITIES(self);
40
+ VALUE (*lists[])(SUEntitiesRef) = {entities_edges, entities_faces, entities_guide_points, entities_guide_lines,
41
+ entities_groups, entities_images, entities_instances, entities_section_planes, entities_texts, entities_dimensions};
42
+ VALUE all = rb_ary_new();
43
+ for (size_t i = 0; i < sizeof(lists) / sizeof(lists[0]); i++)
44
+ rb_ary_concat(all, lists[i](entities));
45
+ for (long i = 0; i < RARRAY_LEN(all); i++)
46
+ rb_ary_store(all, i, su_wrap_entity((SUEntityRef){DATA_PTR(RARRAY_AREF(all, i))}));
47
+ return all;
48
+ }
49
+
50
+ static VALUE entities_each(VALUE self)
51
+ {
52
+ su_yield_each(self, entities_to_a(self));
53
+ return Qnil;
54
+ }
55
+
56
+ static VALUE entities_aref(VALUE self, VALUE index)
57
+ {
58
+ return rb_ary_entry(entities_to_a(self), NUM2LONG(index));
59
+ }
60
+
61
+ static VALUE entities_length(VALUE self)
62
+ {
63
+ return LONG2NUM(RARRAY_LEN(entities_to_a(self)));
64
+ }
65
+
66
+ static VALUE entities_model(VALUE self)
67
+ {
68
+ struct SUEntitiesParent parent = {SU_INVALID, SU_INVALID};
69
+ SUEntitiesGetParent(ENTITIES(self), &parent);
70
+ if (SUIsValid(parent.model))
71
+ return su_wrap(cModel, parent.model.ptr);
72
+ SUModelRef model = SU_INVALID;
73
+ SUEntityGetModel((SUEntityRef){parent.definition.ptr}, &model);
74
+ return su_wrap_or_nil(cModel, model.ptr);
75
+ }
76
+
77
+ static VALUE entities_parent(VALUE self)
78
+ {
79
+ struct SUEntitiesParent parent = {SU_INVALID, SU_INVALID};
80
+ SUEntitiesGetParent(ENTITIES(self), &parent);
81
+ if (SUIsValid(parent.definition))
82
+ return su_wrap(cComponentDefinition, parent.definition.ptr);
83
+ return su_wrap_or_nil(cModel, parent.model.ptr);
84
+ }
85
+
86
+ static VALUE entities_eq(VALUE self, VALUE other)
87
+ {
88
+ return BOOL2RB(rb_obj_is_kind_of(other, cEntities) && DATA_PTR(self) == DATA_PTR(other));
89
+ }
90
+
91
+ // Flattens (*args) or ([array]) into one array.
92
+ static VALUE varargs(int argc, VALUE* argv)
93
+ {
94
+ if (argc == 1 && RB_TYPE_P(argv[0], T_ARRAY))
95
+ {
96
+ VALUE first = RARRAY_LEN(argv[0]) > 0 ? RARRAY_AREF(argv[0], 0) : Qnil;
97
+ if (!rb_obj_is_kind_of(first, rb_cNumeric))
98
+ return argv[0];
99
+ }
100
+ return rb_ary_new_from_values(argc, argv);
101
+ }
102
+
103
+ static VALUE add_edge(SUEntitiesRef entities, struct SUPoint3D a, struct SUPoint3D b)
104
+ {
105
+ bool equal = false;
106
+ SUPoint3DGetEqual(&a, &b, &equal);
107
+ if (equal)
108
+ return Qnil;
109
+ SUEdgeRef edge = SU_INVALID;
110
+ SUEdgeCreate(&edge, &a, &b);
111
+ SUEntitiesAddEdges(entities, 1, &edge);
112
+ return su_wrap(cEdge, edge.ptr);
113
+ }
114
+
115
+ static VALUE entities_add_line(VALUE self, VALUE p1, VALUE p2)
116
+ {
117
+ return add_edge(ENTITIES(self), su_to_point3d_like(p1), su_to_point3d_like(p2));
118
+ }
119
+
120
+ static VALUE entities_add_edges(int argc, VALUE* argv, VALUE self)
121
+ {
122
+ VALUE points = varargs(argc, argv);
123
+ if (RARRAY_LEN(points) < 2)
124
+ rb_raise(rb_eArgError, "at least 2 points are required");
125
+ VALUE edges = rb_ary_new();
126
+ for (long i = 0; i + 1 < RARRAY_LEN(points); i++)
127
+ {
128
+ VALUE edge = add_edge(ENTITIES(self), su_to_point3d_like(RARRAY_AREF(points, i)), su_to_point3d_like(RARRAY_AREF(points, i + 1)));
129
+ if (!NIL_P(edge))
130
+ rb_ary_push(edges, edge);
131
+ }
132
+ return edges;
133
+ }
134
+
135
+ static struct SUPoint3D edge_start(VALUE edge)
136
+ {
137
+ SUVertexRef vertex = SU_INVALID;
138
+ SUEdgeGetStartVertex(SU_REF(SUEdgeRef, edge), &vertex);
139
+ struct SUPoint3D p = {0, 0, 0};
140
+ SUVertexGetPosition(vertex, &p);
141
+ return p;
142
+ }
143
+
144
+ static VALUE entities_add_face(int argc, VALUE* argv, VALUE self)
145
+ {
146
+ VALUE items = varargs(argc, argv);
147
+ if (RARRAY_LEN(items) == 1 && rb_obj_is_kind_of(RARRAY_AREF(items, 0), cCurve))
148
+ items = curve_edges((SUCurveRef){DATA_PTR(RARRAY_AREF(items, 0))});
149
+ long count = RARRAY_LEN(items);
150
+ if (count < 3)
151
+ rb_raise(rb_eArgError, "at least 3 points or edges are required");
152
+ struct SUPoint3D* points = ZALLOC_N(struct SUPoint3D, count);
153
+ for (long i = 0; i < count; i++)
154
+ {
155
+ VALUE item = RARRAY_AREF(items, i);
156
+ points[i] = rb_obj_is_kind_of(item, cEdge) ? edge_start(item) : su_to_point3d_like(item);
157
+ }
158
+ SUFaceRef face = SU_INVALID;
159
+ enum SUResult result = SUFaceCreateSimple(&face, points, (size_t)count);
160
+ xfree(points);
161
+ if (result != SU_ERROR_NONE)
162
+ rb_raise(rb_eArgError, "points are not planar or don't form a valid face");
163
+ SUEntitiesAddFaces(ENTITIES(self), 1, &face);
164
+ return su_wrap(cFace, face.ptr);
165
+ }
166
+
167
+ static VALUE add_arc_curve(VALUE self, struct SUPoint3D center, struct SUVector3D xaxis, struct SUVector3D normal,
168
+ double radius, double start_angle, double end_angle, long segments)
169
+ {
170
+ if (radius <= 0)
171
+ rb_raise(rb_eArgError, "radius must be positive");
172
+ if (segments < 1)
173
+ rb_raise(rb_eArgError, "number of segments must be positive");
174
+ if (SUVector3DNormalize(&xaxis) != SU_ERROR_NONE || SUVector3DNormalize(&normal) != SU_ERROR_NONE)
175
+ rb_raise(rb_eArgError, "invalid axis");
176
+ struct SUVector3D yaxis;
177
+ SUVector3DCross(&normal, &xaxis, &yaxis);
178
+ struct SUPoint3D ends[2];
179
+ double angles[2] = {start_angle, end_angle};
180
+ for (int i = 0; i < 2; i++)
181
+ {
182
+ double c = cos(angles[i]) * radius;
183
+ double s = sin(angles[i]) * radius;
184
+ ends[i] = (struct SUPoint3D){center.x + xaxis.x * c + yaxis.x * s, center.y + xaxis.y * c + yaxis.y * s,
185
+ center.z + xaxis.z * c + yaxis.z * s};
186
+ }
187
+ SUArcCurveRef arc = SU_INVALID;
188
+ if (SUArcCurveCreate(&arc, &center, &ends[0], &ends[1], &normal, (size_t)segments) != SU_ERROR_NONE)
189
+ rb_raise(rb_eArgError, "cannot create arc");
190
+ SUEntitiesAddArcCurves(ENTITIES(self), 1, &arc);
191
+ return curve_edges(SUArcCurveToCurve(arc));
192
+ }
193
+
194
+ static VALUE entities_add_arc(int argc, VALUE* argv, VALUE self)
195
+ {
196
+ rb_check_arity(argc, 6, 7);
197
+ double start_angle = NUM2DBL(argv[4]);
198
+ double end_angle = NUM2DBL(argv[5]);
199
+ long segments = argc == 7 ? NUM2LONG(argv[6]) : (long)ceil(fabs(end_angle - start_angle) / (2 * M_PI) * 24);
200
+ return add_arc_curve(self, su_to_point3d(argv[0]), su_to_vector3d(argv[1]), su_to_vector3d(argv[2]),
201
+ NUM2DBL(argv[3]), start_angle, end_angle, segments < 1 ? 1 : segments);
202
+ }
203
+
204
+ static VALUE entities_add_circle(int argc, VALUE* argv, VALUE self)
205
+ {
206
+ rb_check_arity(argc, 3, 4);
207
+ struct SUVector3D normal = su_to_vector3d(argv[1]);
208
+ struct SUVector3D xaxis;
209
+ struct SUVector3D yaxis;
210
+ if (SUVector3DGetArbitraryAxes(&normal, &xaxis, &yaxis) != SU_ERROR_NONE)
211
+ rb_raise(rb_eArgError, "invalid normal");
212
+ long segments = argc == 4 ? NUM2LONG(argv[3]) : 24;
213
+ if (segments < 3)
214
+ rb_raise(rb_eArgError, "a circle needs at least 3 segments");
215
+ return add_arc_curve(self, su_to_point3d(argv[0]), xaxis, normal, NUM2DBL(argv[2]), 0.0, 2 * M_PI, segments);
216
+ }
217
+
218
+ static VALUE entities_add_ngon(int argc, VALUE* argv, VALUE self)
219
+ {
220
+ rb_check_arity(argc, 3, 4);
221
+ struct SUPoint3D center = su_to_point3d(argv[0]);
222
+ struct SUVector3D normal = su_to_vector3d(argv[1]);
223
+ double radius = NUM2DBL(argv[2]);
224
+ long sides = argc == 4 ? NUM2LONG(argv[3]) : 24;
225
+ if (sides < 3)
226
+ rb_raise(rb_eArgError, "a polygon needs at least 3 sides");
227
+ if (radius <= 0)
228
+ rb_raise(rb_eArgError, "radius must be positive");
229
+ struct SUVector3D x;
230
+ struct SUVector3D y;
231
+ if (SUVector3DGetArbitraryAxes(&normal, &x, &y) != SU_ERROR_NONE)
232
+ rb_raise(rb_eArgError, "invalid normal");
233
+ VALUE points = rb_ary_new_capa(sides + 1);
234
+ for (long i = 0; i <= sides; i++)
235
+ {
236
+ double angle = 2 * M_PI * (double)(i % sides) / (double)sides;
237
+ double c = cos(angle) * radius;
238
+ double s = sin(angle) * radius;
239
+ rb_ary_push(points, su_point3d_new((struct SUPoint3D){center.x + x.x * c + y.x * s, center.y + x.y * c + y.y * s,
240
+ center.z + x.z * c + y.z * s}));
241
+ }
242
+ VALUE args[1] = {points};
243
+ return entities_add_edges(1, args, self);
244
+ }
245
+
246
+ static VALUE entities_add_curve(int argc, VALUE* argv, VALUE self)
247
+ {
248
+ VALUE edges = entities_add_edges(argc, argv, self);
249
+ long count = RARRAY_LEN(edges);
250
+ SUEdgeRef* refs = ZALLOC_N(SUEdgeRef, count);
251
+ for (long i = 0; i < count; i++)
252
+ refs[i].ptr = DATA_PTR(RARRAY_AREF(edges, i));
253
+ SUCurveRef curve = SU_INVALID;
254
+ enum SUResult result = SUCurveCreateWithEdges(&curve, refs, (size_t)count);
255
+ xfree(refs);
256
+ if (result != SU_ERROR_NONE)
257
+ rb_raise(rb_eArgError, "cannot create curve");
258
+ SUEntitiesAddCurves(ENTITIES(self), 1, &curve);
259
+ return curve_edges(curve);
260
+ }
261
+
262
+ static VALUE entities_add_cpoint(VALUE self, VALUE point)
263
+ {
264
+ struct SUPoint3D p = su_to_point3d_like(point);
265
+ SUGuidePointRef guide = SU_INVALID;
266
+ SUGuidePointCreate(&guide, &p);
267
+ SUEntitiesAddGuidePoints(ENTITIES(self), 1, &guide);
268
+ return su_wrap(cConstructionPoint, guide.ptr);
269
+ }
270
+
271
+ static VALUE entities_add_cline(int argc, VALUE* argv, VALUE self)
272
+ {
273
+ rb_check_arity(argc, 2, 3);
274
+ if (argc == 3)
275
+ rb_raise(rb_eNotImpError, "the C API cannot set a construction line stipple");
276
+ struct SUPoint3D start = su_to_point3d(argv[0]);
277
+ SUGuideLineRef guide = SU_INVALID;
278
+ if (rb_obj_is_kind_of(argv[1], cVector3d))
279
+ {
280
+ struct SUVector3D direction = su_to_vector3d(argv[1]);
281
+ SUGuideLineCreateInfinite(&guide, &start, &direction);
282
+ }
283
+ else
284
+ {
285
+ struct SUPoint3D end = su_to_point3d(argv[1]);
286
+ SUGuideLineCreateFinite(&guide, &start, &end);
287
+ }
288
+ if (SUIsInvalid(guide))
289
+ rb_raise(rb_eArgError, "cannot create construction line");
290
+ SUEntitiesAddGuideLines(ENTITIES(self), 1, &guide);
291
+ return su_wrap(cConstructionLine, guide.ptr);
292
+ }
293
+
294
+ static VALUE entities_add_group(int argc, VALUE* argv, VALUE self)
295
+ {
296
+ if (argc > 0 && RARRAY_LEN(varargs(argc, argv)) > 0)
297
+ rb_raise(rb_eNotImpError, "the C API cannot move existing entities into a group");
298
+ SUGroupRef group = SU_INVALID;
299
+ SUGroupCreate(&group);
300
+ SUEntitiesAddGroup(ENTITIES(self), group);
301
+ return su_wrap(cGroup, group.ptr);
302
+ }
303
+
304
+ static VALUE entities_add_instance(VALUE self, VALUE definition, VALUE transformation)
305
+ {
306
+ SUComponentDefinitionRef def = {su_unwrap(definition, cComponentDefinition)};
307
+ struct SUTransformation t = rb_obj_is_kind_of(transformation, cTransformation)
308
+ ? su_to_transformation(transformation)
309
+ : su_to_transformation(rb_class_new_instance(1, &transformation, cTransformation));
310
+ SUComponentInstanceRef instance = SU_INVALID;
311
+ if (SUComponentDefinitionCreateInstance(def, &instance) != SU_ERROR_NONE)
312
+ rb_raise(rb_eArgError, "cannot create an instance of this definition");
313
+ SUComponentInstanceSetTransform(instance, &t);
314
+ SUEntitiesAddInstance(ENTITIES(self), instance, NULL);
315
+ return su_wrap(cComponentInstance, instance.ptr);
316
+ }
317
+
318
+ static VALUE entities_add_image(int argc, VALUE* argv, VALUE self)
319
+ {
320
+ rb_check_arity(argc, 3, 4);
321
+ SUImageRef image = SU_INVALID;
322
+ if (SUImageCreateFromFile(&image, StringValueCStr(argv[0])) != SU_ERROR_NONE)
323
+ return Qnil;
324
+ double native_width = 1.0;
325
+ double native_height = 1.0;
326
+ SUImageGetDimensions(image, &native_width, &native_height);
327
+ double width = NUM2DBL(argv[2]);
328
+ double height = argc == 4 && !NIL_P(argv[3]) ? NUM2DBL(argv[3]) : width * native_height / native_width;
329
+ struct SUPoint3D origin = su_to_point3d(argv[1]);
330
+ struct SUTransformation t = {{width / native_width, 0, 0, 0, 0, height / native_height, 0, 0, 0, 0, 1, 0,
331
+ origin.x, origin.y, origin.z, 1}};
332
+ SUImageSetTransform(image, &t);
333
+ SUEntitiesAddImage(ENTITIES(self), image);
334
+ return su_wrap(cImage, image.ptr);
335
+ }
336
+
337
+ static VALUE entities_add_section_plane(int argc, VALUE* argv, VALUE self)
338
+ {
339
+ rb_check_arity(argc, 1, 2);
340
+ struct SUPlane3D plane = su_to_plane3d(argc == 2 ? rb_ary_new_from_values(2, argv) : argv[0]);
341
+ SUSectionPlaneRef section = SU_INVALID;
342
+ SUSectionPlaneCreate(&section);
343
+ SUSectionPlaneSetPlane(section, &plane);
344
+ SUEntitiesAddSectionPlanes(ENTITIES(self), 1, &section);
345
+ return su_wrap(cSectionPlane, section.ptr);
346
+ }
347
+
348
+ static VALUE entities_add_text(VALUE self, VALUE string, VALUE point, VALUE vector)
349
+ {
350
+ struct SUPoint3D p = su_to_point3d_like(point);
351
+ struct SUVector3D v = su_to_vector3d(vector);
352
+ SUTextRef text = SU_INVALID;
353
+ SUTextCreate(&text);
354
+ SUTextSetString(text, StringValueCStr(string));
355
+ SUInstancePathRef no_path = SU_INVALID;
356
+ SUTextSetPoint(text, &p, no_path);
357
+ bool has_leader = v.x != 0 || v.y != 0 || v.z != 0;
358
+ if (has_leader)
359
+ SUTextSetLeaderType(text, SUTextLeaderType_ViewBased);
360
+ SUTextSetLeaderVector(text, &v);
361
+ SUEntitiesAddTexts(ENTITIES(self), 1, &text);
362
+ return su_wrap(cText, text.ptr);
363
+ }
364
+
365
+ static SUMaterialRef material_from(VALUE self, VALUE material)
366
+ {
367
+ SUMaterialRef ref = SU_INVALID;
368
+ if (NIL_P(material))
369
+ return ref;
370
+ if (rb_obj_is_kind_of(material, cMaterial))
371
+ ref.ptr = DATA_PTR(material);
372
+ else
373
+ {
374
+ VALUE found = rb_funcall(rb_funcall(entities_model(self), (rb_intern)("materials"), 0), (rb_intern)("[]"), 1, material);
375
+ if (NIL_P(found))
376
+ rb_raise(rb_eArgError, "material not found: %"PRIsVALUE, material);
377
+ ref.ptr = DATA_PTR(found);
378
+ }
379
+ return ref;
380
+ }
381
+
382
+ static VALUE fill_from_mesh(VALUE self, VALUE mesh, bool weld, int smooth_flags, VALUE front, VALUE back)
7
383
  {
8
- rb_yield(Data_Wrap_Struct(rb_path2class(SKETCHUP_FACE), 0, 0, face.ptr));
384
+ su_unwrap(mesh, cPolygonMesh);
385
+ VALUE points = rb_funcall(mesh, (rb_intern)("points"), 0);
386
+ VALUE polygons = rb_funcall(mesh, (rb_intern)("polygons"), 0);
387
+ SUMaterialRef front_material = material_from(self, front);
388
+ SUMaterialRef back_material = material_from(self, back);
389
+ SUGeometryInputRef input = SU_INVALID;
390
+ SUGeometryInputCreate(&input);
391
+ for (long i = 0; i < RARRAY_LEN(points); i++)
392
+ {
393
+ struct SUPoint3D p = su_to_point3d(RARRAY_AREF(points, i));
394
+ SUGeometryInputAddVertex(input, &p);
395
+ }
396
+ for (long i = 0; i < RARRAY_LEN(polygons); i++)
397
+ {
398
+ VALUE polygon = RARRAY_AREF(polygons, i);
399
+ SULoopInputRef loop = SU_INVALID;
400
+ SULoopInputCreate(&loop);
401
+ for (long j = 0; j < RARRAY_LEN(polygon); j++)
402
+ {
403
+ long index = NUM2LONG(RARRAY_AREF(polygon, j));
404
+ SULoopInputAddVertexIndex(loop, (size_t)(labs(index) - 1));
405
+ if (index < 0 && (smooth_flags & 1))
406
+ SULoopInputEdgeSetHidden(loop, (size_t)j, true);
407
+ }
408
+ size_t face_index = 0;
409
+ SUGeometryInputAddFace(input, &loop, &face_index);
410
+ if (SUIsValid(front_material))
411
+ {
412
+ struct SUMaterialInput material = {0, {{0, 0}}, {0}, front_material};
413
+ SUGeometryInputFaceSetFrontMaterial(input, face_index, &material);
414
+ }
415
+ if (SUIsValid(back_material))
416
+ {
417
+ struct SUMaterialInput material = {0, {{0, 0}}, {0}, back_material};
418
+ SUGeometryInputFaceSetBackMaterial(input, face_index, &material);
419
+ }
420
+ }
421
+ size_t faces_before = 0;
422
+ SUEntitiesGetNumFaces(ENTITIES(self), &faces_before);
423
+ enum SUResult result = SUEntitiesFill(ENTITIES(self), input, weld);
424
+ SUGeometryInputRelease(&input);
425
+ if (result != SU_ERROR_NONE)
426
+ return Qfalse;
427
+ size_t faces_after = 0;
428
+ SUEntitiesGetNumFaces(ENTITIES(self), &faces_after);
429
+ return SIZET2NUM(faces_after - faces_before);
9
430
  }
10
431
 
11
- static VALUE Sketchup_Entities_each(VALUE self)
432
+ static VALUE entities_add_faces_from_mesh(int argc, VALUE* argv, VALUE self)
12
433
  {
13
- SUEntitiesRef entities = {DATA_PTR(self)};
14
- FOREACH(SUEntitiesGetNumFaces, SUEntitiesGetFaces, SUFaceRef, entities, Sketchup_Entities_Iterator, 0);
434
+ rb_check_arity(argc, 1, 4);
435
+ int flags = argc > 1 ? NUM2INT(argv[1]) : 12;
436
+ return fill_from_mesh(self, argv[0], true, flags, argc > 2 ? argv[2] : Qnil, argc > 3 ? argv[3] : Qnil);
437
+ }
438
+
439
+ static VALUE entities_fill_from_mesh(int argc, VALUE* argv, VALUE self)
440
+ {
441
+ rb_check_arity(argc, 1, 5);
442
+ bool weld = argc > 1 ? RTEST(argv[1]) : true;
443
+ int flags = argc > 2 ? NUM2INT(argv[2]) : 12;
444
+ VALUE added = fill_from_mesh(self, argv[0], weld, flags, argc > 3 ? argv[3] : Qnil, argc > 4 ? argv[4] : Qnil);
445
+ return BOOL2RB(added != Qfalse);
446
+ }
447
+
448
+ static SUEntityRef* entity_refs(VALUE entities, long* count)
449
+ {
450
+ *count = RARRAY_LEN(entities);
451
+ SUEntityRef* refs = ZALLOC_N(SUEntityRef, *count > 0 ? *count : 1);
452
+ for (long i = 0; i < *count; i++)
453
+ refs[i].ptr = su_unwrap(RARRAY_AREF(entities, i), cEntity);
454
+ return refs;
455
+ }
456
+
457
+ static VALUE entities_erase_entities(int argc, VALUE* argv, VALUE self)
458
+ {
459
+ long count;
460
+ SUEntityRef* refs = entity_refs(varargs(argc, argv), &count);
461
+ enum SUResult result = SUEntitiesErase(ENTITIES(self), (size_t)count, refs);
462
+ xfree(refs);
463
+ if (result != SU_ERROR_NONE)
464
+ rb_raise(rb_eArgError, "entities must belong to this collection");
465
+ return Qnil;
466
+ }
467
+
468
+ static VALUE entities_clear_bang(VALUE self)
469
+ {
470
+ return BOOL2RB(SUEntitiesClear(ENTITIES(self)) == SU_ERROR_NONE);
471
+ }
472
+
473
+ static VALUE entities_transform_entities(int argc, VALUE* argv, VALUE self)
474
+ {
475
+ rb_check_arity(argc, 2, UNLIMITED_ARGUMENTS);
476
+ struct SUTransformation t = su_to_transformation(argv[0]);
477
+ long count;
478
+ SUEntityRef* refs = entity_refs(varargs(argc - 1, argv + 1), &count);
479
+ enum SUResult result = SUEntitiesTransform(ENTITIES(self), (size_t)count, refs, &t);
480
+ xfree(refs);
481
+ return BOOL2RB(result == SU_ERROR_NONE);
482
+ }
483
+
484
+ static VALUE entities_transform_by_vectors(VALUE self, VALUE entities, VALUE vectors)
485
+ {
486
+ Check_Type(vectors, T_ARRAY);
487
+ long count;
488
+ SUEntityRef* refs = entity_refs(entities, &count);
489
+ if (RARRAY_LEN(vectors) != count)
490
+ {
491
+ xfree(refs);
492
+ rb_raise(rb_eArgError, "expected one vector per entity");
493
+ }
494
+ struct SUTransformation* transforms = ZALLOC_N(struct SUTransformation, count > 0 ? count : 1);
495
+ for (long i = 0; i < count; i++)
496
+ transforms[i] = su_to_transformation(rb_class_new_instance(1, &RARRAY_CONST_PTR(vectors)[i], cTransformation));
497
+ SUEntitiesTransformMultiple(ENTITIES(self), (size_t)count, refs, transforms);
498
+ xfree(refs);
499
+ xfree(transforms);
15
500
  return self;
16
501
  }
17
502
 
18
- VALUE Entities_Init(VALUE Sketchup, VALUE rb_cObject)
503
+ static VALUE entities_weld(VALUE self, VALUE edges)
504
+ {
505
+ Check_Type(edges, T_ARRAY);
506
+ long count = RARRAY_LEN(edges);
507
+ SUEdgeRef* refs = ZALLOC_N(SUEdgeRef, count > 0 ? count : 1);
508
+ for (long i = 0; i < count; i++)
509
+ refs[i].ptr = su_unwrap(RARRAY_AREF(edges, i), cEdge);
510
+ SUEntityListRef list = SU_INVALID;
511
+ SUEntityListCreate(&list);
512
+ SUEntitiesWeld(ENTITIES(self), (size_t)count, refs, list);
513
+ xfree(refs);
514
+ VALUE curves = rb_ary_new();
515
+ SUEntityListIteratorRef it = SU_INVALID;
516
+ SUEntityListIteratorCreate(&it);
517
+ SUEntityListBegin(list, &it);
518
+ bool in_range = false;
519
+ while (SUEntityListIteratorIsInRange(it, &in_range) == SU_ERROR_NONE && in_range)
520
+ {
521
+ SUEntityRef entity = SU_INVALID;
522
+ SUEntityListIteratorGetEntity(it, &entity);
523
+ rb_ary_push(curves, su_wrap(cCurve, entity.ptr));
524
+ SUEntityListIteratorNext(it);
525
+ }
526
+ SUEntityListIteratorRelease(&it);
527
+ SUEntityListRelease(&list);
528
+ return curves;
529
+ }
530
+
531
+ static VALUE entities_active_section_plane(VALUE self)
19
532
  {
20
- VALUE Sketchup_Entities = rb_define_class_under(Sketchup, ENTITIES, rb_cObject);
21
- rb_undef_alloc_func(Sketchup_Entities);
22
- rb_include_module(Sketchup_Entities, rb_mEnumerable);
23
- rb_define_method(Sketchup_Entities, "each", Sketchup_Entities_each, 0);
24
- return Sketchup_Entities;
25
- }
533
+ SUSectionPlaneRef section = SU_INVALID;
534
+ SUEntitiesGetActiveSectionPlane(ENTITIES(self), &section);
535
+ return su_wrap_or_nil(cSectionPlane, section.ptr);
536
+ }
537
+
538
+ static VALUE entities_set_active_section_plane(VALUE self, VALUE section)
539
+ {
540
+ SUSectionPlaneRef ref = SU_INVALID;
541
+ if (!NIL_P(section))
542
+ ref.ptr = su_unwrap(section, cSectionPlane);
543
+ SUEntitiesSetActiveSectionPlane(ENTITIES(self), ref);
544
+ return section;
545
+ }
546
+
547
+ void Init_entities(void)
548
+ {
549
+ rb_include_module(cEntities, rb_mEnumerable);
550
+ rb_define_method(cEntities, "each", entities_each, 0);
551
+ rb_define_method(cEntities, "[]", entities_aref, 1);
552
+ rb_define_method(cEntities, "at", entities_aref, 1);
553
+ rb_define_method(cEntities, "count", entities_length, 0);
554
+ rb_define_method(cEntities, "length", entities_length, 0);
555
+ rb_define_method(cEntities, "size", entities_length, 0);
556
+ rb_define_method(cEntities, "model", entities_model, 0);
557
+ rb_define_method(cEntities, "parent", entities_parent, 0);
558
+ rb_define_method(cEntities, "==", entities_eq, 1);
559
+ rb_define_method(cEntities, "add_line", entities_add_line, 2);
560
+ rb_define_method(cEntities, "add_edges", entities_add_edges, -1);
561
+ rb_define_method(cEntities, "add_face", entities_add_face, -1);
562
+ rb_define_method(cEntities, "add_arc", entities_add_arc, -1);
563
+ rb_define_method(cEntities, "add_circle", entities_add_circle, -1);
564
+ rb_define_method(cEntities, "add_ngon", entities_add_ngon, -1);
565
+ rb_define_method(cEntities, "add_curve", entities_add_curve, -1);
566
+ rb_define_method(cEntities, "add_cpoint", entities_add_cpoint, 1);
567
+ rb_define_method(cEntities, "add_cline", entities_add_cline, -1);
568
+ rb_define_method(cEntities, "add_group", entities_add_group, -1);
569
+ rb_define_method(cEntities, "add_instance", entities_add_instance, 2);
570
+ rb_define_method(cEntities, "add_image", entities_add_image, -1);
571
+ rb_define_method(cEntities, "add_section_plane", entities_add_section_plane, -1);
572
+ rb_define_method(cEntities, "add_text", entities_add_text, 3);
573
+ rb_define_method(cEntities, "add_faces_from_mesh", entities_add_faces_from_mesh, -1);
574
+ rb_define_method(cEntities, "fill_from_mesh", entities_fill_from_mesh, -1);
575
+ rb_define_method(cEntities, "erase_entities", entities_erase_entities, -1);
576
+ rb_define_method(cEntities, "clear!", entities_clear_bang, 0);
577
+ rb_define_method(cEntities, "transform_entities", entities_transform_entities, -1);
578
+ rb_define_method(cEntities, "transform_by_vectors", entities_transform_by_vectors, 2);
579
+ rb_define_method(cEntities, "weld", entities_weld, 1);
580
+ rb_define_method(cEntities, "active_section_plane", entities_active_section_plane, 0);
581
+ rb_define_method(cEntities, "active_section_plane=", entities_set_active_section_plane, 1);
582
+ }