scriptup 2026.0.0 → 2026.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +43 -24
- data/ext/arc_curve.c +50 -0
- data/ext/attribute_dictionaries.c +49 -32
- data/ext/attribute_dictionary.c +54 -127
- data/ext/axes.c +79 -0
- data/ext/behavior.c +100 -9
- data/ext/bounding_box.c +195 -0
- data/ext/camera.c +178 -0
- data/ext/classifications.c +85 -0
- data/ext/color.c +91 -163
- data/ext/component_definition.c +78 -162
- data/ext/component_instance.c +88 -9
- data/ext/construction.c +59 -0
- data/ext/curve.c +87 -0
- data/ext/definition_list.c +89 -109
- data/ext/depend +1 -0
- data/ext/drawing_element.c +96 -117
- data/ext/edge.c +147 -0
- data/ext/edge_use.c +37 -0
- data/ext/entities.c +573 -16
- data/ext/entities_builder.c +145 -0
- data/ext/entity.c +175 -212
- data/ext/environments.c +149 -0
- data/ext/extconf.rb +54 -10
- data/ext/face.c +331 -0
- data/ext/geom.c +172 -0
- data/ext/group.c +86 -0
- data/ext/helpers.c +244 -0
- data/ext/image.c +182 -0
- data/ext/image_rep.c +158 -0
- data/ext/instance_path.c +185 -0
- data/ext/lat_long.c +88 -0
- data/ext/layer.c +98 -0
- data/ext/layer_folder.c +99 -0
- data/ext/layers.c +122 -0
- data/ext/length.c +253 -0
- data/ext/line_styles.c +60 -0
- data/ext/loop.c +24 -0
- data/ext/material.c +144 -197
- data/ext/materials.c +49 -60
- data/ext/model.c +232 -26
- data/ext/options_store.c +188 -0
- data/ext/page.c +168 -0
- data/ext/pages.c +135 -0
- data/ext/point2d.c +195 -0
- data/ext/point3d.c +340 -0
- data/ext/polygon_mesh.c +253 -0
- data/ext/scriptup.h +279 -0
- data/ext/section_plane.c +44 -0
- data/ext/sketchup.c +102 -76
- data/ext/styles.c +91 -0
- data/ext/text.c +135 -0
- data/ext/texture.c +74 -83
- data/ext/texture_writer.c +104 -0
- data/ext/transformation.c +309 -0
- data/ext/transformation2d.c +190 -0
- data/ext/uv_helper.c +41 -0
- data/ext/vector2d.c +238 -0
- data/ext/vector3d.c +294 -0
- data/ext/vertex.c +67 -0
- data/lib/sketchup.rb +2 -2
- data/sig/_top_level.rbs +188 -0
- data/sig/array.rbs +52 -0
- data/sig/geom/bounding_box.rbs +28 -0
- data/sig/geom/bounds2d.rbs +20 -0
- data/sig/geom/lat_long.rbs +13 -0
- data/sig/geom/oriented_bounds2d.rbs +10 -0
- data/sig/geom/point2d.rbs +32 -0
- data/sig/geom/point3d.rbs +46 -0
- data/sig/geom/polygon_mesh.rbs +35 -0
- data/sig/geom/transformation.rbs +44 -0
- data/sig/geom/transformation2d.rbs +26 -0
- data/sig/geom/utm.rbs +14 -0
- data/sig/geom/vector2d.rbs +40 -0
- data/sig/geom/vector3d.rbs +49 -0
- data/sig/geom.rbs +25 -0
- data/sig/language_handler.rbs +8 -0
- data/sig/layout/angular_dimension.rbs +32 -0
- data/sig/layout/auto_text_definition.rbs +73 -0
- data/sig/layout/auto_text_definitions.rbs +15 -0
- data/sig/layout/connection_point.rbs +6 -0
- data/sig/layout/dictionary.rbs +18 -0
- data/sig/layout/document.rbs +61 -0
- data/sig/layout/ellipse.rbs +5 -0
- data/sig/layout/entities.rbs +10 -0
- data/sig/layout/entity.rbs +28 -0
- data/sig/layout/formatted_text.rbs +30 -0
- data/sig/layout/grid.rbs +24 -0
- data/sig/layout/group.rbs +17 -0
- data/sig/layout/image.rbs +7 -0
- data/sig/layout/label.rbs +31 -0
- data/sig/layout/layer.rbs +21 -0
- data/sig/layout/layer_instance.rbs +9 -0
- data/sig/layout/layers.rbs +18 -0
- data/sig/layout/linear_dimension.rbs +39 -0
- data/sig/layout/locked_entity_error.rbs +4 -0
- data/sig/layout/locked_layer_error.rbs +4 -0
- data/sig/layout/page.rbs +20 -0
- data/sig/layout/page_info.rbs +37 -0
- data/sig/layout/pages.rbs +17 -0
- data/sig/layout/path.rbs +34 -0
- data/sig/layout/rectangle.rbs +15 -0
- data/sig/layout/reference_entity.rbs +7 -0
- data/sig/layout/sketch_up_model.rbs +54 -0
- data/sig/layout/style.rbs +150 -0
- data/sig/layout/table.rbs +17 -0
- data/sig/layout/table_cell.rbs +13 -0
- data/sig/layout/table_column.rbs +10 -0
- data/sig/layout/table_row.rbs +10 -0
- data/sig/layout.rbs +4 -0
- data/sig/length.rbs +37 -0
- data/sig/numeric.rbs +23 -0
- data/sig/sketchup/animation.rbs +8 -0
- data/sig/sketchup/app_observer.rbs +11 -0
- data/sig/sketchup/arc_curve.rbs +14 -0
- data/sig/sketchup/attribute_dictionaries.rbs +11 -0
- data/sig/sketchup/attribute_dictionary.rbs +18 -0
- data/sig/sketchup/axes.rbs +13 -0
- data/sig/sketchup/behavior.rbs +19 -0
- data/sig/sketchup/camera.rbs +33 -0
- data/sig/sketchup/classification_schema.rbs +8 -0
- data/sig/sketchup/classifications.rbs +12 -0
- data/sig/sketchup/color.rbs +22 -0
- data/sig/sketchup/component_definition.rbs +43 -0
- data/sig/sketchup/component_instance.rbs +32 -0
- data/sig/sketchup/console.rbs +8 -0
- data/sig/sketchup/construction_line.rbs +17 -0
- data/sig/sketchup/construction_point.rbs +5 -0
- data/sig/sketchup/curve.rbs +13 -0
- data/sig/sketchup/definition_list.rbs +26 -0
- data/sig/sketchup/definition_observer.rbs +6 -0
- data/sig/sketchup/definitions_observer.rbs +8 -0
- data/sig/sketchup/dimension.rbs +18 -0
- data/sig/sketchup/dimension_linear.rbs +24 -0
- data/sig/sketchup/dimension_observer.rbs +5 -0
- data/sig/sketchup/dimension_radial.rbs +9 -0
- data/sig/sketchup/drawingelement.rbs +18 -0
- data/sig/sketchup/edge.rbs +24 -0
- data/sig/sketchup/edge_use.rbs +13 -0
- data/sig/sketchup/entities.rbs +61 -0
- data/sig/sketchup/entities_builder.rbs +15 -0
- data/sig/sketchup/entities_observer.rbs +9 -0
- data/sig/sketchup/entity.rbs +21 -0
- data/sig/sketchup/entity_observer.rbs +6 -0
- data/sig/sketchup/environment.rbs +25 -0
- data/sig/sketchup/environments.rbs +18 -0
- data/sig/sketchup/environments_observer.rbs +8 -0
- data/sig/sketchup/extensions_manager.rbs +11 -0
- data/sig/sketchup/face.rbs +44 -0
- data/sig/sketchup/frame_change_observer.rbs +5 -0
- data/sig/sketchup/group.rbs +38 -0
- data/sig/sketchup/http/request.rbs +17 -0
- data/sig/sketchup/http/response.rbs +7 -0
- data/sig/sketchup/http.rbs +27 -0
- data/sig/sketchup/image.rbs +23 -0
- data/sig/sketchup/image_rep.rbs +17 -0
- data/sig/sketchup/importer.rbs +14 -0
- data/sig/sketchup/input_point.rbs +25 -0
- data/sig/sketchup/instance_observer.rbs +6 -0
- data/sig/sketchup/instance_path.rbs +20 -0
- data/sig/sketchup/layer.rbs +20 -0
- data/sig/sketchup/layer_folder.rbs +26 -0
- data/sig/sketchup/layers.rbs +30 -0
- data/sig/sketchup/layers_observer.rbs +13 -0
- data/sig/sketchup/licensing/extension_license.rbs +8 -0
- data/sig/sketchup/licensing.rbs +15 -0
- data/sig/sketchup/line_style.rbs +5 -0
- data/sig/sketchup/line_styles.rbs +13 -0
- data/sig/sketchup/load_handler.rbs +8 -0
- data/sig/sketchup/loop.rbs +10 -0
- data/sig/sketchup/material.rbs +74 -0
- data/sig/sketchup/materials.rbs +22 -0
- data/sig/sketchup/materials_observer.rbs +10 -0
- data/sig/sketchup/menu.rbs +9 -0
- data/sig/sketchup/model.rbs +105 -0
- data/sig/sketchup/model_observer.rbs +23 -0
- data/sig/sketchup/options_manager.rbs +12 -0
- data/sig/sketchup/options_provider.rbs +23 -0
- data/sig/sketchup/options_provider_observer.rbs +5 -0
- data/sig/sketchup/overlay.rbs +21 -0
- data/sig/sketchup/overlays_manager.rbs +10 -0
- data/sig/sketchup/page.rbs +55 -0
- data/sig/sketchup/pages.rbs +25 -0
- data/sig/sketchup/pages_observer.rbs +7 -0
- data/sig/sketchup/pick_helper.rbs +28 -0
- data/sig/sketchup/regional_settings.rbs +7 -0
- data/sig/sketchup/rendering_options.rbs +89 -0
- data/sig/sketchup/rendering_options_observer.rbs +5 -0
- data/sig/sketchup/section_plane.rbs +12 -0
- data/sig/sketchup/selection.rbs +31 -0
- data/sig/sketchup/selection_observer.rbs +8 -0
- data/sig/sketchup/set.rbs +15 -0
- data/sig/sketchup/shadow_info.rbs +18 -0
- data/sig/sketchup/shadow_info_observer.rbs +5 -0
- data/sig/sketchup/skp.rbs +5 -0
- data/sig/sketchup/snap.rbs +10 -0
- data/sig/sketchup/style.rbs +9 -0
- data/sig/sketchup/styles.rbs +21 -0
- data/sig/sketchup/text.rbs +22 -0
- data/sig/sketchup/texture.rbs +14 -0
- data/sig/sketchup/texture_writer.rbs +14 -0
- data/sig/sketchup/tool.rbs +45 -0
- data/sig/sketchup/tools.rbs +14 -0
- data/sig/sketchup/tools_observer.rbs +6 -0
- data/sig/sketchup/uv_helper.rbs +6 -0
- data/sig/sketchup/vertex.rbs +11 -0
- data/sig/sketchup/view.rbs +87 -0
- data/sig/sketchup/view_observer.rbs +6 -0
- data/sig/sketchup.rbs +137 -0
- data/sig/sketchup_extension.rbs +23 -0
- data/sig/string.rbs +5 -0
- data/sig/ui/command.rbs +20 -0
- data/sig/ui/html_dialog.rbs +29 -0
- data/sig/ui/notification.rbs +16 -0
- data/sig/ui/toolbar.rbs +18 -0
- data/sig/ui/web_dialog.rbs +38 -0
- data/sig/ui.rbs +66 -0
- metadata +204 -275
- data/ext/attribute_dictionaries.h +0 -8
- data/ext/attribute_dictionary.h +0 -8
- data/ext/behavior.h +0 -8
- data/ext/color.h +0 -8
- data/ext/component_definition.h +0 -8
- data/ext/component_instance.h +0 -8
- data/ext/definition_list.h +0 -8
- data/ext/drawing_element.h +0 -8
- data/ext/entities.h +0 -8
- data/ext/entity.h +0 -8
- data/ext/material.h +0 -8
- data/ext/materials.h +0 -8
- data/ext/model.h +0 -8
- data/ext/not_implemented.c +0 -88
- data/ext/not_implemented.h +0 -20
- data/ext/sketchup.h +0 -9
- data/ext/texture.h +0 -8
- data/ext/typed_value.c +0 -84
- data/ext/typed_value.h +0 -11
- data/ext/utils.h +0 -111
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/application.h +0 -36
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/model.h +0 -59
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/overlay.h +0 -248
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/ruby_api.h +0 -118
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/color.h +0 -107
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/common.h +0 -178
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/defs.h +0 -19
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/extension_license.h +0 -62
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/bounding_box.h +0 -34
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/plane3d.h +0 -153
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/point2d.h +0 -96
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/point3d.h +0 -98
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/ray3d.h +0 -64
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/transformation.h +0 -321
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/transformation2d.h +0 -163
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/vector2d.h +0 -235
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/vector3d.h +0 -285
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry.h +0 -152
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/modelexporterplugin.h +0 -165
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/modelimporterplugin.h +0 -183
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/pluginprogresscallback.h +0 -84
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/initialize.h +0 -43
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/length_formatter.h +0 -424
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/arccurve.h +0 -244
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/arrow_type.h +0 -17
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/attribute_dictionary.h +0 -161
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/axes.h +0 -242
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/camera.h +0 -398
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classification_attribute.h +0 -89
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classification_info.h +0 -125
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classifications.h +0 -86
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_definition.h +0 -588
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_instance.h +0 -344
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/curve.h +0 -143
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/defs.h +0 -142
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension.h +0 -222
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_linear.h +0 -421
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_radial.h +0 -194
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_style.h +0 -253
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/drawing_element.h +0 -198
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dynamic_component_attribute.h +0 -92
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dynamic_component_info.h +0 -70
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/edge.h +0 -271
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/edge_use.h +0 -214
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entities.h +0 -834
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity.h +0 -186
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity_list.h +0 -80
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity_list_iterator.h +0 -90
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/face.h +0 -686
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/font.h +0 -138
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/geometry.h +0 -20
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/geometry_input.h +0 -685
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/group.h +0 -244
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/guide_line.h +0 -155
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/guide_point.h +0 -153
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/image.h +0 -288
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/image_rep.h +0 -275
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/instancepath.h +0 -266
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/layer.h +0 -265
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/layer_folder.h +0 -301
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/line_style.h +0 -211
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/line_styles.h +0 -81
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/location.h +0 -65
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/loop.h +0 -182
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/material.h +0 -390
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/mesh_helper.h +0 -187
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model.h +0 -1663
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model_version.h +0 -49
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/opening.h +0 -72
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/options_manager.h +0 -79
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/options_provider.h +0 -166
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/polyline3d.h +0 -140
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/rendering_options.h +0 -179
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/scene.h +0 -836
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/schema.h +0 -56
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/schema_type.h +0 -26
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/section_plane.h +0 -212
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/selection.h +0 -156
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/shadow_info.h +0 -147
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/skp.h +0 -45
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/style.h +0 -303
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/styles.h +0 -190
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/text.h +0 -384
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/texture.h +0 -358
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/texture_writer.h +0 -280
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/typed_value.h +0 -390
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/uv_helper.h +0 -79
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/vertex.h +0 -154
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/sketchup.h +0 -122
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/sketchup_info.h +0 -65
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/slapi.h +0 -16
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/transformation.h +0 -16
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/unicodestring.h +0 -239
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/utils/math_helpers.h +0 -124
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonGeometry.dylib +0 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonGeoutils.dylib +0 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonImage.dylib +0 -4
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonPreferences.dylib +0 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonUnits.dylib +0 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonUtils.dylib +0 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonZip.dylib +0 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Resources/Info.plist +0 -50
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/SketchUpAPI +0 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/_CodeSignature/CodeResources +0 -835
- data/sketchup-sdk-win/binaries/layout/x64/LayOutAPI.dll +0 -0
- data/sketchup-sdk-win/binaries/layout/x64/LayOutAPI.lib +0 -0
- data/sketchup-sdk-win/binaries/layout/x64/LayOutControllers.dll +0 -0
- data/sketchup-sdk-win/binaries/layout/x64/LayOutModel.dll +0 -0
- data/sketchup-sdk-win/binaries/layout/x64/LayOutRTF.dll +0 -0
- data/sketchup-sdk-win/binaries/layout/x64/LayOutUtils.dll +0 -0
- data/sketchup-sdk-win/binaries/layout/x64/SketchUpCommonPreferences.dll +0 -0
- data/sketchup-sdk-win/binaries/layout/x64/SketchUpViewerAPI.dll +0 -0
- data/sketchup-sdk-win/binaries/layout/x64/SketchUpViewerAPI.lib +0 -0
- data/sketchup-sdk-win/binaries/layout/x64/pdflib.dll +0 -0
- data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpAPI.dll +0 -0
- data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpAPI.lib +0 -0
- data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpCommonPreferences.dll +0 -0
- data/sketchup-sdk-win/binaries/sketchup/x64/sketchup.lib +0 -0
- data/sketchup-sdk-win/headers/LayOutAPI/application/application.h +0 -117
- data/sketchup-sdk-win/headers/LayOutAPI/common.h +0 -22
- data/sketchup-sdk-win/headers/LayOutAPI/geometry/geometry.h +0 -78
- data/sketchup-sdk-win/headers/LayOutAPI/initialize.h +0 -36
- data/sketchup-sdk-win/headers/LayOutAPI/layout.h +0 -49
- data/sketchup-sdk-win/headers/LayOutAPI/model/angulardimension.h +0 -468
- data/sketchup-sdk-win/headers/LayOutAPI/model/autotextdefinition.h +0 -569
- data/sketchup-sdk-win/headers/LayOutAPI/model/autotextdefinitionlist.h +0 -79
- data/sketchup-sdk-win/headers/LayOutAPI/model/connectionpoint.h +0 -107
- data/sketchup-sdk-win/headers/LayOutAPI/model/defs.h +0 -42
- data/sketchup-sdk-win/headers/LayOutAPI/model/dictionary.h +0 -120
- data/sketchup-sdk-win/headers/LayOutAPI/model/document.h +0 -864
- data/sketchup-sdk-win/headers/LayOutAPI/model/documentexportoptions.h +0 -59
- data/sketchup-sdk-win/headers/LayOutAPI/model/ellipse.h +0 -78
- data/sketchup-sdk-win/headers/LayOutAPI/model/entity.h +0 -330
- data/sketchup-sdk-win/headers/LayOutAPI/model/entityiterator.h +0 -49
- data/sketchup-sdk-win/headers/LayOutAPI/model/entitylist.h +0 -114
- data/sketchup-sdk-win/headers/LayOutAPI/model/formattedtext.h +0 -397
- data/sketchup-sdk-win/headers/LayOutAPI/model/grid.h +0 -251
- data/sketchup-sdk-win/headers/LayOutAPI/model/group.h +0 -243
- data/sketchup-sdk-win/headers/LayOutAPI/model/image.h +0 -146
- data/sketchup-sdk-win/headers/LayOutAPI/model/imagerep.h +0 -109
- data/sketchup-sdk-win/headers/LayOutAPI/model/label.h +0 -332
- data/sketchup-sdk-win/headers/LayOutAPI/model/layer.h +0 -207
- data/sketchup-sdk-win/headers/LayOutAPI/model/layerinstance.h +0 -117
- data/sketchup-sdk-win/headers/LayOutAPI/model/layerlist.h +0 -69
- data/sketchup-sdk-win/headers/LayOutAPI/model/lineardimension.h +0 -456
- data/sketchup-sdk-win/headers/LayOutAPI/model/page.h +0 -261
- data/sketchup-sdk-win/headers/LayOutAPI/model/pageinfo.h +0 -372
- data/sketchup-sdk-win/headers/LayOutAPI/model/pagelist.h +0 -81
- data/sketchup-sdk-win/headers/LayOutAPI/model/path.h +0 -464
- data/sketchup-sdk-win/headers/LayOutAPI/model/rectangle.h +0 -240
- data/sketchup-sdk-win/headers/LayOutAPI/model/referenceentity.h +0 -120
- data/sketchup-sdk-win/headers/LayOutAPI/model/sketchupmodel.h +0 -624
- data/sketchup-sdk-win/headers/LayOutAPI/model/skpfilereference.h +0 -94
- data/sketchup-sdk-win/headers/LayOutAPI/model/style.h +0 -1080
- data/sketchup-sdk-win/headers/LayOutAPI/model/table.h +0 -470
- data/sketchup-sdk-win/headers/LayOutAPI/model/typed_value.h +0 -156
- data/sketchup-sdk-win/headers/SketchUpAPI/application/application.h +0 -36
- data/sketchup-sdk-win/headers/SketchUpAPI/application/model.h +0 -59
- data/sketchup-sdk-win/headers/SketchUpAPI/application/overlay.h +0 -248
- data/sketchup-sdk-win/headers/SketchUpAPI/application/ruby_api.h +0 -118
- data/sketchup-sdk-win/headers/SketchUpAPI/color.h +0 -107
- data/sketchup-sdk-win/headers/SketchUpAPI/common.h +0 -178
- data/sketchup-sdk-win/headers/SketchUpAPI/defs.h +0 -19
- data/sketchup-sdk-win/headers/SketchUpAPI/extension_license.h +0 -62
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/bounding_box.h +0 -34
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/plane3d.h +0 -153
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/point2d.h +0 -96
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/point3d.h +0 -98
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/ray3d.h +0 -64
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/transformation.h +0 -321
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/transformation2d.h +0 -163
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/vector2d.h +0 -235
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/vector3d.h +0 -285
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry.h +0 -152
- data/sketchup-sdk-win/headers/SketchUpAPI/import_export/modelexporterplugin.h +0 -165
- data/sketchup-sdk-win/headers/SketchUpAPI/import_export/modelimporterplugin.h +0 -183
- data/sketchup-sdk-win/headers/SketchUpAPI/import_export/pluginprogresscallback.h +0 -84
- data/sketchup-sdk-win/headers/SketchUpAPI/initialize.h +0 -43
- data/sketchup-sdk-win/headers/SketchUpAPI/length_formatter.h +0 -424
- data/sketchup-sdk-win/headers/SketchUpAPI/model/arccurve.h +0 -244
- data/sketchup-sdk-win/headers/SketchUpAPI/model/arrow_type.h +0 -17
- data/sketchup-sdk-win/headers/SketchUpAPI/model/attribute_dictionary.h +0 -161
- data/sketchup-sdk-win/headers/SketchUpAPI/model/axes.h +0 -242
- data/sketchup-sdk-win/headers/SketchUpAPI/model/camera.h +0 -398
- data/sketchup-sdk-win/headers/SketchUpAPI/model/classification_attribute.h +0 -89
- data/sketchup-sdk-win/headers/SketchUpAPI/model/classification_info.h +0 -125
- data/sketchup-sdk-win/headers/SketchUpAPI/model/classifications.h +0 -86
- data/sketchup-sdk-win/headers/SketchUpAPI/model/component_definition.h +0 -588
- data/sketchup-sdk-win/headers/SketchUpAPI/model/component_instance.h +0 -344
- data/sketchup-sdk-win/headers/SketchUpAPI/model/curve.h +0 -143
- data/sketchup-sdk-win/headers/SketchUpAPI/model/defs.h +0 -142
- data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension.h +0 -222
- data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_linear.h +0 -421
- data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_radial.h +0 -194
- data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_style.h +0 -253
- data/sketchup-sdk-win/headers/SketchUpAPI/model/drawing_element.h +0 -198
- data/sketchup-sdk-win/headers/SketchUpAPI/model/dynamic_component_attribute.h +0 -92
- data/sketchup-sdk-win/headers/SketchUpAPI/model/dynamic_component_info.h +0 -70
- data/sketchup-sdk-win/headers/SketchUpAPI/model/edge.h +0 -271
- data/sketchup-sdk-win/headers/SketchUpAPI/model/edge_use.h +0 -214
- data/sketchup-sdk-win/headers/SketchUpAPI/model/entities.h +0 -834
- data/sketchup-sdk-win/headers/SketchUpAPI/model/entity.h +0 -186
- data/sketchup-sdk-win/headers/SketchUpAPI/model/entity_list.h +0 -80
- data/sketchup-sdk-win/headers/SketchUpAPI/model/entity_list_iterator.h +0 -90
- data/sketchup-sdk-win/headers/SketchUpAPI/model/face.h +0 -686
- data/sketchup-sdk-win/headers/SketchUpAPI/model/font.h +0 -138
- data/sketchup-sdk-win/headers/SketchUpAPI/model/geometry.h +0 -20
- data/sketchup-sdk-win/headers/SketchUpAPI/model/geometry_input.h +0 -685
- data/sketchup-sdk-win/headers/SketchUpAPI/model/group.h +0 -244
- data/sketchup-sdk-win/headers/SketchUpAPI/model/guide_line.h +0 -155
- data/sketchup-sdk-win/headers/SketchUpAPI/model/guide_point.h +0 -153
- data/sketchup-sdk-win/headers/SketchUpAPI/model/image.h +0 -288
- data/sketchup-sdk-win/headers/SketchUpAPI/model/image_rep.h +0 -275
- data/sketchup-sdk-win/headers/SketchUpAPI/model/instancepath.h +0 -266
- data/sketchup-sdk-win/headers/SketchUpAPI/model/layer.h +0 -265
- data/sketchup-sdk-win/headers/SketchUpAPI/model/layer_folder.h +0 -301
- data/sketchup-sdk-win/headers/SketchUpAPI/model/line_style.h +0 -211
- data/sketchup-sdk-win/headers/SketchUpAPI/model/line_styles.h +0 -81
- data/sketchup-sdk-win/headers/SketchUpAPI/model/location.h +0 -65
- data/sketchup-sdk-win/headers/SketchUpAPI/model/loop.h +0 -182
- data/sketchup-sdk-win/headers/SketchUpAPI/model/material.h +0 -390
- data/sketchup-sdk-win/headers/SketchUpAPI/model/mesh_helper.h +0 -187
- data/sketchup-sdk-win/headers/SketchUpAPI/model/model.h +0 -1663
- data/sketchup-sdk-win/headers/SketchUpAPI/model/model_version.h +0 -49
- data/sketchup-sdk-win/headers/SketchUpAPI/model/opening.h +0 -72
- data/sketchup-sdk-win/headers/SketchUpAPI/model/options_manager.h +0 -79
- data/sketchup-sdk-win/headers/SketchUpAPI/model/options_provider.h +0 -166
- data/sketchup-sdk-win/headers/SketchUpAPI/model/polyline3d.h +0 -140
- data/sketchup-sdk-win/headers/SketchUpAPI/model/rendering_options.h +0 -179
- data/sketchup-sdk-win/headers/SketchUpAPI/model/scene.h +0 -836
- data/sketchup-sdk-win/headers/SketchUpAPI/model/schema.h +0 -56
- data/sketchup-sdk-win/headers/SketchUpAPI/model/schema_type.h +0 -26
- data/sketchup-sdk-win/headers/SketchUpAPI/model/section_plane.h +0 -212
- data/sketchup-sdk-win/headers/SketchUpAPI/model/selection.h +0 -156
- data/sketchup-sdk-win/headers/SketchUpAPI/model/shadow_info.h +0 -147
- data/sketchup-sdk-win/headers/SketchUpAPI/model/skp.h +0 -45
- data/sketchup-sdk-win/headers/SketchUpAPI/model/style.h +0 -303
- data/sketchup-sdk-win/headers/SketchUpAPI/model/styles.h +0 -190
- data/sketchup-sdk-win/headers/SketchUpAPI/model/text.h +0 -384
- data/sketchup-sdk-win/headers/SketchUpAPI/model/texture.h +0 -358
- data/sketchup-sdk-win/headers/SketchUpAPI/model/texture_writer.h +0 -280
- data/sketchup-sdk-win/headers/SketchUpAPI/model/typed_value.h +0 -390
- data/sketchup-sdk-win/headers/SketchUpAPI/model/uv_helper.h +0 -79
- data/sketchup-sdk-win/headers/SketchUpAPI/model/vertex.h +0 -154
- data/sketchup-sdk-win/headers/SketchUpAPI/sketchup.h +0 -122
- data/sketchup-sdk-win/headers/SketchUpAPI/sketchup_info.h +0 -65
- data/sketchup-sdk-win/headers/SketchUpAPI/slapi.h +0 -16
- data/sketchup-sdk-win/headers/SketchUpAPI/transformation.h +0 -16
- data/sketchup-sdk-win/headers/SketchUpAPI/unicodestring.h +0 -239
- data/sketchup-sdk-win/headers/SketchUpAPI/utils/math_helpers.h +0 -124
data/ext/layers.c
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#include <scriptup.h>
|
|
2
|
+
|
|
3
|
+
#define MODEL(self) SU_REF(SUModelRef, self)
|
|
4
|
+
|
|
5
|
+
DEFINE_REF_LIST(layers_to_a, SUModelRef, SUModelGetNumLayers, SUModelGetLayers, SULayerRef, cLayer)
|
|
6
|
+
DEFINE_REF_LIST(layers_top_level, SUModelRef, SUModelGetNumTopLevelLayers, SUModelGetTopLevelLayers, SULayerRef, cLayer)
|
|
7
|
+
DEFINE_REF_LIST(layers_folder_list, SUModelRef, SUModelGetNumLayerFolders, SUModelGetLayerFolders, SULayerFolderRef, cLayerFolder)
|
|
8
|
+
|
|
9
|
+
static VALUE layers_all(VALUE self) { return layers_to_a(MODEL(self)); }
|
|
10
|
+
static VALUE layers_layers(VALUE self) { return layers_top_level(MODEL(self)); }
|
|
11
|
+
static VALUE layers_folders(VALUE self) { return layers_folder_list(MODEL(self)); }
|
|
12
|
+
|
|
13
|
+
static VALUE layers_each(VALUE self) { return su_yield_each(self, layers_all(self)); }
|
|
14
|
+
static VALUE layers_each_layer(VALUE self) { return su_yield_each(self, layers_layers(self)); }
|
|
15
|
+
static VALUE layers_each_folder(VALUE self) { return su_yield_each(self, layers_folders(self)); }
|
|
16
|
+
|
|
17
|
+
static VALUE layers_length(VALUE self) { return LONG2NUM(RARRAY_LEN(layers_all(self))); }
|
|
18
|
+
static VALUE layers_count_layers(VALUE self) { return LONG2NUM(RARRAY_LEN(layers_layers(self))); }
|
|
19
|
+
static VALUE layers_count_folders(VALUE self) { return LONG2NUM(RARRAY_LEN(layers_folders(self))); }
|
|
20
|
+
|
|
21
|
+
static VALUE layers_aref(VALUE self, VALUE key)
|
|
22
|
+
{
|
|
23
|
+
VALUE layers = layers_all(self);
|
|
24
|
+
if (RB_TYPE_P(key, T_STRING))
|
|
25
|
+
return su_find_by(layers, "name", key);
|
|
26
|
+
return rb_ary_entry(layers, NUM2LONG(key));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static VALUE layers_unique_name(int argc, VALUE* argv, VALUE self)
|
|
30
|
+
{
|
|
31
|
+
VALUE base;
|
|
32
|
+
rb_scan_args(argc, argv, "01", &base);
|
|
33
|
+
base = NIL_P(base) ? rb_str_new_cstr("Tag") : StringValue(base);
|
|
34
|
+
VALUE layers = layers_all(self);
|
|
35
|
+
VALUE candidate = base;
|
|
36
|
+
for (long n = 1; !NIL_P(su_find_by(layers, "name", candidate)); n++)
|
|
37
|
+
candidate = rb_sprintf("%"PRIsVALUE"%ld", base, n);
|
|
38
|
+
return candidate;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static VALUE layers_add(VALUE self, VALUE name)
|
|
42
|
+
{
|
|
43
|
+
VALUE existing = su_find_by(layers_all(self), "name", StringValue(name));
|
|
44
|
+
if (!NIL_P(existing))
|
|
45
|
+
return existing;
|
|
46
|
+
SULayerRef layer = SU_INVALID;
|
|
47
|
+
SULayerCreate(&layer);
|
|
48
|
+
SULayerSetName(layer, StringValueCStr(name));
|
|
49
|
+
SUModelAddLayers(MODEL(self), 1, &layer);
|
|
50
|
+
return su_wrap(cLayer, layer.ptr);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static VALUE layers_add_folder(VALUE self, VALUE folder)
|
|
54
|
+
{
|
|
55
|
+
SULayerFolderRef ref = SU_INVALID;
|
|
56
|
+
if (rb_obj_is_kind_of(folder, cLayerFolder))
|
|
57
|
+
ref.ptr = DATA_PTR(folder);
|
|
58
|
+
else
|
|
59
|
+
SULayerFolderCreate(&ref, StringValueCStr(folder));
|
|
60
|
+
SUModelAddLayerFolder(MODEL(self), ref);
|
|
61
|
+
return su_wrap(cLayerFolder, ref.ptr);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static VALUE layers_remove(int argc, VALUE* argv, VALUE self)
|
|
65
|
+
{
|
|
66
|
+
VALUE layer;
|
|
67
|
+
VALUE remove_geometry;
|
|
68
|
+
rb_scan_args(argc, argv, "11", &layer, &remove_geometry);
|
|
69
|
+
if (RTEST(remove_geometry))
|
|
70
|
+
rb_raise(rb_eNotImpError, "the C API cannot remove a tag's geometry");
|
|
71
|
+
if (!rb_obj_is_kind_of(layer, cLayer))
|
|
72
|
+
layer = layers_aref(self, layer);
|
|
73
|
+
if (NIL_P(layer))
|
|
74
|
+
return Qfalse;
|
|
75
|
+
SULayerRef ref = SU_REF(SULayerRef, layer);
|
|
76
|
+
return BOOL2RB(SUModelRemoveLayers(MODEL(self), 1, &ref) == SU_ERROR_NONE);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
static VALUE layers_remove_folder(VALUE self, VALUE folder)
|
|
80
|
+
{
|
|
81
|
+
SULayerFolderRef ref = {su_unwrap(folder, cLayerFolder)};
|
|
82
|
+
SUModelRemoveLayerFolders(MODEL(self), 1, &ref);
|
|
83
|
+
return Qnil;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static VALUE layers_purge_unused(VALUE self)
|
|
87
|
+
{
|
|
88
|
+
size_t count = 0;
|
|
89
|
+
SUModelPurgeUnusedLayers(MODEL(self), &count);
|
|
90
|
+
return SIZET2NUM(count);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static VALUE layers_purge_unused_folders(VALUE self)
|
|
94
|
+
{
|
|
95
|
+
size_t count = 0;
|
|
96
|
+
SUModelPurgeEmptyLayerFolders(MODEL(self), &count);
|
|
97
|
+
return SIZET2NUM(count);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
void Init_layers(void)
|
|
101
|
+
{
|
|
102
|
+
rb_include_module(cLayers, rb_mEnumerable);
|
|
103
|
+
rb_define_method(cLayers, "each", layers_each, 0);
|
|
104
|
+
rb_define_method(cLayers, "each_layer", layers_each_layer, 0);
|
|
105
|
+
rb_define_method(cLayers, "each_folder", layers_each_folder, 0);
|
|
106
|
+
rb_define_method(cLayers, "layers", layers_layers, 0);
|
|
107
|
+
rb_define_method(cLayers, "folders", layers_folders, 0);
|
|
108
|
+
rb_define_method(cLayers, "[]", layers_aref, 1);
|
|
109
|
+
rb_define_method(cLayers, "at", layers_aref, 1);
|
|
110
|
+
rb_define_method(cLayers, "count", layers_length, 0);
|
|
111
|
+
rb_define_method(cLayers, "length", layers_length, 0);
|
|
112
|
+
rb_define_method(cLayers, "size", layers_length, 0);
|
|
113
|
+
rb_define_method(cLayers, "count_layers", layers_count_layers, 0);
|
|
114
|
+
rb_define_method(cLayers, "count_folders", layers_count_folders, 0);
|
|
115
|
+
rb_define_method(cLayers, "add", layers_add, 1);
|
|
116
|
+
rb_define_method(cLayers, "add_folder", layers_add_folder, 1);
|
|
117
|
+
rb_define_method(cLayers, "remove", layers_remove, -1);
|
|
118
|
+
rb_define_method(cLayers, "remove_folder", layers_remove_folder, 1);
|
|
119
|
+
rb_define_method(cLayers, "purge_unused", layers_purge_unused, 0);
|
|
120
|
+
rb_define_method(cLayers, "purge_unused_folders", layers_purge_unused_folders, 0);
|
|
121
|
+
rb_define_method(cLayers, "unique_name", layers_unique_name, -1);
|
|
122
|
+
}
|
data/ext/length.c
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
#include <scriptup.h>
|
|
2
|
+
|
|
3
|
+
#define LENGTH_TOLERANCE 1.0e-3
|
|
4
|
+
|
|
5
|
+
#define LENGTH(obj) (*(double*)DATA_PTR(obj))
|
|
6
|
+
|
|
7
|
+
VALUE su_length_new(double inches)
|
|
8
|
+
{
|
|
9
|
+
double* value;
|
|
10
|
+
VALUE obj = Data_Make_Struct(cLength, double, 0, RUBY_DEFAULT_FREE, value);
|
|
11
|
+
*value = inches;
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static SULengthFormatterRef length_formatter(void)
|
|
16
|
+
{
|
|
17
|
+
SULengthFormatterRef formatter = SU_INVALID;
|
|
18
|
+
SULengthFormatterCreate(&formatter);
|
|
19
|
+
SUModelRef model = Sketchup_get_active_model();
|
|
20
|
+
if (SUIsValid(model))
|
|
21
|
+
SUModelGetLengthFormatter(model, &formatter);
|
|
22
|
+
return formatter;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static VALUE length_to_f(VALUE self)
|
|
26
|
+
{
|
|
27
|
+
return DBL2NUM(LENGTH(self));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static VALUE length_to_l(VALUE self)
|
|
31
|
+
{
|
|
32
|
+
return self;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static VALUE length_to_s(VALUE self)
|
|
36
|
+
{
|
|
37
|
+
SULengthFormatterRef formatter = length_formatter();
|
|
38
|
+
SUStringRef string = SU_INVALID;
|
|
39
|
+
SUStringCreate(&string);
|
|
40
|
+
SULengthFormatterGetLengthString(formatter, LENGTH(self), false, &string);
|
|
41
|
+
VALUE output = su_string_to_rb(string);
|
|
42
|
+
SUStringRelease(&string);
|
|
43
|
+
SULengthFormatterRelease(&formatter);
|
|
44
|
+
return output;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static VALUE length_inspect(VALUE self)
|
|
48
|
+
{
|
|
49
|
+
return rb_funcall(length_to_f(self), (rb_intern)("inspect"), 0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static int length_compare(VALUE self, VALUE other)
|
|
53
|
+
{
|
|
54
|
+
double diff = LENGTH(self) - NUM2DBL(other);
|
|
55
|
+
return diff > LENGTH_TOLERANCE ? 1 : diff < -LENGTH_TOLERANCE ? -1 : 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static VALUE length_cmp(VALUE self, VALUE other)
|
|
59
|
+
{
|
|
60
|
+
if (!rb_obj_is_kind_of(other, rb_cNumeric))
|
|
61
|
+
return Qnil;
|
|
62
|
+
return INT2FIX(length_compare(self, other));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
static VALUE length_eq(VALUE self, VALUE other)
|
|
66
|
+
{
|
|
67
|
+
return BOOL2RB(rb_obj_is_kind_of(other, rb_cNumeric) && length_compare(self, other) == 0);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static VALUE length_lt(VALUE self, VALUE other) { return BOOL2RB(length_compare(self, other) < 0); }
|
|
71
|
+
static VALUE length_le(VALUE self, VALUE other) { return BOOL2RB(length_compare(self, other) <= 0); }
|
|
72
|
+
static VALUE length_gt(VALUE self, VALUE other) { return BOOL2RB(length_compare(self, other) > 0); }
|
|
73
|
+
static VALUE length_ge(VALUE self, VALUE other) { return BOOL2RB(length_compare(self, other) >= 0); }
|
|
74
|
+
|
|
75
|
+
static VALUE length_hash(VALUE self)
|
|
76
|
+
{
|
|
77
|
+
return rb_funcall(length_to_f(self), (rb_intern)("hash"), 0);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
static VALUE length_eql_p(VALUE self, VALUE other)
|
|
81
|
+
{
|
|
82
|
+
return BOOL2RB(rb_obj_is_kind_of(other, cLength) && LENGTH(self) == LENGTH(other));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Arithmetic behaves like Float and returns Float.
|
|
86
|
+
static VALUE length_coerce(VALUE self, VALUE other)
|
|
87
|
+
{
|
|
88
|
+
return rb_assoc_new(DBL2NUM(NUM2DBL(other)), length_to_f(self));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
#define DEFINE_FLOAT_OP(fn, op) \
|
|
92
|
+
static VALUE fn(VALUE self, VALUE other) \
|
|
93
|
+
{ \
|
|
94
|
+
return rb_funcall(length_to_f(self), (rb_intern)(op), 1, other); \
|
|
95
|
+
}
|
|
96
|
+
DEFINE_FLOAT_OP(length_plus, "+")
|
|
97
|
+
DEFINE_FLOAT_OP(length_minus, "-")
|
|
98
|
+
DEFINE_FLOAT_OP(length_mul, "*")
|
|
99
|
+
DEFINE_FLOAT_OP(length_div, "/")
|
|
100
|
+
|
|
101
|
+
static VALUE length_uminus(VALUE self)
|
|
102
|
+
{
|
|
103
|
+
return DBL2NUM(-LENGTH(self));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
static VALUE length_to_i(VALUE self)
|
|
107
|
+
{
|
|
108
|
+
return rb_funcall(length_to_f(self), (rb_intern)("to_i"), 0);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Numeric and String extensions. Lengths are stored in inches.
|
|
112
|
+
#define DEFINE_UNIT(name, inches_per_unit) \
|
|
113
|
+
static VALUE numeric_##name(VALUE self) { return su_length_new(NUM2DBL(self) * (inches_per_unit)); } \
|
|
114
|
+
static VALUE numeric_to_##name(VALUE self) { return DBL2NUM(NUM2DBL(self) / (inches_per_unit)); }
|
|
115
|
+
DEFINE_UNIT(inch, 1.0)
|
|
116
|
+
DEFINE_UNIT(feet, 12.0)
|
|
117
|
+
DEFINE_UNIT(yard, 36.0)
|
|
118
|
+
DEFINE_UNIT(mile, 63360.0)
|
|
119
|
+
DEFINE_UNIT(mm, 1.0 / 25.4)
|
|
120
|
+
DEFINE_UNIT(cm, 1.0 / 2.54)
|
|
121
|
+
DEFINE_UNIT(m, 100.0 / 2.54)
|
|
122
|
+
DEFINE_UNIT(km, 100000.0 / 2.54)
|
|
123
|
+
|
|
124
|
+
static VALUE numeric_to_l(VALUE self)
|
|
125
|
+
{
|
|
126
|
+
return su_length_new(NUM2DBL(self));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
static VALUE numeric_degrees(VALUE self)
|
|
130
|
+
{
|
|
131
|
+
return DBL2NUM(NUM2DBL(self) * M_PI / 180.0);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
static VALUE numeric_radians(VALUE self)
|
|
135
|
+
{
|
|
136
|
+
return DBL2NUM(NUM2DBL(self) * 180.0 / M_PI);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
static VALUE string_to_l(VALUE self)
|
|
140
|
+
{
|
|
141
|
+
SULengthFormatterRef formatter = length_formatter();
|
|
142
|
+
SUStringRef string = SU_INVALID;
|
|
143
|
+
SUStringCreateFromUTF8(&string, StringValueCStr(self));
|
|
144
|
+
double value = 0.0;
|
|
145
|
+
enum SUResult result = SULengthFormatterParseString(formatter, string, &value);
|
|
146
|
+
SUStringRelease(&string);
|
|
147
|
+
SULengthFormatterRelease(&formatter);
|
|
148
|
+
if (result != SU_ERROR_NONE)
|
|
149
|
+
rb_raise(rb_eArgError, "Cannot convert \"%"PRIsVALUE"\" to Length", self);
|
|
150
|
+
return su_length_new(value);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
typedef enum SUResult (*format_fn)(SULengthFormatterRef, double, SUStringRef*);
|
|
154
|
+
|
|
155
|
+
static enum SUResult format_length_string(SULengthFormatterRef f, double v, SUStringRef* s) { return SULengthFormatterGetLengthString(f, v, false, s); }
|
|
156
|
+
|
|
157
|
+
static VALUE format_with(double value, format_fn fn, VALUE precision)
|
|
158
|
+
{
|
|
159
|
+
SULengthFormatterRef formatter = length_formatter();
|
|
160
|
+
if (!NIL_P(precision))
|
|
161
|
+
SULengthFormatterSetPrecision(formatter, NUM2SIZET(precision));
|
|
162
|
+
SUStringRef string = SU_INVALID;
|
|
163
|
+
SUStringCreate(&string);
|
|
164
|
+
fn(formatter, value, &string);
|
|
165
|
+
VALUE output = su_string_to_rb(string);
|
|
166
|
+
SUStringRelease(&string);
|
|
167
|
+
SULengthFormatterRelease(&formatter);
|
|
168
|
+
return output;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
static VALUE sketchup_format_length(int argc, VALUE* argv, VALUE self)
|
|
172
|
+
{
|
|
173
|
+
VALUE number, precision;
|
|
174
|
+
rb_scan_args(argc, argv, "11", &number, &precision);
|
|
175
|
+
return format_with(NUM2DBL(number), format_length_string, precision);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
static VALUE sketchup_format_area(VALUE self, VALUE number)
|
|
179
|
+
{
|
|
180
|
+
return format_with(NUM2DBL(number), SULengthFormatterGetAreaString, Qnil);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
static VALUE sketchup_format_volume(VALUE self, VALUE number)
|
|
184
|
+
{
|
|
185
|
+
return format_with(NUM2DBL(number), SULengthFormatterGetVolumeString, Qnil);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
static VALUE sketchup_parse_length(VALUE self, VALUE string)
|
|
189
|
+
{
|
|
190
|
+
SULengthFormatterRef formatter = length_formatter();
|
|
191
|
+
SUStringRef input = SU_INVALID;
|
|
192
|
+
SUStringCreateFromUTF8(&input, StringValueCStr(string));
|
|
193
|
+
double value = 0.0;
|
|
194
|
+
enum SUResult result = SULengthFormatterParseString(formatter, input, &value);
|
|
195
|
+
SUStringRelease(&input);
|
|
196
|
+
SULengthFormatterRelease(&formatter);
|
|
197
|
+
return result == SU_ERROR_NONE ? DBL2NUM(value) : Qnil;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
void Init_length(void)
|
|
201
|
+
{
|
|
202
|
+
rb_define_singleton_method(mSketchup, "format_length", sketchup_format_length, -1);
|
|
203
|
+
rb_define_singleton_method(mSketchup, "format_area", sketchup_format_area, 1);
|
|
204
|
+
rb_define_singleton_method(mSketchup, "format_volume", sketchup_format_volume, 1);
|
|
205
|
+
rb_define_singleton_method(mSketchup, "parse_length", sketchup_parse_length, 1);
|
|
206
|
+
static const struct { const char* name; int value; } constants[] = {
|
|
207
|
+
{"Architectural", 0}, {"Decimal", 1}, {"Engineering", 2}, {"Fractional", 3},
|
|
208
|
+
{"Inches", 0}, {"Feet", 1}, {"Millimeter", 2}, {"Centimeter", 3}, {"Meter", 4}, {"Yard", 5},
|
|
209
|
+
{"SquareInches", 0}, {"SquareFeet", 1}, {"SquareMillimeter", 2}, {"SquareCentimeter", 3},
|
|
210
|
+
{"SquareMeter", 4}, {"SquareYard", 5},
|
|
211
|
+
{"CubicInches", 0}, {"CubicFeet", 1}, {"CubicMillimeter", 2}, {"CubicCentimeter", 3},
|
|
212
|
+
{"CubicMeter", 4}, {"CubicYard", 5}, {"Liter", 6}, {"USGallon", 7},
|
|
213
|
+
};
|
|
214
|
+
for (size_t i = 0; i < sizeof(constants) / sizeof(constants[0]); i++)
|
|
215
|
+
rb_define_const(cLength, constants[i].name, INT2FIX(constants[i].value));
|
|
216
|
+
|
|
217
|
+
rb_undef_method(rb_singleton_class(cLength), "new");
|
|
218
|
+
rb_define_method(cLength, "to_f", length_to_f, 0);
|
|
219
|
+
rb_define_method(cLength, "to_l", length_to_l, 0);
|
|
220
|
+
rb_define_method(cLength, "to_s", length_to_s, 0);
|
|
221
|
+
rb_define_method(cLength, "inspect", length_inspect, 0);
|
|
222
|
+
rb_define_method(cLength, "<=>", length_cmp, 1);
|
|
223
|
+
rb_define_method(cLength, "==", length_eq, 1);
|
|
224
|
+
rb_define_method(cLength, "<", length_lt, 1);
|
|
225
|
+
rb_define_method(cLength, "<=", length_le, 1);
|
|
226
|
+
rb_define_method(cLength, ">", length_gt, 1);
|
|
227
|
+
rb_define_method(cLength, ">=", length_ge, 1);
|
|
228
|
+
rb_define_method(cLength, "hash", length_hash, 0);
|
|
229
|
+
rb_define_method(cLength, "eql?", length_eql_p, 1);
|
|
230
|
+
rb_define_method(cLength, "coerce", length_coerce, 1);
|
|
231
|
+
rb_define_method(cLength, "+", length_plus, 1);
|
|
232
|
+
rb_define_method(cLength, "-", length_minus, 1);
|
|
233
|
+
rb_define_method(cLength, "*", length_mul, 1);
|
|
234
|
+
rb_define_method(cLength, "/", length_div, 1);
|
|
235
|
+
rb_define_method(cLength, "-@", length_uminus, 0);
|
|
236
|
+
rb_define_method(cLength, "to_i", length_to_i, 0);
|
|
237
|
+
|
|
238
|
+
#define DEFINE_UNIT_METHODS(name) \
|
|
239
|
+
rb_define_method(rb_cNumeric, #name, numeric_##name, 0); \
|
|
240
|
+
rb_define_method(rb_cNumeric, "to_" #name, numeric_to_##name, 0);
|
|
241
|
+
DEFINE_UNIT_METHODS(inch)
|
|
242
|
+
DEFINE_UNIT_METHODS(feet)
|
|
243
|
+
DEFINE_UNIT_METHODS(yard)
|
|
244
|
+
DEFINE_UNIT_METHODS(mile)
|
|
245
|
+
DEFINE_UNIT_METHODS(mm)
|
|
246
|
+
DEFINE_UNIT_METHODS(cm)
|
|
247
|
+
DEFINE_UNIT_METHODS(m)
|
|
248
|
+
DEFINE_UNIT_METHODS(km)
|
|
249
|
+
rb_define_method(rb_cNumeric, "to_l", numeric_to_l, 0);
|
|
250
|
+
rb_define_method(rb_cNumeric, "degrees", numeric_degrees, 0);
|
|
251
|
+
rb_define_method(rb_cNumeric, "radians", numeric_radians, 0);
|
|
252
|
+
rb_define_method(rb_cString, "to_l", string_to_l, 0);
|
|
253
|
+
}
|
data/ext/line_styles.c
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#include <scriptup.h>
|
|
2
|
+
|
|
3
|
+
#define STYLES(self) SU_REF(SULineStylesRef, self)
|
|
4
|
+
|
|
5
|
+
DEFINE_STRING_GETTER(linestyle_name, SULineStyleRef, SULineStyleGetName)
|
|
6
|
+
DEFINE_STRING_LIST(linestyles_name_list, SULineStylesRef, SULineStylesGetNumLineStyles, SULineStylesGetLineStyleNames)
|
|
7
|
+
|
|
8
|
+
static VALUE linestyles_names(VALUE self)
|
|
9
|
+
{
|
|
10
|
+
return linestyles_name_list(STYLES(self));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static VALUE linestyles_by_name(VALUE self, VALUE name)
|
|
14
|
+
{
|
|
15
|
+
SULineStyleRef style = SU_INVALID;
|
|
16
|
+
if (SULineStylesGetLineStyleByName(STYLES(self), StringValueCStr(name), &style) != SU_ERROR_NONE)
|
|
17
|
+
return Qnil;
|
|
18
|
+
return su_wrap_or_nil(cLineStyle, style.ptr);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static VALUE linestyles_to_a(VALUE self)
|
|
22
|
+
{
|
|
23
|
+
VALUE names = linestyles_names(self);
|
|
24
|
+
VALUE styles = rb_ary_new_capa(RARRAY_LEN(names));
|
|
25
|
+
for (long i = 0; i < RARRAY_LEN(names); i++)
|
|
26
|
+
rb_ary_push(styles, linestyles_by_name(self, RARRAY_AREF(names, i)));
|
|
27
|
+
return styles;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static VALUE linestyles_aref(VALUE self, VALUE key)
|
|
31
|
+
{
|
|
32
|
+
if (RB_TYPE_P(key, T_STRING))
|
|
33
|
+
return linestyles_by_name(self, key);
|
|
34
|
+
return rb_ary_entry(linestyles_to_a(self), NUM2LONG(key));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static VALUE linestyles_each(VALUE self)
|
|
38
|
+
{
|
|
39
|
+
su_yield_each(self, linestyles_to_a(self));
|
|
40
|
+
return Qnil;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static VALUE linestyles_size(VALUE self)
|
|
44
|
+
{
|
|
45
|
+
size_t count = 0;
|
|
46
|
+
SULineStylesGetNumLineStyles(STYLES(self), &count);
|
|
47
|
+
return SIZET2NUM(count);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
void Init_line_styles(void)
|
|
51
|
+
{
|
|
52
|
+
rb_define_method(cLineStyle, "name", linestyle_name, 0);
|
|
53
|
+
rb_include_module(cLineStyles, rb_mEnumerable);
|
|
54
|
+
rb_define_method(cLineStyles, "names", linestyles_names, 0);
|
|
55
|
+
rb_define_method(cLineStyles, "to_a", linestyles_to_a, 0);
|
|
56
|
+
rb_define_method(cLineStyles, "[]", linestyles_aref, 1);
|
|
57
|
+
rb_define_method(cLineStyles, "at", linestyles_aref, 1);
|
|
58
|
+
rb_define_method(cLineStyles, "each", linestyles_each, 0);
|
|
59
|
+
rb_define_method(cLineStyles, "size", linestyles_size, 0);
|
|
60
|
+
}
|
data/ext/loop.c
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#include <scriptup.h>
|
|
2
|
+
|
|
3
|
+
#define LOOP(self) SU_REF(SULoopRef, self)
|
|
4
|
+
|
|
5
|
+
DEFINE_REF_LIST(loop_vertex_list, SULoopRef, SULoopGetNumVertices, SULoopGetVertices, SUVertexRef, cVertex)
|
|
6
|
+
DEFINE_REF_LIST(loop_edge_list, SULoopRef, SULoopGetNumVertices, SULoopGetEdges, SUEdgeRef, cEdge)
|
|
7
|
+
DEFINE_REF_LIST(loop_edgeuse_list, SULoopRef, SULoopGetNumVertices, SULoopGetEdgeUses, SUEdgeUseRef, cEdgeUse)
|
|
8
|
+
DEFINE_REF_GETTER(loop_face, SULoopRef, SULoopGetFace, SUFaceRef, cFace)
|
|
9
|
+
DEFINE_BOOL_GETTER(loop_convex_p, SULoopRef, SULoopIsConvex)
|
|
10
|
+
DEFINE_BOOL_GETTER(loop_outer_p, SULoopRef, SULoopIsOuterLoop)
|
|
11
|
+
|
|
12
|
+
static VALUE loop_vertices(VALUE self) { return loop_vertex_list(LOOP(self)); }
|
|
13
|
+
static VALUE loop_edges(VALUE self) { return loop_edge_list(LOOP(self)); }
|
|
14
|
+
static VALUE loop_edgeuses(VALUE self) { return loop_edgeuse_list(LOOP(self)); }
|
|
15
|
+
|
|
16
|
+
void Init_loop(void)
|
|
17
|
+
{
|
|
18
|
+
rb_define_method(cLoop, "vertices", loop_vertices, 0);
|
|
19
|
+
rb_define_method(cLoop, "edges", loop_edges, 0);
|
|
20
|
+
rb_define_method(cLoop, "edgeuses", loop_edgeuses, 0);
|
|
21
|
+
rb_define_method(cLoop, "face", loop_face, 0);
|
|
22
|
+
rb_define_method(cLoop, "convex?", loop_convex_p, 0);
|
|
23
|
+
rb_define_method(cLoop, "outer?", loop_outer_p, 0);
|
|
24
|
+
}
|