scriptup 0.0.0

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 (241) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +11 -0
  3. data/README.md +5 -0
  4. data/ext/attribute_dictionaries.c +45 -0
  5. data/ext/attribute_dictionaries.h +3 -0
  6. data/ext/attribute_dictionary.c +156 -0
  7. data/ext/attribute_dictionary.h +3 -0
  8. data/ext/behavior.c +10 -0
  9. data/ext/behavior.h +3 -0
  10. data/ext/color.c +211 -0
  11. data/ext/color.h +3 -0
  12. data/ext/component_definition.c +188 -0
  13. data/ext/component_definition.h +3 -0
  14. data/ext/component_instance.c +10 -0
  15. data/ext/component_instance.h +3 -0
  16. data/ext/definition_list.c +145 -0
  17. data/ext/definition_list.h +3 -0
  18. data/ext/drawing_element.c +10 -0
  19. data/ext/drawing_element.h +3 -0
  20. data/ext/entities.c +11 -0
  21. data/ext/entities.h +3 -0
  22. data/ext/entity.c +253 -0
  23. data/ext/entity.h +3 -0
  24. data/ext/extconf.rb +38 -0
  25. data/ext/material.c +242 -0
  26. data/ext/material.h +3 -0
  27. data/ext/materials.c +80 -0
  28. data/ext/materials.h +3 -0
  29. data/ext/model.c +42 -0
  30. data/ext/model.h +3 -0
  31. data/ext/sketchup.c +89 -0
  32. data/ext/sketchup.h +4 -0
  33. data/ext/texture.c +9 -0
  34. data/ext/texture.h +3 -0
  35. data/ext/typed_value.c +84 -0
  36. data/ext/typed_value.h +5 -0
  37. data/ext/utils.h +80 -0
  38. data/lib/sketchup.rb +12 -0
  39. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/application.h +36 -0
  40. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/model.h +59 -0
  41. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/overlay.h +248 -0
  42. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/ruby_api.h +118 -0
  43. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/color.h +107 -0
  44. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/common.h +178 -0
  45. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/defs.h +19 -0
  46. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/extension_license.h +62 -0
  47. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/bounding_box.h +34 -0
  48. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/plane3d.h +153 -0
  49. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/point2d.h +96 -0
  50. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/point3d.h +98 -0
  51. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/ray3d.h +64 -0
  52. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/transformation.h +321 -0
  53. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/transformation2d.h +163 -0
  54. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/vector2d.h +235 -0
  55. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/vector3d.h +285 -0
  56. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry.h +152 -0
  57. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/modelexporterplugin.h +165 -0
  58. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/modelimporterplugin.h +183 -0
  59. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/pluginprogresscallback.h +84 -0
  60. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/initialize.h +43 -0
  61. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/length_formatter.h +424 -0
  62. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/arccurve.h +244 -0
  63. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/arrow_type.h +17 -0
  64. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/attribute_dictionary.h +161 -0
  65. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/axes.h +242 -0
  66. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/camera.h +398 -0
  67. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classification_attribute.h +89 -0
  68. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classification_info.h +125 -0
  69. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classifications.h +86 -0
  70. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_definition.h +588 -0
  71. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_instance.h +344 -0
  72. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/curve.h +143 -0
  73. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/defs.h +142 -0
  74. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension.h +222 -0
  75. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_linear.h +421 -0
  76. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_radial.h +194 -0
  77. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_style.h +253 -0
  78. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/drawing_element.h +198 -0
  79. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dynamic_component_attribute.h +92 -0
  80. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dynamic_component_info.h +70 -0
  81. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/edge.h +271 -0
  82. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/edge_use.h +214 -0
  83. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entities.h +834 -0
  84. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity.h +186 -0
  85. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity_list.h +80 -0
  86. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity_list_iterator.h +90 -0
  87. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/face.h +686 -0
  88. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/font.h +138 -0
  89. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/geometry.h +20 -0
  90. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/geometry_input.h +685 -0
  91. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/group.h +244 -0
  92. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/guide_line.h +155 -0
  93. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/guide_point.h +153 -0
  94. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/image.h +288 -0
  95. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/image_rep.h +275 -0
  96. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/instancepath.h +266 -0
  97. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/layer.h +265 -0
  98. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/layer_folder.h +301 -0
  99. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/line_style.h +211 -0
  100. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/line_styles.h +81 -0
  101. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/location.h +65 -0
  102. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/loop.h +182 -0
  103. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/material.h +390 -0
  104. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/mesh_helper.h +187 -0
  105. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model.h +1663 -0
  106. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model_version.h +49 -0
  107. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/opening.h +72 -0
  108. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/options_manager.h +79 -0
  109. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/options_provider.h +166 -0
  110. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/polyline3d.h +140 -0
  111. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/rendering_options.h +179 -0
  112. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/scene.h +836 -0
  113. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/schema.h +56 -0
  114. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/schema_type.h +26 -0
  115. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/section_plane.h +212 -0
  116. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/selection.h +156 -0
  117. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/shadow_info.h +147 -0
  118. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/skp.h +45 -0
  119. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/style.h +303 -0
  120. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/styles.h +190 -0
  121. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/text.h +384 -0
  122. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/texture.h +358 -0
  123. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/texture_writer.h +280 -0
  124. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/typed_value.h +390 -0
  125. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/uv_helper.h +79 -0
  126. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/vertex.h +154 -0
  127. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/sketchup.h +122 -0
  128. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/sketchup_info.h +65 -0
  129. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/slapi.h +16 -0
  130. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/transformation.h +16 -0
  131. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/unicodestring.h +239 -0
  132. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/utils/math_helpers.h +124 -0
  133. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonGeometry.dylib +0 -0
  134. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonGeoutils.dylib +0 -0
  135. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonImage.dylib +0 -0
  136. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonPreferences.dylib +0 -0
  137. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonUnits.dylib +0 -0
  138. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonUtils.dylib +0 -0
  139. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonZip.dylib +0 -0
  140. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Resources/Info.plist +50 -0
  141. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/SketchUpAPI +0 -0
  142. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/_CodeSignature/CodeResources +835 -0
  143. data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpAPI.dll +0 -0
  144. data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpAPI.lib +0 -0
  145. data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpCommonPreferences.dll +0 -0
  146. data/sketchup-sdk-win/binaries/sketchup/x64/sketchup.lib +0 -0
  147. data/sketchup-sdk-win/headers/SketchUpAPI/application/application.h +36 -0
  148. data/sketchup-sdk-win/headers/SketchUpAPI/application/model.h +59 -0
  149. data/sketchup-sdk-win/headers/SketchUpAPI/application/overlay.h +248 -0
  150. data/sketchup-sdk-win/headers/SketchUpAPI/application/ruby_api.h +118 -0
  151. data/sketchup-sdk-win/headers/SketchUpAPI/color.h +107 -0
  152. data/sketchup-sdk-win/headers/SketchUpAPI/common.h +178 -0
  153. data/sketchup-sdk-win/headers/SketchUpAPI/defs.h +19 -0
  154. data/sketchup-sdk-win/headers/SketchUpAPI/extension_license.h +62 -0
  155. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/bounding_box.h +34 -0
  156. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/plane3d.h +153 -0
  157. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/point2d.h +96 -0
  158. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/point3d.h +98 -0
  159. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/ray3d.h +64 -0
  160. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/transformation.h +321 -0
  161. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/transformation2d.h +163 -0
  162. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/vector2d.h +235 -0
  163. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/vector3d.h +285 -0
  164. data/sketchup-sdk-win/headers/SketchUpAPI/geometry.h +152 -0
  165. data/sketchup-sdk-win/headers/SketchUpAPI/import_export/modelexporterplugin.h +165 -0
  166. data/sketchup-sdk-win/headers/SketchUpAPI/import_export/modelimporterplugin.h +183 -0
  167. data/sketchup-sdk-win/headers/SketchUpAPI/import_export/pluginprogresscallback.h +84 -0
  168. data/sketchup-sdk-win/headers/SketchUpAPI/initialize.h +43 -0
  169. data/sketchup-sdk-win/headers/SketchUpAPI/length_formatter.h +424 -0
  170. data/sketchup-sdk-win/headers/SketchUpAPI/model/arccurve.h +244 -0
  171. data/sketchup-sdk-win/headers/SketchUpAPI/model/arrow_type.h +17 -0
  172. data/sketchup-sdk-win/headers/SketchUpAPI/model/attribute_dictionary.h +161 -0
  173. data/sketchup-sdk-win/headers/SketchUpAPI/model/axes.h +242 -0
  174. data/sketchup-sdk-win/headers/SketchUpAPI/model/camera.h +398 -0
  175. data/sketchup-sdk-win/headers/SketchUpAPI/model/classification_attribute.h +89 -0
  176. data/sketchup-sdk-win/headers/SketchUpAPI/model/classification_info.h +125 -0
  177. data/sketchup-sdk-win/headers/SketchUpAPI/model/classifications.h +86 -0
  178. data/sketchup-sdk-win/headers/SketchUpAPI/model/component_definition.h +588 -0
  179. data/sketchup-sdk-win/headers/SketchUpAPI/model/component_instance.h +344 -0
  180. data/sketchup-sdk-win/headers/SketchUpAPI/model/curve.h +143 -0
  181. data/sketchup-sdk-win/headers/SketchUpAPI/model/defs.h +142 -0
  182. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension.h +222 -0
  183. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_linear.h +421 -0
  184. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_radial.h +194 -0
  185. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_style.h +253 -0
  186. data/sketchup-sdk-win/headers/SketchUpAPI/model/drawing_element.h +198 -0
  187. data/sketchup-sdk-win/headers/SketchUpAPI/model/dynamic_component_attribute.h +92 -0
  188. data/sketchup-sdk-win/headers/SketchUpAPI/model/dynamic_component_info.h +70 -0
  189. data/sketchup-sdk-win/headers/SketchUpAPI/model/edge.h +271 -0
  190. data/sketchup-sdk-win/headers/SketchUpAPI/model/edge_use.h +214 -0
  191. data/sketchup-sdk-win/headers/SketchUpAPI/model/entities.h +834 -0
  192. data/sketchup-sdk-win/headers/SketchUpAPI/model/entity.h +186 -0
  193. data/sketchup-sdk-win/headers/SketchUpAPI/model/entity_list.h +80 -0
  194. data/sketchup-sdk-win/headers/SketchUpAPI/model/entity_list_iterator.h +90 -0
  195. data/sketchup-sdk-win/headers/SketchUpAPI/model/face.h +686 -0
  196. data/sketchup-sdk-win/headers/SketchUpAPI/model/font.h +138 -0
  197. data/sketchup-sdk-win/headers/SketchUpAPI/model/geometry.h +20 -0
  198. data/sketchup-sdk-win/headers/SketchUpAPI/model/geometry_input.h +685 -0
  199. data/sketchup-sdk-win/headers/SketchUpAPI/model/group.h +244 -0
  200. data/sketchup-sdk-win/headers/SketchUpAPI/model/guide_line.h +155 -0
  201. data/sketchup-sdk-win/headers/SketchUpAPI/model/guide_point.h +153 -0
  202. data/sketchup-sdk-win/headers/SketchUpAPI/model/image.h +288 -0
  203. data/sketchup-sdk-win/headers/SketchUpAPI/model/image_rep.h +275 -0
  204. data/sketchup-sdk-win/headers/SketchUpAPI/model/instancepath.h +266 -0
  205. data/sketchup-sdk-win/headers/SketchUpAPI/model/layer.h +265 -0
  206. data/sketchup-sdk-win/headers/SketchUpAPI/model/layer_folder.h +301 -0
  207. data/sketchup-sdk-win/headers/SketchUpAPI/model/line_style.h +211 -0
  208. data/sketchup-sdk-win/headers/SketchUpAPI/model/line_styles.h +81 -0
  209. data/sketchup-sdk-win/headers/SketchUpAPI/model/location.h +65 -0
  210. data/sketchup-sdk-win/headers/SketchUpAPI/model/loop.h +182 -0
  211. data/sketchup-sdk-win/headers/SketchUpAPI/model/material.h +390 -0
  212. data/sketchup-sdk-win/headers/SketchUpAPI/model/mesh_helper.h +187 -0
  213. data/sketchup-sdk-win/headers/SketchUpAPI/model/model.h +1663 -0
  214. data/sketchup-sdk-win/headers/SketchUpAPI/model/model_version.h +49 -0
  215. data/sketchup-sdk-win/headers/SketchUpAPI/model/opening.h +72 -0
  216. data/sketchup-sdk-win/headers/SketchUpAPI/model/options_manager.h +79 -0
  217. data/sketchup-sdk-win/headers/SketchUpAPI/model/options_provider.h +166 -0
  218. data/sketchup-sdk-win/headers/SketchUpAPI/model/polyline3d.h +140 -0
  219. data/sketchup-sdk-win/headers/SketchUpAPI/model/rendering_options.h +179 -0
  220. data/sketchup-sdk-win/headers/SketchUpAPI/model/scene.h +836 -0
  221. data/sketchup-sdk-win/headers/SketchUpAPI/model/schema.h +56 -0
  222. data/sketchup-sdk-win/headers/SketchUpAPI/model/schema_type.h +26 -0
  223. data/sketchup-sdk-win/headers/SketchUpAPI/model/section_plane.h +212 -0
  224. data/sketchup-sdk-win/headers/SketchUpAPI/model/selection.h +156 -0
  225. data/sketchup-sdk-win/headers/SketchUpAPI/model/shadow_info.h +147 -0
  226. data/sketchup-sdk-win/headers/SketchUpAPI/model/skp.h +45 -0
  227. data/sketchup-sdk-win/headers/SketchUpAPI/model/style.h +303 -0
  228. data/sketchup-sdk-win/headers/SketchUpAPI/model/styles.h +190 -0
  229. data/sketchup-sdk-win/headers/SketchUpAPI/model/text.h +384 -0
  230. data/sketchup-sdk-win/headers/SketchUpAPI/model/texture.h +358 -0
  231. data/sketchup-sdk-win/headers/SketchUpAPI/model/texture_writer.h +280 -0
  232. data/sketchup-sdk-win/headers/SketchUpAPI/model/typed_value.h +390 -0
  233. data/sketchup-sdk-win/headers/SketchUpAPI/model/uv_helper.h +79 -0
  234. data/sketchup-sdk-win/headers/SketchUpAPI/model/vertex.h +154 -0
  235. data/sketchup-sdk-win/headers/SketchUpAPI/sketchup.h +122 -0
  236. data/sketchup-sdk-win/headers/SketchUpAPI/sketchup_info.h +65 -0
  237. data/sketchup-sdk-win/headers/SketchUpAPI/slapi.h +16 -0
  238. data/sketchup-sdk-win/headers/SketchUpAPI/transformation.h +16 -0
  239. data/sketchup-sdk-win/headers/SketchUpAPI/unicodestring.h +239 -0
  240. data/sketchup-sdk-win/headers/SketchUpAPI/utils/math_helpers.h +124 -0
  241. metadata +313 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a13a9ca166d58d914b19c46a4bbe165e08cc10aab1312505f0b86e8b974ab480
4
+ data.tar.gz: b56fd89ad25a6ee7db43e4827e0b2caf9efc4f5176dc8624d1f747c802e56b07
5
+ SHA512:
6
+ metadata.gz: cfb285fdc4173fba7d43bee92b5841794bb05de03f3cbd537bb059a512de19409bdfbaa63eb1246853d3f04581f1b33e76e31a7ffc27c6d508a62f2540ef0130
7
+ data.tar.gz: 0dbe242f90fb8a119ae4709e9e1df5ffa56e7474e7b95bbdad62c7e36ed2e3a9acef48644bbd50fac2320d420753138cb1d32b33f939917147aa00da9cf7daaf
data/LICENSE.txt ADDED
@@ -0,0 +1,11 @@
1
+ Copyright 2024 Chaos Software LTD EOOD
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+
11
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # About
2
+
3
+ This project provides ruby bindings for the SketchUp C API. They are designed to mimmic the SketchUp [**ruby api**](https://ruby.sketchup.com) for use in Sketchup extension tests outside the SketchUp application. You can however use them for general purpouse scripting.
4
+
5
+ The SketchUp C API is much more limmited than the ruby api. There is no gui event loop, nor observers, nor view, nor does this extension aim to provide such functionality.
@@ -0,0 +1,45 @@
1
+ #include <stdbool.h>
2
+ #include <attribute_dictionaries.h>
3
+ #include <utils.h>
4
+ #include <SketchUpAPI/sketchup.h>
5
+
6
+ static VALUE Sketchup_AttributeDictionaries_get(VALUE self, VALUE key)
7
+ {
8
+ SUModelRef model = {DATA_PTR(self)};
9
+ SUAttributeDictionaryRef dictionary = SU_INVALID;
10
+ enum SUResult result = SUModelGetAttributeDictionary(model, StringValuePtr(key), &dictionary);
11
+ if (result != SU_ERROR_NONE)
12
+ return Qnil;
13
+ return Data_Wrap_Struct(rb_path2class(SKETCHUP_ATTRIBUTEDICTIONARY), 0, 0, dictionary.ptr);
14
+ }
15
+
16
+ void Sketchup_AttributeDictionaries_Iterator(SUAttributeDictionaryRef group, void* _)
17
+ {
18
+ rb_yield(Data_Wrap_Struct(rb_path2class(SKETCHUP_ATTRIBUTEDICTIONARY), 0, 0, group.ptr));
19
+ }
20
+
21
+ static VALUE Sketchup_AttributeDictionaries_each(VALUE self)
22
+ {
23
+ SUModelRef model = {DATA_PTR(self)};
24
+ FOREACH(SUModelGetNumAttributeDictionaries, SUModelGetAttributeDictionaries, SUAttributeDictionaryRef, model, Sketchup_AttributeDictionaries_Iterator, 0);
25
+ return self;
26
+ }
27
+
28
+ static VALUE Sketchup_AttributeDictionaries_length(VALUE self)
29
+ {
30
+ SUModelRef model = {DATA_PTR(self)};
31
+ size_t count;
32
+ SUModelGetNumAttributeDictionaries(model, &count);
33
+ return INT2NUM(count);
34
+ }
35
+
36
+ VALUE AttributeDictionaries_Init(VALUE Sketchup, VALUE Sketchup_Entity)
37
+ {
38
+ VALUE Sketchup_AttributeDictionaries = rb_define_class_under(Sketchup, ATTRIBUTEDICTIONARIES, Sketchup_Entity);
39
+ rb_include_module(Sketchup_AttributeDictionaries, rb_mEnumerable);
40
+ rb_define_method(Sketchup_AttributeDictionaries, "[]", Sketchup_AttributeDictionaries_get, 1);
41
+ rb_define_method(Sketchup_AttributeDictionaries, "each", Sketchup_AttributeDictionaries_each, 0);
42
+ rb_define_method(Sketchup_AttributeDictionaries, "length", Sketchup_AttributeDictionaries_length, 0);
43
+ rb_define_method(Sketchup_AttributeDictionaries, "size", Sketchup_AttributeDictionaries_length, 0);
44
+ return Sketchup_AttributeDictionaries;
45
+ }
@@ -0,0 +1,3 @@
1
+ #include <ruby.h>
2
+
3
+ VALUE AttributeDictionaries_Init(VALUE namespace_object, VALUE parent_class);
@@ -0,0 +1,156 @@
1
+ #include <stdbool.h>
2
+ #include <attribute_dictionary.h>
3
+ #include <typed_value.h>
4
+ #include <utils.h>
5
+ #include <SketchUpAPI/sketchup.h>
6
+
7
+ static VALUE Sketchup_AttributeDictionary_get(VALUE self, VALUE key)
8
+ {
9
+ SUAttributeDictionaryRef dictionary = {DATA_PTR(self)};
10
+ SUTypedValueRef typedValue = SU_INVALID;
11
+ SUTypedValueCreate(&typedValue);
12
+ enum SUResult result = SUAttributeDictionaryGetValue(dictionary, StringValuePtr(key), &typedValue);
13
+ if (result != SU_ERROR_NONE)
14
+ {
15
+ SUTypedValueRelease(&typedValue);
16
+ return Qnil;
17
+ }
18
+ VALUE output = TypedValue_get_value_type(&typedValue);
19
+ SUTypedValueRelease(&typedValue);
20
+ return output;
21
+ }
22
+
23
+ static VALUE Sketchup_AttributeDictionary_set(VALUE self, VALUE key, VALUE value)
24
+ {
25
+ SUAttributeDictionaryRef dictionary = {DATA_PTR(self)};
26
+ SUTypedValueRef typedValue = SU_INVALID;
27
+ SUTypedValueCreate(&typedValue);
28
+ TypedValue_set_value_type(&typedValue, value);
29
+ enum SUResult result = SUAttributeDictionarySetValue(dictionary, StringValuePtr(key), typedValue);
30
+ SUTypedValueRelease(&typedValue);
31
+ if (result != SU_ERROR_NONE)
32
+ return Qnil;
33
+ return TypedValue_get_value_type(&typedValue);
34
+ }
35
+
36
+ void Sketchup_AttributeDictionary_Iterator(SUStringRef dictionary_key, SUAttributeDictionaryRef dictionary)
37
+ {
38
+ VALUE key;
39
+ GETUTF8FROMSTRING(dictionary_key, key);
40
+ SUTypedValueRef value = SU_INVALID;
41
+ SUTypedValueCreate(&value);
42
+ SUAttributeDictionaryGetValue(dictionary, StringValuePtr(key), &value);
43
+ VALUE output = TypedValue_get_value_type(&value);
44
+ SUTypedValueRelease(&value);
45
+ rb_yield_values(2, key, output);
46
+ }
47
+
48
+ static VALUE Sketchup_AttributeDictionary_each(VALUE self)
49
+ {
50
+
51
+ SUAttributeDictionaryRef dictionary = {DATA_PTR(self)};
52
+ FOREACHSTRING(SUAttributeDictionaryGetNumKeys, SUAttributeDictionaryGetKeys, SUStringRef, dictionary, Sketchup_AttributeDictionary_Iterator, dictionary);
53
+ return self;
54
+ }
55
+
56
+ void Sketchup_AttributeDictionary_each_key_Iterator(SUStringRef dictionary_key, void* _)
57
+ {
58
+ VALUE key;
59
+ GETUTF8FROMSTRING(dictionary_key, key);
60
+ rb_yield(key);
61
+ }
62
+
63
+ static VALUE Sketchup_AttributeDictionary_each_key(VALUE self)
64
+ {
65
+ SUAttributeDictionaryRef dictionary = {DATA_PTR(self)};
66
+ FOREACHSTRING(SUAttributeDictionaryGetNumKeys, SUAttributeDictionaryGetKeys, SUStringRef, dictionary, Sketchup_AttributeDictionary_each_key_Iterator, 0);
67
+ return self;
68
+ }
69
+
70
+ static VALUE Sketchup_AttributeDictionary_name(VALUE self)
71
+ {
72
+ VALUE output;
73
+ SUAttributeDictionaryRef dictionary = {DATA_PTR(self)};
74
+ GETSTRING(SUAttributeDictionaryGetName, dictionary, output)
75
+ return output;
76
+ }
77
+
78
+ static VALUE Sketchup_AttributeDictionary_length(VALUE self)
79
+ {
80
+ SUAttributeDictionaryRef dictionary = {DATA_PTR(self)};
81
+ size_t count;
82
+ SUAttributeDictionaryGetNumKeys(dictionary, &count);
83
+ return INT2FIX(count);
84
+ }
85
+
86
+ void Sketchup_AttributeDictionary_keys_Iterator(SUStringRef dictionary_key, VALUE ary)
87
+ {
88
+ VALUE key;
89
+ GETUTF8FROMSTRING(dictionary_key, key);
90
+ rb_ary_push(ary, key);
91
+ }
92
+
93
+ static VALUE Sketchup_AttributeDictionary_keys(VALUE self)
94
+ {
95
+ SUAttributeDictionaryRef dictionary = {DATA_PTR(self)};
96
+ VALUE ary = rb_ary_new();
97
+ FOREACHSTRING(SUAttributeDictionaryGetNumKeys, SUAttributeDictionaryGetKeys, SUStringRef, dictionary, Sketchup_AttributeDictionary_keys_Iterator, ary);
98
+ return ary;
99
+ }
100
+
101
+ struct AttributeDictionary_Struct
102
+ {
103
+ VALUE ary;
104
+ SUAttributeDictionaryRef dictionary;
105
+ };
106
+
107
+ void Sketchup_AttributeDictionary_values_Iterator(SUStringRef dictionary_key, struct AttributeDictionary_Struct attributeDictionary_struct)
108
+ {
109
+ VALUE key;
110
+ GETUTF8FROMSTRING(dictionary_key, key);
111
+ SUTypedValueRef value = SU_INVALID;
112
+ SUTypedValueCreate(&value);
113
+ SUAttributeDictionaryGetValue(attributeDictionary_struct.dictionary, StringValuePtr(key), &value);
114
+ VALUE output = TypedValue_get_value_type(&value);
115
+ SUTypedValueRelease(&value);
116
+ rb_ary_push(attributeDictionary_struct.ary, output);
117
+ }
118
+
119
+ static VALUE Sketchup_AttributeDictionary_values(VALUE self)
120
+ {
121
+ SUAttributeDictionaryRef dictionary = {DATA_PTR(self)};
122
+ VALUE ary = rb_ary_new();
123
+ struct AttributeDictionary_Struct values_struct = {ary, dictionary};
124
+ FOREACHSTRING(SUAttributeDictionaryGetNumKeys, SUAttributeDictionaryGetKeys, SUStringRef, dictionary, Sketchup_AttributeDictionary_values_Iterator, values_struct);
125
+ return ary;
126
+ }
127
+
128
+ static VALUE Sketchup_AttributeDictionary_delete_key(VALUE self, VALUE key)
129
+ {
130
+ SUAttributeDictionaryRef dictionary = {DATA_PTR(self)};
131
+ SUTypedValueRef value = SU_INVALID;
132
+ SUTypedValueCreate(&value);
133
+ SUAttributeDictionaryGetValue(dictionary, StringValuePtr(key), &value);
134
+ VALUE output = TypedValue_get_value_type(&value);
135
+ SUTypedValueRelease(&value);
136
+ // ToDo:: delete the key and its value from the attribute dictionary
137
+ return output;
138
+ }
139
+
140
+ VALUE AttributeDictionary_Init(VALUE Sketchup, VALUE Sketchup_Entity)
141
+ {
142
+ VALUE Sketchup_AttributeDictionary = rb_define_class_under(Sketchup, ATTRIBUTEDICTIONARY, Sketchup_Entity);
143
+ rb_include_module(Sketchup_AttributeDictionary, rb_mEnumerable);
144
+ rb_define_method(Sketchup_AttributeDictionary, "[]", Sketchup_AttributeDictionary_get, 1);
145
+ rb_define_method(Sketchup_AttributeDictionary, "[]=", Sketchup_AttributeDictionary_set, 2);
146
+ rb_define_method(Sketchup_AttributeDictionary, "each", Sketchup_AttributeDictionary_each, 0);
147
+ rb_define_method(Sketchup_AttributeDictionary, "each_pair", Sketchup_AttributeDictionary_each, 0);
148
+ rb_define_method(Sketchup_AttributeDictionary, "each_key", Sketchup_AttributeDictionary_each_key, 0);
149
+ rb_define_method(Sketchup_AttributeDictionary, "name", Sketchup_AttributeDictionary_name, 0);
150
+ rb_define_method(Sketchup_AttributeDictionary, "length", Sketchup_AttributeDictionary_length, 0);
151
+ rb_define_method(Sketchup_AttributeDictionary, "size", Sketchup_AttributeDictionary_length, 0);
152
+ rb_define_method(Sketchup_AttributeDictionary, "keys", Sketchup_AttributeDictionary_keys, 0);
153
+ rb_define_method(Sketchup_AttributeDictionary, "values", Sketchup_AttributeDictionary_values, 0);
154
+ rb_define_method(Sketchup_AttributeDictionary, "delete_key", Sketchup_AttributeDictionary_delete_key, 1);
155
+ return Sketchup_AttributeDictionary;
156
+ }
@@ -0,0 +1,3 @@
1
+ #include <ruby.h>
2
+
3
+ VALUE AttributeDictionary_Init(VALUE namespace_object, VALUE parent_class);
data/ext/behavior.c ADDED
@@ -0,0 +1,10 @@
1
+ #include <stdbool.h>
2
+ #include <behavior.h>
3
+ #include <utils.h>
4
+ #include <SketchUpAPI/sketchup.h>
5
+
6
+ VALUE Behavior_Init(VALUE Sketchup, VALUE Entity)
7
+ {
8
+ VALUE Sketchup_Behavior = rb_define_class_under(Sketchup, BEHAVIOR, Entity);
9
+ return Sketchup_Behavior;
10
+ }
data/ext/behavior.h ADDED
@@ -0,0 +1,3 @@
1
+ #include <ruby.h>
2
+
3
+ VALUE Behavior_Init(VALUE namespace_object, VALUE parent_class);
data/ext/color.c ADDED
@@ -0,0 +1,211 @@
1
+ #include <stdbool.h>
2
+ #include <color.h>
3
+ #include <SketchUpAPI/sketchup.h>
4
+ #include <utils.h>
5
+
6
+ static int GETCOLOR(VALUE obj)
7
+ {
8
+ int color = FIX2INT(obj);
9
+ if (color > 255)
10
+ return 255;
11
+ else if (color < 0)
12
+ return 0;
13
+ else
14
+ return color;
15
+ }
16
+
17
+ static float GETALPHA(VALUE obj)
18
+ {
19
+ float alpha = NUM2DBL(obj);
20
+ if (alpha > 1.0)
21
+ return 1.0;
22
+ else if (alpha < 0.0)
23
+ return 0.0;
24
+ else
25
+ return alpha;
26
+ }
27
+
28
+ static VALUE alloc(VALUE self)
29
+ {
30
+ SUColor* color;
31
+ VALUE obj = Data_Make_Struct(self, SUColor, 0, RUBY_DEFAULT_FREE, color);
32
+ color->red = 0;
33
+ color->green = 0;
34
+ color->blue = 0;
35
+ color->alpha = 255;
36
+ return obj;
37
+ }
38
+
39
+ static VALUE Sketchup_Color_names(VALUE self)
40
+ {
41
+ size_t count = 0;
42
+ SUColorGetNumNames(&count);
43
+ SUStringRef* names = malloc(count * sizeof(SUStringRef));
44
+ for (int i = 0; i < count; i++)
45
+ {
46
+ names[i].ptr = 0;
47
+ SUStringCreate(&names[i]);
48
+ }
49
+ SUColorGetNames(names, count);
50
+ VALUE ary = rb_ary_new2(count);
51
+ for (int i = 0; i < count; i++)
52
+ {
53
+ VALUE name;
54
+ GETUTF8FROMSTRING(names[i], name);
55
+ rb_ary_push(ary, name);
56
+ }
57
+ for (int i = 0; i < count; i++)
58
+ {
59
+ SUStringRelease(&names[i]);
60
+ }
61
+ free(names);
62
+ return ary;
63
+ }
64
+
65
+ static VALUE Sketchup_Color_initialize(int argc, VALUE* argv, VALUE self)
66
+ {
67
+ SUColor* color = DATA_PTR(self);
68
+ if (argc == 1)
69
+ {
70
+ if (rb_type(argv[0]) == T_STRING) // && check if string is part of the list
71
+ {
72
+ SUColorSetByName(color, StringValuePtr(argv[0]));
73
+ }
74
+ else if (rb_type(argv[0]) == T_FIXNUM) // && check if its hex
75
+ {
76
+ SUColorSetByValue(color, NUM2INT(argv[0]));
77
+ }
78
+ }
79
+ else if (argc == 3)
80
+ {
81
+ color->red = GETCOLOR(argv[0]);
82
+ color->green = GETCOLOR(argv[1]);
83
+ color->blue = GETCOLOR(argv[2]);
84
+ color->alpha = 255;
85
+ }
86
+ else if (argc == 4)
87
+ {
88
+ color->red = GETCOLOR(argv[0]);
89
+ color->green = GETCOLOR(argv[1]);
90
+ color->blue = GETCOLOR(argv[2]);
91
+ color->alpha = GETALPHA(argv[3]);
92
+ }
93
+ return self;
94
+ }
95
+
96
+ static VALUE Sketchup_Color_equ(VALUE self, VALUE other)
97
+ {
98
+ SUColor* color = DATA_PTR(self);
99
+ SUColor* otherColor = DATA_PTR(other);
100
+ return (color->red == otherColor->red && color->green == otherColor->green && color->blue == otherColor->blue && color->alpha == otherColor->alpha)
101
+ ? Qtrue
102
+ : Qfalse;
103
+ }
104
+
105
+ static VALUE Sketchup_Color_Get_alpha(VALUE self)
106
+ {
107
+ SUColor* color = DATA_PTR(self);
108
+ return INT2NUM(color->alpha);
109
+ }
110
+
111
+ static VALUE Sketchup_Color_Set_alpha(VALUE self, VALUE alpha)
112
+ {
113
+ SUColor* color = DATA_PTR(self);
114
+ color->alpha = NUM2INT(alpha);
115
+ return alpha;
116
+ }
117
+
118
+ static VALUE Sketchup_Color_blend(VALUE self, VALUE other, VALUE weight)
119
+ {
120
+ SUColor* color = DATA_PTR(self);
121
+ SUColor* otherColor = DATA_PTR(other);
122
+ VALUE output = rb_obj_alloc(rb_path2class(SKETCHUP_COLOR));
123
+ SUColor* outputColor = DATA_PTR(output);
124
+ SUColorBlend(*color, *otherColor, NUM2DBL(weight), outputColor);
125
+ return output;
126
+ }
127
+
128
+ static VALUE Sketchup_Color_Get_blue(VALUE self)
129
+ {
130
+ SUColor* color = DATA_PTR(self);
131
+ return INT2NUM(color->blue);
132
+ }
133
+
134
+ static VALUE Sketchup_Color_Set_blue(VALUE self, VALUE blue)
135
+ {
136
+ SUColor* color = DATA_PTR(self);
137
+ color->blue = NUM2INT(blue);
138
+ return blue;
139
+ }
140
+
141
+ static VALUE Sketchup_Color_Get_green(VALUE self)
142
+ {
143
+ SUColor* color = DATA_PTR(self);
144
+ return INT2NUM(color->green);
145
+ }
146
+
147
+ static VALUE Sketchup_Color_Set_green(VALUE self, VALUE green)
148
+ {
149
+ SUColor* color = DATA_PTR(self);
150
+ color->green = NUM2INT(green);
151
+ return green;
152
+ }
153
+
154
+ static VALUE Sketchup_Color_Get_red(VALUE self)
155
+ {
156
+ SUColor* color = DATA_PTR(self);
157
+ return INT2NUM(color->red);
158
+ }
159
+
160
+ static VALUE Sketchup_Color_Set_red(VALUE self, VALUE red)
161
+ {
162
+ SUColor* color = DATA_PTR(self);
163
+ color->red = NUM2INT(red);
164
+ return red;
165
+ }
166
+
167
+ static VALUE Sketchup_Color_to_a(VALUE self)
168
+ {
169
+ SUColor* color = DATA_PTR(self);
170
+ VALUE ary = rb_ary_new2(4);
171
+ rb_ary_push(ary, INT2NUM(color->red));
172
+ rb_ary_push(ary, INT2NUM(color->green));
173
+ rb_ary_push(ary, INT2NUM(color->blue));
174
+ rb_ary_push(ary, INT2NUM(color->alpha));
175
+ return ary;
176
+ }
177
+
178
+ static VALUE Sketchup_Color_to_i(VALUE self)
179
+ {
180
+ SUColor* color = DATA_PTR(self);
181
+ return INT2NUM(color->red | color->green << 8 | color->blue << 16);
182
+ }
183
+
184
+ static VALUE Sketchup_Color_to_s(VALUE self)
185
+ {
186
+ SUColor* color = DATA_PTR(self);
187
+ VALUE output;
188
+ output = rb_sprintf("Color(%d, %d, %d, %d)", color->red, color->green, color->blue, color->alpha);
189
+ return output;
190
+ }
191
+
192
+ void Color_Init(VALUE Sketchup, VALUE Sketchup_Object)
193
+ {
194
+ VALUE Sketchup_Color = rb_define_class_under(Sketchup, COLOR, Sketchup_Object);
195
+ rb_define_alloc_func(Sketchup_Color, alloc);
196
+ rb_define_singleton_method(Sketchup_Color, "names", Sketchup_Color_names, 0);
197
+ rb_define_method(Sketchup_Color, "initialize", Sketchup_Color_initialize, -1);
198
+ rb_define_method(Sketchup_Color, "==", Sketchup_Color_equ, 1);
199
+ rb_define_method(Sketchup_Color, "alpha", Sketchup_Color_Get_alpha, 0);
200
+ rb_define_method(Sketchup_Color, "alpha=", Sketchup_Color_Set_alpha, 1);
201
+ rb_define_method(Sketchup_Color, "blend", Sketchup_Color_blend, 2);
202
+ rb_define_method(Sketchup_Color, "blue", Sketchup_Color_Get_blue, 0);
203
+ rb_define_method(Sketchup_Color, "blue=", Sketchup_Color_Set_blue, 1);
204
+ rb_define_method(Sketchup_Color, "green", Sketchup_Color_Get_green, 0);
205
+ rb_define_method(Sketchup_Color, "green=", Sketchup_Color_Set_green, 1);
206
+ rb_define_method(Sketchup_Color, "red", Sketchup_Color_Get_red, 0);
207
+ rb_define_method(Sketchup_Color, "red=", Sketchup_Color_Set_red, 1);
208
+ rb_define_method(Sketchup_Color, "to_a", Sketchup_Color_to_a, 0);
209
+ rb_define_method(Sketchup_Color, "to_i", Sketchup_Color_to_i, 0);
210
+ rb_define_method(Sketchup_Color, "to_s", Sketchup_Color_to_s, 0);
211
+ }
data/ext/color.h ADDED
@@ -0,0 +1,3 @@
1
+ #include <ruby.h>
2
+
3
+ void Color_Init(VALUE namespace_object, VALUE parent_class);
@@ -0,0 +1,188 @@
1
+ #include <stdbool.h>
2
+ #include <component_definition.h>
3
+ #include <utils.h>
4
+ #include <SketchUpAPI/sketchup.h>
5
+
6
+ static VALUE Sketchup_ComponentDefinition_Get_name(VALUE self)
7
+ {
8
+ VALUE output;
9
+ SUComponentDefinitionRef definition = {DATA_PTR(self)};
10
+ GETSTRING(SUComponentDefinitionGetName, definition, output);
11
+ return output;
12
+ }
13
+
14
+ static VALUE Sketchup_ComponentDefinition_Set_name(VALUE self, VALUE name)
15
+ {
16
+ SUComponentDefinitionRef definition = {DATA_PTR(self)};
17
+ SUComponentDefinitionSetName(definition, StringValuePtr(name));
18
+ return name;
19
+ }
20
+
21
+ static VALUE Sketchup_ComponentDefinition_Name_equ(VALUE self, VALUE other)
22
+ {
23
+ if (!rb_obj_is_kind_of(other, rb_path2class(SKETCHUP_COMPONENTDEFINITION)))
24
+ return Qnil;
25
+ #pragma clang diagnostic push
26
+ #pragma clang diagnostic ignored "-Wcompound-token-split-by-macro"
27
+ return rb_funcall(Sketchup_ComponentDefinition_Get_name(self), rb_intern("<=>"), 1, Sketchup_ComponentDefinition_Get_name(other));
28
+ #pragma clang diagnostic pop
29
+ }
30
+
31
+ static VALUE Sketchup_ComponentDefinition_Object_equ(VALUE self, VALUE other)
32
+ {
33
+ if (!rb_obj_is_kind_of(other, rb_path2class(SKETCHUP_COMPONENTDEFINITION)))
34
+ return Qfalse;
35
+ SUComponentDefinitionRef definition1 = {DATA_PTR(self)};
36
+ SUComponentDefinitionRef definition2 = {DATA_PTR(other)};
37
+ return definition1.ptr == definition2.ptr;
38
+ }
39
+
40
+ void Sketchup_ComponentDefinition_instances_Iterator(SUComponentInstanceRef componentInstance, VALUE ary)
41
+ {
42
+ rb_ary_push(ary, Data_Wrap_Struct(rb_path2class(SKETCHUP_COMPONENTINSTANCE), 0, 0, componentInstance.ptr));
43
+ }
44
+
45
+ static VALUE Sketchup_ComponentDefinition_instances(VALUE self)
46
+ {
47
+ SUComponentDefinitionRef definition = {DATA_PTR(self)};
48
+ VALUE ary = rb_ary_new();
49
+ FOREACH(
50
+ SUComponentDefinitionGetNumInstances,
51
+ SUComponentDefinitionGetInstances,
52
+ SUComponentInstanceRef,
53
+ definition,
54
+ Sketchup_ComponentDefinition_instances_Iterator,
55
+ ary);
56
+ return ary;
57
+ }
58
+
59
+ static VALUE Sketchup_ComponentDefinition_count_instances(VALUE self)
60
+ {
61
+ SUComponentDefinitionRef definition = {DATA_PTR(self)};
62
+ size_t count = 0;
63
+ SUComponentDefinitionGetNumInstances(definition, &count);
64
+ return INT2NUM(count);
65
+ }
66
+
67
+ static VALUE Sketchup_ComponentDefinition_count_used_instances(VALUE self)
68
+ {
69
+ SUComponentDefinitionRef definition = {DATA_PTR(self)};
70
+ size_t count = 0;
71
+ SUComponentDefinitionGetNumUsedInstances(definition, &count);
72
+ return INT2NUM(count);
73
+ }
74
+
75
+ static VALUE Sketchup_ComponentDefinition_live_component(VALUE self)
76
+ {
77
+ SUComponentDefinitionRef definition = {DATA_PTR(self)};
78
+ bool output = false;
79
+ SUComponentDefinitionIsLiveComponent(definition, &output);
80
+ return output ? Qtrue : Qfalse;
81
+ }
82
+
83
+ static VALUE Sketchup_ComponentDefinition_internal(VALUE self)
84
+ {
85
+ SUComponentDefinitionRef definition = {DATA_PTR(self)};
86
+ bool is_internal = false;
87
+ SUComponentDefinitionIsInternal(definition, &is_internal);
88
+ return is_internal ? Qtrue : Qfalse;
89
+ }
90
+
91
+ static VALUE Sketchup_ComponentDefinition_entities(VALUE self)
92
+ {
93
+ SUComponentDefinitionRef definition = {DATA_PTR(self)};
94
+ SUEntitiesRef entities;
95
+ SUComponentDefinitionGetEntities(definition, &entities);
96
+ return Data_Wrap_Struct(rb_path2class(SKETCHUP_ENTITIES), 0, 0, entities.ptr);
97
+ }
98
+
99
+ static VALUE Sketchup_ComponentDefinition_path(VALUE self)
100
+ {
101
+ SUComponentDefinitionRef definition = {DATA_PTR(self)};
102
+ VALUE output;
103
+ GETSTRING(SUComponentDefinitionGetPath, definition, output);
104
+ return output;
105
+ }
106
+
107
+ static VALUE Sketchup_ComponentDefinition_guid(VALUE self)
108
+ {
109
+ SUComponentDefinitionRef definition = {DATA_PTR(self)};
110
+ VALUE output;
111
+ GETSTRING(SUComponentDefinitionGetGuid, definition, output);
112
+ return output;
113
+ }
114
+
115
+ static VALUE Sketchup_ComponentDefinition_group(VALUE self)
116
+ {
117
+ SUComponentDefinitionRef definition = {DATA_PTR(self)};
118
+ enum SUComponentType type = SUComponentType_Normal;
119
+ SUComponentDefinitionGetType(definition, &type);
120
+ return type == SUComponentType_Group ? Qtrue : Qfalse;
121
+ }
122
+
123
+ static VALUE Sketchup_ComponentDefinition_Get_description(VALUE self)
124
+ {
125
+ SUComponentDefinitionRef definition = {DATA_PTR(self)};
126
+ VALUE output;
127
+ GETSTRING(SUComponentDefinitionGetDescription, definition, output);
128
+ return output;
129
+ }
130
+
131
+ static VALUE Sketchup_ComponentDefinition_Set_description(VALUE self, VALUE description)
132
+ {
133
+ SUComponentDefinitionRef definition = {DATA_PTR(self)};
134
+ SUComponentDefinitionSetDescription(definition, StringValuePtr(description));
135
+ return description;
136
+ }
137
+
138
+ static VALUE Sketchup_ComponentDefinition_image(VALUE self)
139
+ {
140
+ SUComponentDefinitionRef definition = {DATA_PTR(self)};
141
+ SUImageRef image = SUImageFromDrawingElement(SUComponentDefinitionToDrawingElement(definition));
142
+ return SUIsValid(image) ? Qtrue : Qfalse;
143
+ }
144
+
145
+ static VALUE Sketchup_ComponentDefinition_behavior(VALUE self)
146
+ {
147
+ SUComponentDefinitionRef definition = {DATA_PTR(self)};
148
+ struct SUComponentBehavior behavior;
149
+ SUComponentDefinitionGetBehavior(definition, &behavior);
150
+ return Data_Wrap_Struct(rb_path2class(SKETCHUP_BEHAVIOR), 0, 0, &behavior);
151
+ }
152
+
153
+ static VALUE Sketchup_ComponentDefinition_save_as(int argc, VALUE* argv, VALUE self)
154
+ {
155
+ VALUE path;
156
+ VALUE version;
157
+ rb_scan_args(argc, argv, "11", &path, &version);
158
+
159
+ SUComponentDefinitionRef definition = {DATA_PTR(self)};
160
+ enum SUResult result = SUComponentDefinitionSaveToFile(definition, StringValuePtr(path), NIL_P(version) ? SUModelVersion_Current : NUM2INT(version));
161
+ if (result != SU_ERROR_NONE)
162
+ return Qnil;
163
+ return Qtrue;
164
+ }
165
+
166
+ VALUE ComponentDefinition_Init(VALUE Sketchup, VALUE Sketchup_DrawingElement)
167
+ {
168
+ VALUE Sketchup_ComponentDefinition = rb_define_class_under(Sketchup, COMPONENTDEFINITION, Sketchup_DrawingElement);
169
+ rb_define_method(Sketchup_ComponentDefinition, "name", Sketchup_ComponentDefinition_Get_name, 0);
170
+ rb_define_method(Sketchup_ComponentDefinition, "name=", Sketchup_ComponentDefinition_Set_name, 1);
171
+ rb_define_method(Sketchup_ComponentDefinition, "==", Sketchup_ComponentDefinition_Object_equ, 1);
172
+ rb_define_method(Sketchup_ComponentDefinition, "<=>", Sketchup_ComponentDefinition_Name_equ, 1);
173
+ rb_define_method(Sketchup_ComponentDefinition, "instances", Sketchup_ComponentDefinition_instances, 0);
174
+ rb_define_method(Sketchup_ComponentDefinition, "count_instances", Sketchup_ComponentDefinition_count_instances, 0);
175
+ rb_define_method(Sketchup_ComponentDefinition, "count_used_instances", Sketchup_ComponentDefinition_count_used_instances, 0);
176
+ rb_define_method(Sketchup_ComponentDefinition, "live_component?", Sketchup_ComponentDefinition_live_component, 0);
177
+ rb_define_method(Sketchup_ComponentDefinition, "internal?", Sketchup_ComponentDefinition_internal, 0);
178
+ rb_define_method(Sketchup_ComponentDefinition, "entities", Sketchup_ComponentDefinition_entities, 0);
179
+ rb_define_method(Sketchup_ComponentDefinition, "path", Sketchup_ComponentDefinition_path, 0);
180
+ rb_define_method(Sketchup_ComponentDefinition, "guid", Sketchup_ComponentDefinition_guid, 0);
181
+ rb_define_method(Sketchup_ComponentDefinition, "group?", Sketchup_ComponentDefinition_group, 0);
182
+ rb_define_method(Sketchup_ComponentDefinition, "description", Sketchup_ComponentDefinition_Get_description, 0);
183
+ rb_define_method(Sketchup_ComponentDefinition, "description=", Sketchup_ComponentDefinition_Set_description, 1);
184
+ rb_define_method(Sketchup_ComponentDefinition, "image?", Sketchup_ComponentDefinition_image, 0);
185
+ rb_define_method(Sketchup_ComponentDefinition, "behavior", Sketchup_ComponentDefinition_behavior, 0);
186
+ rb_define_method(Sketchup_ComponentDefinition, "save_as", Sketchup_ComponentDefinition_save_as, -1);
187
+ return Sketchup_ComponentDefinition;
188
+ }
@@ -0,0 +1,3 @@
1
+ #include <ruby.h>
2
+
3
+ VALUE ComponentDefinition_Init(VALUE namespace_object, VALUE parent_class);
@@ -0,0 +1,10 @@
1
+ #include <stdbool.h>
2
+ #include <component_instance.h>
3
+ #include <utils.h>
4
+ #include <SketchUpAPI/sketchup.h>
5
+
6
+ VALUE ComponentInstance_Init(VALUE Sketchup, VALUE Sketchup_DrawingElement)
7
+ {
8
+ VALUE Sketchup_ComponentInstance = rb_define_class_under(Sketchup, COMPONENTINSTANCE, Sketchup_DrawingElement);
9
+ return Sketchup_ComponentInstance;
10
+ }
@@ -0,0 +1,3 @@
1
+ #include <ruby.h>
2
+
3
+ VALUE ComponentInstance_Init(VALUE namespace_object, VALUE parent_class);