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.
- checksums.yaml +7 -0
- data/LICENSE.txt +11 -0
- data/README.md +5 -0
- data/ext/attribute_dictionaries.c +45 -0
- data/ext/attribute_dictionaries.h +3 -0
- data/ext/attribute_dictionary.c +156 -0
- data/ext/attribute_dictionary.h +3 -0
- data/ext/behavior.c +10 -0
- data/ext/behavior.h +3 -0
- data/ext/color.c +211 -0
- data/ext/color.h +3 -0
- data/ext/component_definition.c +188 -0
- data/ext/component_definition.h +3 -0
- data/ext/component_instance.c +10 -0
- data/ext/component_instance.h +3 -0
- data/ext/definition_list.c +145 -0
- data/ext/definition_list.h +3 -0
- data/ext/drawing_element.c +10 -0
- data/ext/drawing_element.h +3 -0
- data/ext/entities.c +11 -0
- data/ext/entities.h +3 -0
- data/ext/entity.c +253 -0
- data/ext/entity.h +3 -0
- data/ext/extconf.rb +38 -0
- data/ext/material.c +242 -0
- data/ext/material.h +3 -0
- data/ext/materials.c +80 -0
- data/ext/materials.h +3 -0
- data/ext/model.c +42 -0
- data/ext/model.h +3 -0
- data/ext/sketchup.c +89 -0
- data/ext/sketchup.h +4 -0
- data/ext/texture.c +9 -0
- data/ext/texture.h +3 -0
- data/ext/typed_value.c +84 -0
- data/ext/typed_value.h +5 -0
- data/ext/utils.h +80 -0
- data/lib/sketchup.rb +12 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/application.h +36 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/model.h +59 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/overlay.h +248 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/ruby_api.h +118 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/color.h +107 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/common.h +178 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/defs.h +19 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/extension_license.h +62 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/bounding_box.h +34 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/plane3d.h +153 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/point2d.h +96 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/point3d.h +98 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/ray3d.h +64 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/transformation.h +321 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/transformation2d.h +163 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/vector2d.h +235 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/vector3d.h +285 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry.h +152 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/modelexporterplugin.h +165 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/modelimporterplugin.h +183 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/pluginprogresscallback.h +84 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/initialize.h +43 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/length_formatter.h +424 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/arccurve.h +244 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/arrow_type.h +17 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/attribute_dictionary.h +161 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/axes.h +242 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/camera.h +398 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classification_attribute.h +89 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classification_info.h +125 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classifications.h +86 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_definition.h +588 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_instance.h +344 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/curve.h +143 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/defs.h +142 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension.h +222 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_linear.h +421 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_radial.h +194 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_style.h +253 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/drawing_element.h +198 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dynamic_component_attribute.h +92 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dynamic_component_info.h +70 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/edge.h +271 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/edge_use.h +214 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entities.h +834 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity.h +186 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity_list.h +80 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity_list_iterator.h +90 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/face.h +686 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/font.h +138 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/geometry.h +20 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/geometry_input.h +685 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/group.h +244 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/guide_line.h +155 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/guide_point.h +153 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/image.h +288 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/image_rep.h +275 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/instancepath.h +266 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/layer.h +265 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/layer_folder.h +301 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/line_style.h +211 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/line_styles.h +81 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/location.h +65 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/loop.h +182 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/material.h +390 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/mesh_helper.h +187 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model.h +1663 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model_version.h +49 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/opening.h +72 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/options_manager.h +79 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/options_provider.h +166 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/polyline3d.h +140 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/rendering_options.h +179 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/scene.h +836 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/schema.h +56 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/schema_type.h +26 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/section_plane.h +212 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/selection.h +156 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/shadow_info.h +147 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/skp.h +45 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/style.h +303 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/styles.h +190 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/text.h +384 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/texture.h +358 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/texture_writer.h +280 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/typed_value.h +390 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/uv_helper.h +79 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/vertex.h +154 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/sketchup.h +122 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/sketchup_info.h +65 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/slapi.h +16 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/transformation.h +16 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/unicodestring.h +239 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/utils/math_helpers.h +124 -0
- 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 -0
- 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 +50 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/SketchUpAPI +0 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/_CodeSignature/CodeResources +835 -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/SketchUpAPI/application/application.h +36 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/application/model.h +59 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/application/overlay.h +248 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/application/ruby_api.h +118 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/color.h +107 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/common.h +178 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/defs.h +19 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/extension_license.h +62 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/bounding_box.h +34 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/plane3d.h +153 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/point2d.h +96 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/point3d.h +98 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/ray3d.h +64 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/transformation.h +321 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/transformation2d.h +163 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/vector2d.h +235 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/vector3d.h +285 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry.h +152 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/import_export/modelexporterplugin.h +165 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/import_export/modelimporterplugin.h +183 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/import_export/pluginprogresscallback.h +84 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/initialize.h +43 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/length_formatter.h +424 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/arccurve.h +244 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/arrow_type.h +17 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/attribute_dictionary.h +161 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/axes.h +242 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/camera.h +398 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/classification_attribute.h +89 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/classification_info.h +125 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/classifications.h +86 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/component_definition.h +588 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/component_instance.h +344 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/curve.h +143 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/defs.h +142 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension.h +222 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_linear.h +421 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_radial.h +194 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_style.h +253 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/drawing_element.h +198 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/dynamic_component_attribute.h +92 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/dynamic_component_info.h +70 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/edge.h +271 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/edge_use.h +214 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/entities.h +834 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/entity.h +186 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/entity_list.h +80 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/entity_list_iterator.h +90 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/face.h +686 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/font.h +138 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/geometry.h +20 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/geometry_input.h +685 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/group.h +244 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/guide_line.h +155 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/guide_point.h +153 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/image.h +288 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/image_rep.h +275 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/instancepath.h +266 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/layer.h +265 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/layer_folder.h +301 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/line_style.h +211 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/line_styles.h +81 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/location.h +65 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/loop.h +182 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/material.h +390 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/mesh_helper.h +187 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/model.h +1663 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/model_version.h +49 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/opening.h +72 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/options_manager.h +79 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/options_provider.h +166 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/polyline3d.h +140 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/rendering_options.h +179 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/scene.h +836 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/schema.h +56 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/schema_type.h +26 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/section_plane.h +212 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/selection.h +156 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/shadow_info.h +147 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/skp.h +45 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/style.h +303 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/styles.h +190 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/text.h +384 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/texture.h +358 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/texture_writer.h +280 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/typed_value.h +390 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/uv_helper.h +79 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/model/vertex.h +154 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/sketchup.h +122 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/sketchup_info.h +65 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/slapi.h +16 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/transformation.h +16 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/unicodestring.h +239 -0
- data/sketchup-sdk-win/headers/SketchUpAPI/utils/math_helpers.h +124 -0
- metadata +313 -0
@@ -0,0 +1,145 @@
|
|
1
|
+
#include <stdbool.h>
|
2
|
+
#include <definition_list.h>
|
3
|
+
#include <utils.h>
|
4
|
+
#include <SketchUpAPI/sketchup.h>
|
5
|
+
|
6
|
+
void Sketchup_ComponentDefinition_Iterator(SUComponentDefinitionRef definition, void* _)
|
7
|
+
{
|
8
|
+
rb_yield(Data_Wrap_Struct(rb_path2class(SKETCHUP_COMPONENTDEFINITION), 0, 0, definition.ptr));
|
9
|
+
}
|
10
|
+
|
11
|
+
void Sketchup_Group_Iterator(SUComponentDefinitionRef group, void* _)
|
12
|
+
{
|
13
|
+
rb_yield(Data_Wrap_Struct(rb_path2class(SKETCHUP_COMPONENTDEFINITION), 0, 0, group.ptr));
|
14
|
+
}
|
15
|
+
|
16
|
+
static VALUE Sketchup_DefinitionList_each(VALUE self)
|
17
|
+
{
|
18
|
+
SUModelRef model = {DATA_PTR(self)};
|
19
|
+
FOREACH(SUModelGetNumComponentDefinitions, SUModelGetComponentDefinitions, SUComponentDefinitionRef, model, Sketchup_ComponentDefinition_Iterator, 0);
|
20
|
+
FOREACH(SUModelGetNumGroupDefinitions, SUModelGetGroupDefinitions, SUComponentDefinitionRef, model, Sketchup_Group_Iterator, 0);
|
21
|
+
return self;
|
22
|
+
}
|
23
|
+
|
24
|
+
static VALUE Sketchup_DefinitionList_count(VALUE self)
|
25
|
+
{
|
26
|
+
SUModelRef model = {DATA_PTR(self)};
|
27
|
+
size_t cd_count = 0;
|
28
|
+
size_t gd_count = 0;
|
29
|
+
SUModelGetNumComponentDefinitions(model, &cd_count);
|
30
|
+
SUModelGetNumGroupDefinitions(model, &gd_count);
|
31
|
+
return INT2NUM(cd_count + gd_count);
|
32
|
+
}
|
33
|
+
|
34
|
+
static VALUE Sketchup_DefinitionList_load(VALUE self, VALUE path)
|
35
|
+
{
|
36
|
+
SUModelRef model = {DATA_PTR(self)};
|
37
|
+
SUComponentDefinitionRef definition = SU_INVALID;
|
38
|
+
enum SUModelLoadStatus status;
|
39
|
+
enum SUResult result = SUModelLoadDefinitionWithStatus(model, StringValuePtr(path), &definition, &status);
|
40
|
+
if (result != SU_ERROR_NONE)
|
41
|
+
rb_raise(rb_eStandardError, "Unsuccessful loading of the definition!");
|
42
|
+
return Data_Wrap_Struct(rb_path2class(SKETCHUP_COMPONENTDEFINITION), 0, 0, definition.ptr);
|
43
|
+
}
|
44
|
+
|
45
|
+
struct DefinitionStringIterationContext
|
46
|
+
{
|
47
|
+
VALUE key;
|
48
|
+
SUComponentDefinitionRef definition;
|
49
|
+
};
|
50
|
+
|
51
|
+
void Sketchup_DefinitionList_Get_By_String_Iterator(SUComponentDefinitionRef definition, struct DefinitionStringIterationContext* definition_struct)
|
52
|
+
{
|
53
|
+
VALUE definition_name;
|
54
|
+
VALUE definition_guid;
|
55
|
+
GETSTRING(SUComponentDefinitionGetName, definition, definition_name);
|
56
|
+
GETSTRING(SUComponentDefinitionGetGuid, definition, definition_guid);
|
57
|
+
if (strcmp(StringValuePtr(definition_name), StringValuePtr(definition_struct->key)) == 0 ||
|
58
|
+
strcmp(StringValuePtr(definition_guid), StringValuePtr(definition_struct->key)) == 0)
|
59
|
+
definition_struct->definition = definition;
|
60
|
+
}
|
61
|
+
|
62
|
+
struct DefinitionIndexIterationContext
|
63
|
+
{
|
64
|
+
int targetIndex;
|
65
|
+
int currentIndex;
|
66
|
+
SUComponentDefinitionRef definition;
|
67
|
+
};
|
68
|
+
|
69
|
+
void Sketchup_DefinitionList_Get_By_Index_Iterator(SUComponentDefinitionRef definition, struct DefinitionIndexIterationContext* definition_struct)
|
70
|
+
{
|
71
|
+
if (definition_struct->targetIndex == definition_struct->currentIndex)
|
72
|
+
definition_struct->definition = definition;
|
73
|
+
definition_struct->currentIndex += 1;
|
74
|
+
}
|
75
|
+
|
76
|
+
static VALUE Sketchup_DefinitionList_get(VALUE self, VALUE key)
|
77
|
+
{
|
78
|
+
SUModelRef model = {DATA_PTR(self)};
|
79
|
+
if (rb_type(key) == T_STRING)
|
80
|
+
{
|
81
|
+
struct DefinitionStringIterationContext definition_struct = {key, SU_INVALID};
|
82
|
+
FOREACH(
|
83
|
+
SUModelGetNumComponentDefinitions,
|
84
|
+
SUModelGetComponentDefinitions,
|
85
|
+
SUComponentDefinitionRef,
|
86
|
+
model,
|
87
|
+
Sketchup_DefinitionList_Get_By_String_Iterator,
|
88
|
+
&definition_struct);
|
89
|
+
if (SUIsInvalid(definition_struct.definition))
|
90
|
+
return Qnil;
|
91
|
+
return Data_Wrap_Struct(rb_path2class(SKETCHUP_COMPONENTDEFINITION), 0, 0, definition_struct.definition.ptr);
|
92
|
+
}
|
93
|
+
else
|
94
|
+
{
|
95
|
+
struct DefinitionIndexIterationContext definition_struct = {NUM2INT(key), 0, SU_INVALID};
|
96
|
+
FOREACH(
|
97
|
+
SUModelGetNumComponentDefinitions,
|
98
|
+
SUModelGetComponentDefinitions,
|
99
|
+
SUComponentDefinitionRef,
|
100
|
+
model,
|
101
|
+
Sketchup_DefinitionList_Get_By_Index_Iterator,
|
102
|
+
&definition_struct);
|
103
|
+
if (SUIsInvalid(definition_struct.definition))
|
104
|
+
{
|
105
|
+
if (definition_struct.targetIndex >= definition_struct.currentIndex)
|
106
|
+
rb_raise(rb_eIndexError, "index %d out of range [0, %d)", definition_struct.targetIndex, definition_struct.currentIndex);
|
107
|
+
}
|
108
|
+
return Data_Wrap_Struct(rb_path2class(SKETCHUP_COMPONENTDEFINITION), 0, 0, definition_struct.definition.ptr);
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
static VALUE Sketchup_DefinitionList_add(VALUE self, VALUE name)
|
113
|
+
{
|
114
|
+
SUModelRef model = {DATA_PTR(self)};
|
115
|
+
SUComponentDefinitionRef definition = SU_INVALID;
|
116
|
+
SUComponentDefinitionCreate(&definition);
|
117
|
+
SUComponentDefinitionSetName(definition, StringValuePtr(name));
|
118
|
+
SUModelAddComponentDefinitions(model, 1, &definition);
|
119
|
+
return Data_Wrap_Struct(rb_path2class(SKETCHUP_COMPONENTDEFINITION), 0, 0, definition.ptr);
|
120
|
+
}
|
121
|
+
|
122
|
+
static VALUE Sketchup_DefinitionList_remove(VALUE self, VALUE rb_definition)
|
123
|
+
{
|
124
|
+
if (!rb_obj_is_kind_of(rb_definition, rb_path2class(SKETCHUP_COMPONENTDEFINITION)))
|
125
|
+
rb_raise(rb_eTypeError, "Wrong type of object given");
|
126
|
+
SUModelRef model = {DATA_PTR(self)};
|
127
|
+
SUComponentDefinitionRef definition = {DATA_PTR(rb_definition)};
|
128
|
+
SUModelRemoveComponentDefinitions(model, 1, &definition);
|
129
|
+
return Qtrue;
|
130
|
+
}
|
131
|
+
|
132
|
+
VALUE DefinitionList_Init(VALUE Sketchup, VALUE Sketchup_Entity)
|
133
|
+
{
|
134
|
+
VALUE Sketchup_DefinitionList = rb_define_class_under(Sketchup, DEFINITIONLIST, Sketchup_Entity);
|
135
|
+
rb_include_module(Sketchup_DefinitionList, rb_mEnumerable);
|
136
|
+
rb_define_method(Sketchup_DefinitionList, "each", Sketchup_DefinitionList_each, 0);
|
137
|
+
rb_define_method(Sketchup_DefinitionList, "count", Sketchup_DefinitionList_count, 0);
|
138
|
+
rb_define_method(Sketchup_DefinitionList, "size", Sketchup_DefinitionList_count, 0);
|
139
|
+
rb_define_method(Sketchup_DefinitionList, "length", Sketchup_DefinitionList_count, 0);
|
140
|
+
rb_define_method(Sketchup_DefinitionList, "load", Sketchup_DefinitionList_load, 1);
|
141
|
+
rb_define_method(Sketchup_DefinitionList, "[]", Sketchup_DefinitionList_get, 1);
|
142
|
+
rb_define_method(Sketchup_DefinitionList, "add", Sketchup_DefinitionList_add, 1);
|
143
|
+
rb_define_method(Sketchup_DefinitionList, "remove", Sketchup_DefinitionList_remove, 1);
|
144
|
+
return Sketchup_DefinitionList;
|
145
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#include <stdbool.h>
|
2
|
+
#include <drawing_element.h>
|
3
|
+
#include <utils.h>
|
4
|
+
#include <SketchUpAPI/sketchup.h>
|
5
|
+
|
6
|
+
VALUE DrawingElement_Init(VALUE Sketchup, VALUE Sketchup_Entity)
|
7
|
+
{
|
8
|
+
VALUE Sketchup_DrawingElement = rb_define_class_under(Sketchup, DRAWINGELEMENT, Sketchup_Entity);
|
9
|
+
return Sketchup_DrawingElement;
|
10
|
+
}
|
data/ext/entities.c
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#include <stdbool.h>
|
2
|
+
#include <entities.h>
|
3
|
+
#include <SketchUpAPI/sketchup.h>
|
4
|
+
#include <utils.h>
|
5
|
+
|
6
|
+
|
7
|
+
VALUE Entities_Init(VALUE Sketchup, VALUE rb_cObject)
|
8
|
+
{
|
9
|
+
VALUE Sketchup_Entities = rb_define_class_under(Sketchup, ENTITIES, rb_cObject);
|
10
|
+
return Sketchup_Entities;
|
11
|
+
}
|
data/ext/entities.h
ADDED
data/ext/entity.c
ADDED
@@ -0,0 +1,253 @@
|
|
1
|
+
#include <stdbool.h>
|
2
|
+
#include <entity.h>
|
3
|
+
#include <SketchUpAPI/sketchup.h>
|
4
|
+
#include <utils.h>
|
5
|
+
|
6
|
+
static VALUE Sketchup_Entity_persistentId(VALUE self)
|
7
|
+
{
|
8
|
+
SUEntityRef entity = {DATA_PTR(self)};
|
9
|
+
int64_t presistent_id = 0;
|
10
|
+
SUEntityGetPersistentID(entity, &presistent_id);
|
11
|
+
return LONG2NUM(presistent_id);
|
12
|
+
}
|
13
|
+
|
14
|
+
static VALUE Sketchup_Entity_entityId(VALUE self)
|
15
|
+
{
|
16
|
+
SUEntityRef entity = {DATA_PTR(self)};
|
17
|
+
int32_t entityId = 0;
|
18
|
+
SUEntityGetID(entity, &entityId);
|
19
|
+
return LONG2NUM(entityId);
|
20
|
+
}
|
21
|
+
|
22
|
+
static VALUE Sketchup_Entity_typename(VALUE self)
|
23
|
+
{
|
24
|
+
SUEntityRef entity = {DATA_PTR(self)};
|
25
|
+
switch (SUEntityGetType(entity))
|
26
|
+
{
|
27
|
+
case SURefType_Unknown: return rb_str_new2("Unknown");
|
28
|
+
case SURefType_AttributeDictionary: return rb_str_new2("AttributeDictionary");
|
29
|
+
case SURefType_Camera: return rb_str_new2("Camera");
|
30
|
+
case SURefType_ComponentDefinition: return rb_str_new2("ComponentDefinition");
|
31
|
+
case SURefType_ComponentInstance: return rb_str_new2("ComponentInstance");
|
32
|
+
case SURefType_Curve: return rb_str_new2("Curve");
|
33
|
+
case SURefType_Edge: return rb_str_new2("Edge");
|
34
|
+
case SURefType_EdgeUse: return rb_str_new2("EdgeUse");
|
35
|
+
case SURefType_Entities: return rb_str_new2("Entities");
|
36
|
+
case SURefType_Face: return rb_str_new2("Face");
|
37
|
+
case SURefType_Group: return rb_str_new2("Group");
|
38
|
+
case SURefType_Image: return rb_str_new2("Image");
|
39
|
+
case SURefType_Layer: return rb_str_new2("Layer");
|
40
|
+
case SURefType_Location: return rb_str_new2("Location");
|
41
|
+
case SURefType_Loop: return rb_str_new2("Loop");
|
42
|
+
case SURefType_MeshHelper: return rb_str_new2("MeshHelper");
|
43
|
+
case SURefType_Material: return rb_str_new2("Material");
|
44
|
+
case SURefType_Model: return rb_str_new2("Model");
|
45
|
+
case SURefType_Polyline3D: return rb_str_new2("Polyline3D");
|
46
|
+
case SURefType_Scene: return rb_str_new2("Scene");
|
47
|
+
case SURefType_Texture: return rb_str_new2("Texture");
|
48
|
+
case SURefType_TextureWriter: return rb_str_new2("TextureWriter");
|
49
|
+
case SURefType_TypedValue: return rb_str_new2("TypedValue");
|
50
|
+
case SURefType_UVHelper: return rb_str_new2("UVHelper");
|
51
|
+
case SURefType_Vertex: return rb_str_new2("Vertex");
|
52
|
+
case SURefType_RenderingOptions: return rb_str_new2("RenderingOptions");
|
53
|
+
case SURefType_GuidePoint: return rb_str_new2("GuidePoint");
|
54
|
+
case SURefType_GuideLine: return rb_str_new2("GuideLine");
|
55
|
+
case SURefType_Schema: return rb_str_new2("Schema");
|
56
|
+
case SURefType_SchemaType: return rb_str_new2("SchemaType");
|
57
|
+
case SURefType_ShadowInfo: return rb_str_new2("ShadowInfo");
|
58
|
+
case SURefType_Axes: return rb_str_new2("Axes");
|
59
|
+
case SURefType_ArcCurve: return rb_str_new2("ArcCurve");
|
60
|
+
case SURefType_SectionPlane: return rb_str_new2("SectionPlane");
|
61
|
+
case SURefType_DynamicComponentInfo: return rb_str_new2("DynamicComponentInfo");
|
62
|
+
case SURefType_DynamicComponentAttribute: return rb_str_new2("DynamicComponentAttribute");
|
63
|
+
case SURefType_Style: return rb_str_new2("Style");
|
64
|
+
case SURefType_Styles: return rb_str_new2("Styles");
|
65
|
+
case SURefType_ImageRep: return rb_str_new2("ImageRep");
|
66
|
+
case SURefType_InstancePath: return rb_str_new2("InstancePath");
|
67
|
+
case SURefType_Font: return rb_str_new2("Font");
|
68
|
+
case SURefType_Dimension: return rb_str_new2("Dimension");
|
69
|
+
case SURefType_DimensionLinear: return rb_str_new2("DimensionLinear");
|
70
|
+
case SURefType_DimensionRadial: return rb_str_new2("DimensionRadial");
|
71
|
+
case SURefType_DimensionStyle: return rb_str_new2("DimensionStyle");
|
72
|
+
case SURefType_Text: return rb_str_new2("Text");
|
73
|
+
case SURefType_EntityList: return rb_str_new2("EntityList");
|
74
|
+
case SURefType_EntityListIterator: return rb_str_new2("EntityListIterator");
|
75
|
+
case SURefType_DrawingElement: return rb_str_new2("DrawingElement");
|
76
|
+
case SURefType_Entity: return rb_str_new2("Entity");
|
77
|
+
case SURefType_LengthFormatter: return rb_str_new2("LengthFormatter");
|
78
|
+
case SURefType_LineStyle: return rb_str_new2("LineStyle");
|
79
|
+
case SURefType_LineStyleManager: return rb_str_new2("LineStyleManager");
|
80
|
+
case SURefType_Selection: return rb_str_new2("Selection");
|
81
|
+
case SURefType_LayerFolder: return rb_str_new2("LayerFolder");
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
static VALUE Sketchup_Entity_parent(VALUE self)
|
86
|
+
{
|
87
|
+
SUEntityRef entity = {DATA_PTR(self)};
|
88
|
+
SUEntitiesRef entities = SU_INVALID;
|
89
|
+
SUEntityGetParentEntities(entity, &entities);
|
90
|
+
return Data_Wrap_Struct(rb_path2class(SKETCHUP_DEFINITIONLIST), 0, 0, entities.ptr);
|
91
|
+
}
|
92
|
+
|
93
|
+
static VALUE Sketchup_Entity_model(VALUE self)
|
94
|
+
{
|
95
|
+
SUEntityRef entity = {DATA_PTR(self)};
|
96
|
+
SUModelRef model = SU_INVALID;
|
97
|
+
SUEntityGetModel(entity, &model);
|
98
|
+
return Data_Wrap_Struct(rb_path2class(SKETCHUP_MODEL), 0, 0, model.ptr);
|
99
|
+
}
|
100
|
+
|
101
|
+
static VALUE Sketchup_Entity_remove_observer(VALUE self, VALUE observer)
|
102
|
+
{
|
103
|
+
#pragma clang diagnostic push
|
104
|
+
#pragma clang diagnostic ignored "-Wcompound-token-split-by-macro"
|
105
|
+
if (!RTEST(rb_ivar_defined(self, rb_intern("@observers"))))
|
106
|
+
#pragma clang diagnostic pop
|
107
|
+
return Qfalse;
|
108
|
+
|
109
|
+
VALUE result = rb_hash_delete(rb_iv_get(self, "@observers"), observer);
|
110
|
+
|
111
|
+
return RTEST(result) ? Qtrue : Qfalse;
|
112
|
+
}
|
113
|
+
|
114
|
+
static VALUE Sketchup_Entity_add_observer(VALUE self, VALUE observer)
|
115
|
+
{
|
116
|
+
VALUE observers = Qnil;
|
117
|
+
#pragma clang diagnostic push
|
118
|
+
#pragma clang diagnostic ignored "-Wcompound-token-split-by-macro"
|
119
|
+
if (RTEST(rb_ivar_defined(self, rb_intern("@observers"))))
|
120
|
+
#pragma clang diagnostic pop
|
121
|
+
{
|
122
|
+
observers = rb_iv_get(self, "@observers");
|
123
|
+
}
|
124
|
+
else
|
125
|
+
{
|
126
|
+
observers = rb_hash_new();
|
127
|
+
rb_iv_set(self, "@observers", rb_hash_new());
|
128
|
+
}
|
129
|
+
rb_hash_aset(self, observer, observer);
|
130
|
+
return Qtrue;
|
131
|
+
}
|
132
|
+
|
133
|
+
void Sketchup_Entity_attribute_dictionaries_Iterator(SUAttributeDictionaryRef dictionary, VALUE* ary)
|
134
|
+
{
|
135
|
+
rb_ary_push(*ary, Data_Wrap_Struct(rb_path2class(SKETCHUP_ATTRIBUTEDICTIONARY), 0, 0, dictionary.ptr));
|
136
|
+
}
|
137
|
+
|
138
|
+
static VALUE Sketchup_Entity_attribute_dictionaries(VALUE self)
|
139
|
+
{
|
140
|
+
SUEntityRef entity = {DATA_PTR(self)};
|
141
|
+
return Data_Wrap_Struct(rb_path2class(SKETCHUP_ATTRIBUTEDICTIONARIES), 0, 0, entity.ptr);
|
142
|
+
}
|
143
|
+
|
144
|
+
struct AttributeDictionaryIterationContext
|
145
|
+
{
|
146
|
+
VALUE key;
|
147
|
+
SUAttributeDictionaryRef dictionary;
|
148
|
+
};
|
149
|
+
|
150
|
+
|
151
|
+
void Sketchup_Entity_attribute_dictionary_Iterator(SUAttributeDictionaryRef dictionary, struct AttributeDictionaryIterationContext* attribute_dictionary_struct)
|
152
|
+
{
|
153
|
+
VALUE output;
|
154
|
+
GETSTRING(SUAttributeDictionaryGetName, dictionary, output);
|
155
|
+
if (strcmp(StringValuePtr(output), StringValuePtr(attribute_dictionary_struct->key)) == 0)
|
156
|
+
attribute_dictionary_struct->dictionary = dictionary;
|
157
|
+
}
|
158
|
+
|
159
|
+
static VALUE Sketchup_Entity_attribute_dictionary(int argc, VALUE* argv, VALUE self)
|
160
|
+
{
|
161
|
+
SUEntityRef entity = {DATA_PTR(self)};
|
162
|
+
struct AttributeDictionaryIterationContext attribute_dictionary_struct = {argv[0], SU_INVALID};
|
163
|
+
FOREACH(SUEntityGetNumAttributeDictionaries, SUEntityGetAttributeDictionaries, SUAttributeDictionaryRef, entity, Sketchup_Entity_attribute_dictionary_Iterator, &attribute_dictionary_struct);
|
164
|
+
if (SUIsInvalid(attribute_dictionary_struct.dictionary) && argc > 1 && argv[1])
|
165
|
+
{
|
166
|
+
SUAttributeDictionaryCreate(&attribute_dictionary_struct.dictionary, StringValuePtr(argv[0]));
|
167
|
+
SUEntityAddAttributeDictionary(entity, attribute_dictionary_struct.dictionary);
|
168
|
+
return Data_Wrap_Struct(rb_path2class(SKETCHUP_ATTRIBUTEDICTIONARY), 0, 0, attribute_dictionary_struct.dictionary.ptr);
|
169
|
+
}
|
170
|
+
else if(SUIsValid(attribute_dictionary_struct.dictionary))
|
171
|
+
return Data_Wrap_Struct(rb_path2class(SKETCHUP_ATTRIBUTEDICTIONARY), 0, 0, attribute_dictionary_struct.dictionary.ptr);
|
172
|
+
else
|
173
|
+
return Qnil;
|
174
|
+
}
|
175
|
+
|
176
|
+
static VALUE Sketchup_Entity_delete_attribute(int argc, VALUE* argv, VALUE self)
|
177
|
+
{
|
178
|
+
SUEntityRef entity = {DATA_PTR(self)};
|
179
|
+
if (argc == 0)
|
180
|
+
{
|
181
|
+
rb_raise(rb_eArgError, "Dictionary name required");
|
182
|
+
}
|
183
|
+
else if (argc == 1 && rb_type(argv[0]) == T_STRING)
|
184
|
+
{
|
185
|
+
if (strcmp(StringValuePtr(argv[0]), "SU_InstanceSet") == 0 || strcmp(StringValuePtr(argv[0]), "SU_DefinitionSet") == 0)
|
186
|
+
rb_raise(rb_eArgError, "Cannot delete internal");
|
187
|
+
|
188
|
+
struct AttributeDictionaryIterationContext attribute_dictionary_struct = {argv[0], SU_INVALID};
|
189
|
+
FOREACH(SUEntityGetNumAttributeDictionaries, SUEntityGetAttributeDictionaries, SUAttributeDictionaryRef, entity, Sketchup_Entity_attribute_dictionary_Iterator, &attribute_dictionary_struct);
|
190
|
+
if (SUIsValid(attribute_dictionary_struct.dictionary))
|
191
|
+
{
|
192
|
+
SUAttributeDictionaryRelease(&attribute_dictionary_struct.dictionary);
|
193
|
+
return Qtrue;
|
194
|
+
}
|
195
|
+
}
|
196
|
+
else if (argc > 1)
|
197
|
+
{
|
198
|
+
//ToDo use Sketchup_AttributeDictionary_delete_key
|
199
|
+
}
|
200
|
+
return Qfalse;
|
201
|
+
}
|
202
|
+
|
203
|
+
static VALUE Sketchup_Entity_deleted(VALUE self)
|
204
|
+
{
|
205
|
+
SUEntityRef entity = {DATA_PTR(self)};
|
206
|
+
return SUIsInvalid(entity) ? Qtrue : Qfalse;
|
207
|
+
}
|
208
|
+
|
209
|
+
static VALUE Sketchup_Entity_valid(VALUE self)
|
210
|
+
{
|
211
|
+
SUEntityRef entity = {DATA_PTR(self)};
|
212
|
+
return SUIsValid(entity) ? Qtrue : Qfalse;
|
213
|
+
}
|
214
|
+
|
215
|
+
static VALUE Sketchup_Entity_get_attribute(int argc, VALUE* argv, VALUE self)
|
216
|
+
{
|
217
|
+
SUEntityRef entity = {DATA_PTR(self)};
|
218
|
+
struct AttributeDictionaryIterationContext attribute_dictionary_struct = {argv[0], SU_INVALID};
|
219
|
+
FOREACH(SUEntityGetNumAttributeDictionaries, SUEntityGetAttributeDictionaries, SUAttributeDictionaryRef, entity, Sketchup_Entity_attribute_dictionary_Iterator, &attribute_dictionary_struct);
|
220
|
+
// use Sketchup_AttributeDictionary_get
|
221
|
+
return Qnil;
|
222
|
+
|
223
|
+
}
|
224
|
+
|
225
|
+
static VALUE Sketchup_Entity_set_attribute(int argc, VALUE* argv, VALUE self)
|
226
|
+
{
|
227
|
+
SUEntityRef entity = {DATA_PTR(self)};
|
228
|
+
struct AttributeDictionaryIterationContext attribute_dictionary_struct = {argv[0], SU_INVALID};
|
229
|
+
FOREACH(SUEntityGetNumAttributeDictionaries, SUEntityGetAttributeDictionaries, SUAttributeDictionaryRef, entity, Sketchup_Entity_attribute_dictionary_Iterator, &attribute_dictionary_struct);
|
230
|
+
// use Sketchup_AttributeDictionary_set
|
231
|
+
return Qnil;
|
232
|
+
|
233
|
+
}
|
234
|
+
|
235
|
+
VALUE Entity_Init(VALUE Sketchup, VALUE rb_cObject)
|
236
|
+
{
|
237
|
+
VALUE Sketchup_Entity = rb_define_class_under(Sketchup, ENTITY, rb_cObject);
|
238
|
+
rb_define_method(Sketchup_Entity, "persistent_id", Sketchup_Entity_persistentId, 0);
|
239
|
+
rb_define_method(Sketchup_Entity, "entityID", Sketchup_Entity_entityId, 0);
|
240
|
+
rb_define_method(Sketchup_Entity, "typename", Sketchup_Entity_typename, 0);
|
241
|
+
rb_define_method(Sketchup_Entity, "parent", Sketchup_Entity_parent, 0);
|
242
|
+
rb_define_method(Sketchup_Entity, "model", Sketchup_Entity_model, 0);
|
243
|
+
rb_define_method(Sketchup_Entity, "remove_observer", Sketchup_Entity_remove_observer, 1);
|
244
|
+
rb_define_method(Sketchup_Entity, "add_observer", Sketchup_Entity_add_observer, 1);
|
245
|
+
rb_define_method(Sketchup_Entity, "attribute_dictionaries", Sketchup_Entity_attribute_dictionaries, 0);
|
246
|
+
rb_define_method(Sketchup_Entity, "attribute_dictionary", Sketchup_Entity_attribute_dictionary, -1);
|
247
|
+
rb_define_method(Sketchup_Entity, "delete_attribute", Sketchup_Entity_delete_attribute, -1);
|
248
|
+
rb_define_method(Sketchup_Entity, "deleted?", Sketchup_Entity_deleted, 0);
|
249
|
+
rb_define_method(Sketchup_Entity, "valid?", Sketchup_Entity_valid, 0);
|
250
|
+
rb_define_method(Sketchup_Entity, "get_attribute", Sketchup_Entity_get_attribute, -1);
|
251
|
+
rb_define_method(Sketchup_Entity, "set_attribute", Sketchup_Entity_set_attribute, -1);
|
252
|
+
return Sketchup_Entity;
|
253
|
+
}
|
data/ext/entity.h
ADDED
data/ext/extconf.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'mkmf'
|
2
|
+
|
3
|
+
MAC = RUBY_PLATFORM =~ /darwin/
|
4
|
+
WIN = !MAC
|
5
|
+
|
6
|
+
extension_name = 'sketchup'
|
7
|
+
sdk_path = "#{__dir__}/../sketchup-sdk-#{MAC ? 'mac' : 'win'}"
|
8
|
+
|
9
|
+
# Work around for how framework headers are structured
|
10
|
+
if MAC && !File.exist?("#{sdk_path}/headers/SketchUpAPI")
|
11
|
+
FileUtils.mkdir_p("#{sdk_path}/headers")
|
12
|
+
FileUtils.symlink('../SketchUpAPI.framework/Headers', "#{sdk_path}/headers/SketchUpAPI")
|
13
|
+
end
|
14
|
+
|
15
|
+
# Work around for fact gems can't handle symlinks
|
16
|
+
if MAC
|
17
|
+
framework = "#{sdk_path}/SketchUpAPI.framework"
|
18
|
+
FileUtils.symlink('Versions/A/SketchUpAPI', "#{framework}/SketchUpAPI") unless File.exist?("#{framework}/SketchUpAPI")
|
19
|
+
FileUtils.symlink('Versions/A/Resources', "#{framework}/Resources") unless File.exist?("#{framework}/Resources")
|
20
|
+
FileUtils.symlink('Versions/A/Headers', "#{framework}/Headers") unless File.exist?("#{framework}/Headers")
|
21
|
+
FileUtils.symlink('A', "#{framework}/Versions/Current") unless File.exist?("#{framework}/Versions/Current")
|
22
|
+
end
|
23
|
+
|
24
|
+
# rubocop:disable Style/GlobalVars
|
25
|
+
$INCFLAGS << " -I#{sdk_path}/headers"
|
26
|
+
$CFLAGS << " #{'-Werror' if MAC } -O0 " if ENV['SCRIPTUP_DEVELOPMENT']
|
27
|
+
|
28
|
+
if MAC
|
29
|
+
$DLDFLAGS.gsub!('-Wl,-multiply_defined,suppress', '')
|
30
|
+
$DLDFLAGS << ' -Wl,-ld_classic'
|
31
|
+
$DLDFLAGS << " -F#{sdk_path} -framework SketchUpAPI"
|
32
|
+
$DLDFLAGS << " -Wl,-rpath,#{sdk_path}"
|
33
|
+
else
|
34
|
+
$DLDFLAGS << " -L#{sdk_path}/binaries/sketchup/x64 -lSketchUpAPI"
|
35
|
+
end
|
36
|
+
# rubocop:enable Style/GlobalVars
|
37
|
+
|
38
|
+
create_makefile(extension_name)
|