12 |
13 |
14 | #pragma pack(push, 8)
15 |
16 | #ifdef __cplusplus
17 | extern "C" {
18 | #endif // __cplusplus
19 |
20 | /**
21 | @struct SUPoint2D
22 | @brief Represents a point in 2-dimensional space.
23 | */
24 | struct SUPoint2D {
25 | double x; ///< X coordinate
26 | double y; ///< Y coordinate
27 | };
28 |
29 | /**
30 | @struct SUVector2D
31 | @brief Represents a vector in 2-dimensional space.
32 | */
33 | struct SUVector2D {
34 | double x; ///< X magnitude
35 | double y; ///< Y magnitude
36 | };
37 |
38 | /**
39 | @struct SUPoint3D
40 | @brief Represents a point in 3-dimensional space.
41 | */
42 | struct SUPoint3D {
43 | double x; ///< X coordinate
44 | double y; ///< Y coordinate
45 | double z; ///< Z coordinate
46 | };
47 |
48 | /**
49 | @struct SUVector3D
50 | @brief Represents a vector in 3-dimensional space.
51 | */
52 | struct SUVector3D {
53 | double x; ///< X magnitude
54 | double y; ///< Y magnitude
55 | double z; ///< Z magnitude
56 | };
57 |
58 | /**
59 | @struct SUPlane3D
60 | @brief Represents a 3D plane by the parameters a, b, c, d.
61 | For any point on the plane, ax + by + cz + d = 0.
62 | The coeficients are normalized so that a*a + b*b + c*c = 1.
63 | */
64 | struct SUPlane3D {
65 | double a; ///< The "a" factor in the plane equation.
66 | double b; ///< The "b" factor in the plane equation.
67 | double c; ///< The "c" factor in the plane equation.
68 | double d; ///< The "d" factor in the plane equation.
69 | };
70 |
71 | /**
72 | @struct SUBoundingBox3D
73 | @brief Represents a 3D axis-aligned bounding box represented by the extreme
74 | diagonal corner points with minimum and maximum x,y,z coordinates.
75 | */
76 | struct SUBoundingBox3D {
77 | struct SUPoint3D min_point; ///< A 3D point where x, y and z are minimum
78 | ///< values in the bounding box
79 | struct SUPoint3D max_point; ///< A 3D point where x, y and z are maximum
80 | ///< values in the bounding box
81 | };
82 |
83 | /**
84 | @struct SUAxisAlignedRect2D
85 | @brief Represents a 2D rectangle that is aligned with the X and Y axis of the
86 | coordinate system.
87 | */
88 | struct SUAxisAlignedRect2D {
89 | struct SUPoint2D upper_left; ///< Upper left corner of the bounding box.
90 | struct SUPoint2D lower_right; ///< Lower right corner of the bounding box.
91 | };
92 |
93 | /**
94 | @struct SURay3D
95 | @brief Represents a 3D ray defined by a point and normal vector.
96 | @since SketchUp 2018, API 6.0
97 | */
98 | struct SURay3D {
99 | struct SUPoint3D point; ///< Origin of the ray.
100 | struct SUVector3D normal; ///< Direction of the ray.
101 | };
102 |
103 | /**
104 | @struct SUTransformation
105 | @brief Represents a 3D (4x4) geometric transformation matrix.
106 |
107 | Matrix values are in column-major order.
108 | The transformation is stored as:
109 |
110 | @code{.txt}
111 | - -
112 | | R T |
113 | M = | 0 w |
114 | - -
115 | @endcode
116 |
117 | where:
118 |
119 | - M is a 4x4 matrix
120 |
- R is a 3x3 sub-matrix. It is the rotation part
121 |
- T is a 3x1 sub-matrix. It is the translation part
122 |
- w is a scalar. It is 1/scale.
123 |
124 | */
125 | struct SUTransformation {
126 | double values[16]; ///< Matrix values in column-major order.
127 | };
128 |
129 | /**
130 | @struct SUTransformation2D
131 | @brief Represents a 2D (2x3) affine transformation matrix. The matrix
132 | is stored in column-major format:
133 |
134 | m11 m21 tx
135 | m12 m22 ty
136 |
137 | */
138 | struct SUTransformation2D {
139 | double m11; ///< the m11 component
140 | double m12; ///< the m12 component
141 | double m21; ///< the m21 component
142 | double m22; ///< the m22 component
143 | double tx; ///< the tx component
144 | double ty; ///< the ty component
145 | };
146 |
147 | #ifdef __cplusplus
148 | } // end extern "C"
149 | #endif // __cplusplus
150 |
151 | #pragma pack(pop)
152 |
153 | #endif // SKETCHUP_GEOMETRY_H_
154 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/geometry/bounding_box.h:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Trimble Inc., All rights reserved.
2 |
3 | /**
4 | * @file
5 | * @brief Interfaces for SUBoundingBox3D.
6 | */
7 | #ifndef SKETCHUP_GEOMETRY_BOUNDING_BOX_H_
8 | #define SKETCHUP_GEOMETRY_BOUNDING_BOX_H_
9 |
10 | #include
11 |
12 | #ifdef __cplusplus
13 | extern "C" {
14 | #endif // __cplusplus
15 |
16 | /**
17 | @brief Gets the mid point from the given bounding box.
18 | @since SketchUp 2018 M0, API 6.0
19 | @param[in] bounding_box The bounding box to calculate the mid point from.
20 | @param[out] mid_point The mid point to be returned.
21 | @related SUBoundingBox3D
22 | @return
23 | - \ref SU_ERROR_NONE on success
24 | - \ref SU_ERROR_NULL_POINTER_INPUT if bounding_box is NULL
25 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if mid_point NULL
26 | */
27 | SU_RESULT SUBoundingBox3DGetMidPoint(const struct SUBoundingBox3D* bounding_box,
28 | struct SUPoint3D* mid_point);
29 |
30 | #ifdef __cplusplus
31 | } // end extern "C"
32 | #endif // __cplusplus
33 |
34 | #endif // SKETCHUP_GEOMETRY_BOUNDING_BOX_H_
35 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/geometry/point2d.h:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Trimble Inc. All Rights Reserved.
2 |
3 | /**
4 | * @file
5 | * @brief Interfaces for SUPoint2D.
6 | */
7 | #ifndef SKETCHUP_GEOMETRY_POINT2D_H_
8 | #define SKETCHUP_GEOMETRY_POINT2D_H_
9 |
10 |
11 | #include
12 | #include
13 |
14 | #ifdef __cplusplus
15 | extern "C" {
16 | #endif
17 |
18 | /**
19 | @brief Creates a vector between two point objects.
20 | @since SketchUp 2017, API 5.0
21 | @deprecated The functionality is replaced by SUVector2DCreate.
22 | @param[in] point1 The first point object.
23 | @param[in] point2 The second point object.
24 | @param[out] vector The vector from point1 to point2.
25 | @related SUPoint2D
26 | @return
27 | - \ref SU_ERROR_NONE on success
28 | - \ref SU_ERROR_NULL_POINTER_INPUT if point1 or point2 is NULL
29 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if vector is NULL
30 | */
31 | SU_DEPRECATED_FUNCTION("6.0")
32 | SU_RESULT SUPoint2DToSUPoint2D(const struct SUPoint2D* point1,
33 | const struct SUPoint2D* point2,
34 | struct SUVector2D* vector);
35 |
36 | /**
37 | @brief Determines if two points are equal.
38 | @since SketchUp 2017, API 5.0
39 | @param[in] point1 The first point object.
40 | @param[in] point2 The second point object.
41 | @param[out] equal Whether the two points are the same.
42 | @related SUPoint2D
43 | @return
44 | - \ref SU_ERROR_NONE on success
45 | - \ref SU_ERROR_NULL_POINTER_INPUT if point1 or point2 is NULL
46 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if equal is NULL
47 | */
48 | SU_RESULT SUPoint2DGetEqual(const struct SUPoint2D* point1,
49 | const struct SUPoint2D* point2,
50 | bool* equal);
51 |
52 | /**
53 | @brief Creates a new point that is offset from another point.
54 | @since SketchUp 2017, API 5.0
55 | @param[in] point1 The point object.
56 | @param[in] vector The offset vector object.
57 | @param[out] point2 The new point.
58 | @related SUPoint2D
59 | @return
60 | - \ref SU_ERROR_NONE on success
61 | - \ref SU_ERROR_NULL_POINTER_INPUT if point1 or vector is NULL
62 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if point2 is NULL
63 | */
64 | SU_RESULT SUPoint2DOffset(const struct SUPoint2D* point1,
65 | const struct SUVector2D* vector,
66 | struct SUPoint2D* point2);
67 |
68 | /**
69 | @brief Gets the distance between two point objects.
70 | @since SketchUp 2017, API 5.0
71 | @param[in] point1 The first point object.
72 | @param[in] point2 The second point object.
73 | @param[out] distance The distance between the two points.
74 | @related SUPoint2D
75 | @return
76 | - \ref SU_ERROR_NONE on success
77 | - \ref SU_ERROR_NULL_POINTER_INPUT if point1 or point2 is NULL
78 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if distance is NULL
79 | */
80 | SU_RESULT SUPoint2DDistanceToSUPoint2D(const struct SUPoint2D* point1,
81 | const struct SUPoint2D* point2,
82 | double* distance);
83 |
84 | /**
85 | @brief Transforms a point by applying a 2D transformation.
86 | @since SketchUp 2019, API 7.0
87 | @param[in] transform The transformation to be applied.
88 | @param[in,out] point The point to be transformed.
89 | @related SUPoint2D
90 | @return
91 | - \ref SU_ERROR_NONE on success
92 | - \ref SU_ERROR_NULL_POINTER_INPUT if transform is NULL
93 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
94 | */
95 | SU_RESULT SUPoint2DTransform(const struct SUTransformation2D* transform,
96 | struct SUPoint2D* point);
97 |
98 | #ifdef __cplusplus
99 | } // extern "C"
100 | #endif
101 |
102 | #endif // SKETCHUP_GEOMETRY_POINT2D_H_
103 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/geometry/point3d.h:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Trimble Inc. All Rights Reserved.
2 |
3 | /**
4 | * @file
5 | * @brief Interfaces for SUPoint3D.
6 | */
7 | #ifndef SKETCHUP_GEOMETRY_POINT3D_H_
8 | #define SKETCHUP_GEOMETRY_POINT3D_H_
9 |
10 |
11 | #include
12 | #include
13 |
14 | // Forward declarations
15 | struct SUTransformation;
16 |
17 | #ifdef __cplusplus
18 | extern "C" {
19 | #endif
20 |
21 | /**
22 | @brief Determines if two points are equal.
23 | @since SketchUp 2018 M0, API 6.0
24 | @param[in] point1 The first point object.
25 | @param[in] point2 The second point object.
26 | @param[out] equal Whether the two points are the same.
27 | @related SUPoint3D
28 | @return
29 | - \ref SU_ERROR_NONE on success
30 | - \ref SU_ERROR_NULL_POINTER_INPUT if point1 or point2 is NULL
31 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if equal is NULL
32 | */
33 | SU_RESULT SUPoint3DGetEqual(const struct SUPoint3D* point1,
34 | const struct SUPoint3D* point2,
35 | bool* equal);
36 |
37 | /**
38 | @brief Determines if point1 is less than point2.
39 | @since SketchUp 2018 M0, API 6.0
40 | @param[in] point1 The first point object.
41 | @param[in] point2 The second point object.
42 | @param[out] less_than Whether point1 is less than point2.
43 | @related SUPoint3D
44 | @return
45 | - \ref SU_ERROR_NONE on success
46 | - \ref SU_ERROR_NULL_POINTER_INPUT if point1 or point2 is NULL
47 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if less_than is NULL
48 | */
49 | SU_RESULT SUPoint3DLessThan(const struct SUPoint3D* point1,
50 | const struct SUPoint3D* point2,
51 | bool* less_than);
52 |
53 | /**
54 | @brief Creates a new point that is offset from another point.
55 | @since SketchUp 2018 M0, API 6.0
56 | @param[in] point1 The point object.
57 | @param[in] vector The offset vector object.
58 | @param[out] point2 The new point.
59 | @related SUPoint3D
60 | @return
61 | - \ref SU_ERROR_NONE on success
62 | - \ref SU_ERROR_NULL_POINTER_INPUT if point1 or vector is NULL
63 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if point2 is NULL
64 | */
65 | SU_RESULT SUPoint3DOffset(const struct SUPoint3D* point1,
66 | const struct SUVector3D* vector,
67 | struct SUPoint3D* point2);
68 |
69 | /**
70 | @brief Gets the distance between two point objects.
71 | @since SketchUp 2018 M0, API 6.0
72 | @param[in] point1 The first point object.
73 | @param[in] point2 The second point object.
74 | @param[out] distance The distance between the two points.
75 | @related SUPoint3D
76 | @return
77 | - \ref SU_ERROR_NONE on success
78 | - \ref SU_ERROR_NULL_POINTER_INPUT if point1 or point2 is NULL
79 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if distance is NULL
80 | */
81 | SU_RESULT SUPoint3DDistanceToSUPoint3D(const struct SUPoint3D* point1,
82 | const struct SUPoint3D* point2,
83 | double* distance);
84 |
85 | /**
86 | @brief Transforms the provided 3D point by applying the provided 3D
87 | transformation.
88 | @since SketchUp 2016, API 4.0
89 | @param[in] transform The transformation to be applied.
90 | @param[in,out] point The point to be transformed.
91 | @related SUPoint3D
92 | @return
93 | - \ref SU_ERROR_NONE on success
94 | - \ref SU_ERROR_NULL_POINTER_INPUT if transform is NULL
95 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
96 | */
97 | SU_RESULT SUPoint3DTransform(const struct SUTransformation* transform,
98 | struct SUPoint3D* point);
99 |
100 | #ifdef __cplusplus
101 | } // extern "C"
102 | #endif
103 |
104 | #endif // SKETCHUP_GEOMETRY_POINT3D_H_
105 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/geometry/ray3d.h:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Trimble Inc., All rights reserved.
2 |
3 | /**
4 | * @file
5 | * @brief Interfaces for SURay3D.
6 | */
7 | #ifndef SKETCHUP_GEOMETRY_RAY3D_H_
8 | #define SKETCHUP_GEOMETRY_RAY3D_H_
9 |
10 | #include
11 |
12 | #ifdef __cplusplus
13 | extern "C" {
14 | #endif // __cplusplus
15 |
16 | /**
17 | @brief Gets whether or not the point is on the ray.
18 | @since SketchUp 2018, API 6.0
19 | @param[in] ray The ray.
20 | @param[in] point The 3D point.
21 | @param[out] is_on Whether or not the point is on the ray.
22 | @related SURay3D
23 | @return
24 | - \ref SU_ERROR_NONE on success
25 | - \ref SU_ERROR_NULL_POINTER_INPUT if ray or point are NULL
26 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if is_on is NULL
27 | */
28 | SU_RESULT SURay3DIsOn(const struct SURay3D* ray,
29 | const struct SUPoint3D* point,
30 | bool* is_on);
31 |
32 | /**
33 | @brief Gets the distance from the point to the ray.
34 | @since SketchUp 2018, API 6.0
35 | @param[in] ray The ray.
36 | @param[in] point The 3D point.
37 | @param[out] distance The distance between the ray and point.
38 | @related SURay3D
39 | @return
40 | - \ref SU_ERROR_NONE on success
41 | - \ref SU_ERROR_NULL_POINTER_INPUT if ray or point are NULL
42 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if distance is NULL
43 | */
44 | SU_RESULT SURay3DDistanceTo(const struct SURay3D* ray,
45 | const struct SUPoint3D* point,
46 | double* distance);
47 |
48 | /**
49 | @brief Projects a point onto the ray.
50 | @since SketchUp 2018, API 6.0
51 | @param[in] ray The ray.
52 | @param[in] point The 3D point to project onto the ray.
53 | @param[out] projected_point The point resulting from the projection.
54 | @related SURay3D
55 | @return
56 | - \ref SU_ERROR_NONE on success
57 | - \ref SU_ERROR_NULL_POINTER_INPUT if ray or point are NULL
58 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if projected_point is NULL
59 | */
60 | SU_RESULT SURay3DProjectTo(const struct SURay3D* ray,
61 | const struct SUPoint3D* point,
62 | struct SUPoint3D* projected_point);
63 |
64 | #ifdef __cplusplus
65 | } // end extern "C"
66 | #endif // __cplusplus
67 |
68 | #endif // SKETCHUP_GEOMETRY_RAY3D_H_
69 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/import_export/pluginprogresscallback.h:
--------------------------------------------------------------------------------
1 | // Copyright 2013-2020 Trimble Inc. All Rights Reserved.
2 |
3 | /**
4 | * @file
5 | * @brief Interfaces for import/export progress feedback and cancellation.
6 | */
7 | #ifndef SKETCHUPPLUGINPROGRESSCALLBACK_H_
8 | #define SKETCHUPPLUGINPROGRESSCALLBACK_H_
9 |
10 | #include
11 |
12 | /**
13 | @struct SketchUpPluginProgressCallback
14 | @brief Interface to provide import/export progress feedback and cancellation.
15 |
16 | All well behaved SketchUp importer/exporter plugins should support progress
17 | feedback and cancellation through this interface. SketchUp will pop up a
18 | progress/cancel dialog prior to calling the appropriate Convert method on the
19 | importer/exporter plugin and supply a concrete implementation of this interface.
20 | The plugin should supply feedback to the user by estimating how far along the
21 | conversion is (via SetPercentDone or SetStepSize and Step), provide some textual
22 | progress (via SetProgressMessage) and test for cancellation by calling
23 | HasBeenCancelled.
24 |
25 | For example, the main loop of an importer plugin may look like this:
26 |
27 | \code{.cpp}
28 | progress_callback->SetProgressMessage("Importing 50 things!");
29 | progress_callback->SetStepSize(1.0);
30 | for (int steps = 0; steps < 50; ++steps) {
31 | progress_callback->Step();
32 | // Do something which builds an skp model
33 | if (progress_callback->HasBeenCancelled()) {
34 | // Clean up and return
35 | return false;
36 | }
37 | }
38 | progress_callback->SetProgressMessage("We're half way there!");
39 | // Do some more larger steps
40 | progress_callback->SetPercentDone(75.0);
41 | progress_callback->SetProgressMessage("Finishing up!");
42 | // And some more
43 | progress_callback->SetPercentDone(100.0);
44 | // Success!
45 | return true;
46 | \endcode
47 |
48 | */
49 | class SketchUpPluginProgressCallback {
50 | public:
51 | /**
52 | @brief Call this to test if the user has pressed the cancel button. Your
53 | code should clean up and return promptly after detecting this.
54 | @return Returns true if the user has pressed cancel.
55 | */
56 | virtual bool HasBeenCancelled() = 0;
57 |
58 | /**
59 | @brief Call this to set the percent complete on the dialog.
60 | @param[in] percent The percent done from 0 to 100.
61 | */
62 | virtual void SetPercentDone(double percent) = 0;
63 |
64 | /**
65 | @brief You may also set a step size and increment it using the Step method.
66 | @param[in] percent The percent to increment with each call to Step.
67 | */
68 | virtual void SetStepSize(double percent) = 0;
69 |
70 | /**
71 | @brief Increments the progress dialog by the step size set using
72 | SetStepSize.
73 | */
74 | virtual void Step() = 0;
75 |
76 | /**
77 | @brief Supplies a UTF-8 message which will be presented on the progress
78 | dialog.
79 | @param utf8_message The message.
80 | */
81 | virtual void SetProgressMessage(const std::string& utf8_message) = 0;
82 | };
83 |
84 | #endif // SKETCHUPPLUGINPROGRESSCALLBACK_H_
85 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/initialize.h:
--------------------------------------------------------------------------------
1 | // Copyright 2013-2020 Trimble Inc. All Rights Reserved
2 |
3 | /**
4 | * @file
5 | * @brief Functionality for the API interface itself.
6 | */
7 | #ifndef SKETCHUP_INITIALIZE_H_
8 | #define SKETCHUP_INITIALIZE_H_
9 |
10 | #include
11 |
12 | #ifdef __cplusplus
13 | extern "C" {
14 | #endif
15 |
16 | /**
17 | @brief Initializes the slapi interface. Must be called before calling any other
18 | API function.
19 | @attention This function should not be used from the Live API.
20 | */
21 | SU_EXPORT void SUInitialize();
22 |
23 | /**
24 | @brief Signals termination of use of the slapi interface. Must be called when
25 | done using API functions.
26 | @attention This function should not be used from the Live API.
27 | */
28 | SU_EXPORT void SUTerminate();
29 |
30 | /**
31 | @brief Returns the major and minor API version numbers.
32 | @param[out] major The major version number retrieved.
33 | @param[out] minor The minor version number retrieved.
34 | @note This function hasn't reliably reported the correct versions prior to
35 | version 8.2 of the SDK.
36 | */
37 | SU_EXPORT void SUGetAPIVersion(size_t* major, size_t* minor);
38 |
39 | #ifdef __cplusplus
40 | } // extern "C" {
41 | #endif
42 |
43 | #endif // SKETCHUP_INITIALIZE_H_
44 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/arrow_type.h:
--------------------------------------------------------------------------------
1 | // Copyright 2016-2020 Trimble Inc. All Rights Reserved.
2 |
3 | /**
4 | * @file
5 | * @brief Interfaces for \ref SUArrowType.
6 | */
7 | #ifndef SKETCHUP_MODEL_ARROW_TYPE_H_
8 | #define SKETCHUP_MODEL_ARROW_TYPE_H_
9 |
10 | /**
11 | @enum SUArrowType
12 | @brief Indicates the supported arrow types, currently used by SUDimensionRef
13 | and SUTextRef.
14 | */
15 | enum SUArrowType {
16 | SUArrowNone = 0,
17 | SUArrowSlash,
18 | SUArrowDot,
19 | SUArrowClosed,
20 | SUArrowOpen
21 | };
22 |
23 |
24 | #endif // SKETCHUP_MODEL_ARROW_TYPE_H_
25 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/classification_attribute.h:
--------------------------------------------------------------------------------
1 | // Copyright 2016-2020 Trimble Inc. All Rights Reserved
2 |
3 | /**
4 | * @file
5 | * @brief Interfaces for SUClassificationAttributeRef.
6 | */
7 | #ifndef SKETCHUP_MODEL_CLASSIFICATION_ATTRIBUTE_H_
8 | #define SKETCHUP_MODEL_CLASSIFICATION_ATTRIBUTE_H_
9 |
10 | #include
11 | #include
12 | #include
13 |
14 | #ifdef __cplusplus
15 | extern "C" {
16 | #endif
17 |
18 | /**
19 | @struct SUClassificationAttributeRef
20 | @brief References attribute data about a classified component.
21 | */
22 |
23 | /**
24 | @brief Retrieves the value of the attribute.
25 | @since SketchUp 2017, API 5.0
26 | @param[in] attribute The classification attribute object.
27 | @param[out] value The value of the attribute.
28 | @related SUClassificationAttributeRef
29 | @return
30 | - \ref SU_ERROR_NONE on success
31 | - \ref SU_ERROR_INVALID_INPUT if attribute is not a valid object
32 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if value is NULL
33 | - \ref SU_ERROR_INVALID_OUTPUT if value does not point to a valid \ref
34 | SUTypedValueRef object
35 | */
36 | SU_RESULT SUClassificationAttributeGetValue(
37 | SUClassificationAttributeRef attribute,
38 | SUTypedValueRef* value);
39 |
40 | /**
41 | @brief Retrieves the path to the attribute.
42 | @since SketchUp 2017, API 5.0
43 | @param[in] attribute The classification attribute object.
44 | @param[out] path The attribute name as it should be displayed to the
45 | user.
46 | @related SUClassificationAttributeRef
47 | @return
48 | - \ref SU_ERROR_NONE on success
49 | - \ref SU_ERROR_INVALID_INPUT if attribute is not a valid object
50 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if path is NULL
51 | - \ref SU_ERROR_INVALID_OUTPUT if path does not point to a valid \ref
52 | SUStringRef object
53 | */
54 | SU_RESULT SUClassificationAttributeGetPath(
55 | SUClassificationAttributeRef attribute,
56 | SUStringRef* path);
57 |
58 | /**
59 | @brief Retrieves the number of children setting of the attribute.
60 | @since SketchUp 2017, API 5.0
61 | @param[in] attribute The classification attribute object.
62 | @param[out] count The number of children this attribute contains.
63 | @related SUClassificationAttributeRef
64 | @return
65 | - \ref SU_ERROR_NONE on success
66 | - \ref SU_ERROR_INVALID_INPUT if attribute is not a valid object
67 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if count is NULL
68 | */
69 | SU_RESULT SUClassificationAttributeGetNumChildren(
70 | SUClassificationAttributeRef attribute,
71 | size_t* count);
72 |
73 | /**
74 | @brief Retrieves the child attribute at the given index.
75 | @since SketchUp 2017, API 5.0
76 | @param[in] attribute The classification attribute object.
77 | @param[in] index The index of the child attribute to get.
78 | @param[out] child The child attribute retrieved.
79 | @related SUClassificationAttributeRef
80 | @return
81 | - \ref SU_ERROR_NONE on success
82 | - \ref SU_ERROR_INVALID_INPUT if attribute is not a valid object
83 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if child is NULL
84 | */
85 | SU_RESULT SUClassificationAttributeGetChild(
86 | SUClassificationAttributeRef attribute,
87 | size_t index,
88 | SUClassificationAttributeRef* child);
89 |
90 | #ifdef __cplusplus
91 | } // extern "C" {
92 | #endif
93 |
94 | #endif // SKETCHUP_MODEL_CLASSIFICATION_ATTRIBUTE_H_
95 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/classification_info.h:
--------------------------------------------------------------------------------
1 | // Copyright 2016-2020 Trimble Inc. All Rights Reserved
2 |
3 | /**
4 | * @file
5 | * @brief Interfaces for SUClassificationInfoRef.
6 | */
7 | #ifndef SKETCHUP_MODEL_CLASSIFICATION_INFO_H_
8 | #define SKETCHUP_MODEL_CLASSIFICATION_INFO_H_
9 |
10 | #include
11 | #include
12 | #include
13 |
14 | #ifdef __cplusplus
15 | extern "C" {
16 | #endif
17 |
18 | /**
19 | @struct SUClassificationInfoRef
20 | @brief References an object with classification information. Each
21 | SUClassificationInfoRef contains the names of the schemas and the schema
22 | types, and the types attributes. See SUClassificationAttributeRef for
23 | details on the type attributes.
24 | */
25 |
26 | /**
27 | @brief Releases the classification info. Classification info objects are created
28 | from component instance using
29 | SUComponentInstanceCreateClassificationInfo(), and must be released using
30 | this function. This function also invalidates the given
31 | SUClassificationInfoRef.
32 | @since SketchUp 2017, API 5.0
33 | @param[in,out] classification_info The classification info object.
34 | @related SUClassificationInfoRef
35 | @return
36 | - \ref SU_ERROR_NONE on success
37 | - \ref SU_ERROR_NULL_POINTER_INPUT if classification_info is NULL
38 | - \ref SU_ERROR_INVALID_INPUT if classification_info is not a valid object
39 | */
40 | SU_RESULT SUClassificationInfoRelease(
41 | SUClassificationInfoRef* classification_info);
42 |
43 | /**
44 | @brief Retrieves the number of schemas that have been applied to the
45 | component instance.
46 | @since SketchUp 2017, API 5.0
47 | @param[in] classification_info The classification info object.
48 | @param[out] count The number of classifications.
49 | @related SUClassificationInfoRef
50 | @return
51 | - \ref SU_ERROR_NONE on success
52 | - \ref SU_ERROR_INVALID_INPUT if classification_info is not a valid object
53 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if count is NULL
54 | */
55 | SU_RESULT SUClassificationInfoGetNumSchemas(
56 | SUClassificationInfoRef classification_info,
57 | size_t* count);
58 |
59 | /**
60 | @brief Retrieves the schema name for the classification at the given index.
61 | @param[in] classification_info The classification info object.
62 | @param[in] index The classification index.
63 | @param[out] schema_name The name of the schema.
64 | @related SUClassificationInfoRef
65 | @return
66 | - \ref SU_ERROR_NONE on success
67 | - \ref SU_ERROR_INVALID_INPUT if classification_info is an invalid object
68 | - \ref SU_ERROR_OUT_OF_RANGE if index is larger than the number of schemas
69 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if schema_name is NULL
70 | - \ref SU_ERROR_INVALID_OUTPUT if *schema_name is not a valid object
71 | */
72 | SU_RESULT SUClassificationInfoGetSchemaName(
73 | SUClassificationInfoRef classification_info,
74 | size_t index,
75 | SUStringRef* schema_name);
76 |
77 | /**
78 | @brief Retrieves the schema type for the classification at the given index.
79 | @param[in] classification_info The classification info object.
80 | @param[in] index The classification index.
81 | @param[out] schema_type The applied type from the schema.
82 | @related SUClassificationInfoRef
83 | @return
84 | - \ref SU_ERROR_NONE on success
85 | - \ref SU_ERROR_INVALID_INPUT if classification_info is an invalid object
86 | - \ref SU_ERROR_OUT_OF_RANGE if index is larger than the number of schemas
87 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if schema_type is NULL
88 | - \ref SU_ERROR_INVALID_OUTPUT if *schema_type is not a valid object
89 | */
90 | SU_RESULT SUClassificationInfoGetSchemaType(
91 | SUClassificationInfoRef classification_info,
92 | size_t index,
93 | SUStringRef* schema_type);
94 |
95 | /**
96 | @brief Retrieves the classification attribute for the classification at the
97 | given index.
98 | @param[in] classification_info The classification info object.
99 | @param[in] index The classification index.
100 | @param[out] attribute The attribute retrieved.
101 | @related SUClassificationInfoRef
102 | @return
103 | - \ref SU_ERROR_NONE on success
104 | - \ref SU_ERROR_INVALID_INPUT if classification_info is an invalid object
105 | - \ref SU_ERROR_OUT_OF_RANGE if index is larger than the number of schemas
106 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if attribute is NULL
107 | */
108 | SU_RESULT SUClassificationInfoGetSchemaAttribute(
109 | SUClassificationInfoRef classification_info,
110 | size_t index,
111 | SUClassificationAttributeRef* attribute);
112 |
113 | /**
114 | @brief Retrieves the classification attribute with the given path.
115 | @param[in] classification_info The classification info object.
116 | @param[in] path The path of the classification attribute to get.
117 | @param[out] attribute The attribute retrieved.
118 | @related SUClassificationInfoRef
119 | @return
120 | - \ref SU_ERROR_NONE on success
121 | - \ref SU_ERROR_INVALID_INPUT if classification_info is an invalid object
122 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if attribute is NULL
123 | */
124 | SU_RESULT SUClassificationInfoGetSchemaAttributeByPath(
125 | SUClassificationInfoRef classification_info,
126 | SUStringRef path,
127 | SUClassificationAttributeRef* attribute);
128 |
129 | #ifdef __cplusplus
130 | } // extern "C" {
131 | #endif
132 |
133 | #endif // SKETCHUP_MODEL_CLASSIFICATION_INFO_H_
134 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/classifications.h:
--------------------------------------------------------------------------------
1 | // Copyright 2014-2020 Trimble Inc. All Rights Reserved.
2 |
3 | /**
4 | * @file
5 | * @brief Interfaces for SUClassificationsRef.
6 | */
7 | #ifndef SKETCHUP_MODEL_CLASSIFICATIONS_H_
8 | #define SKETCHUP_MODEL_CLASSIFICATIONS_H_
9 |
10 | #include
11 | #include
12 |
13 | #ifdef __cplusplus
14 | extern "C" {
15 | #endif
16 |
17 | /**
18 | @struct SUClassificationsRef
19 | @brief Used to manage a Classifications object
20 | */
21 |
22 | /**
23 | @brief Loads a schema into a classification object.
24 | @param[in] classifications The classification object.
25 | @param[in] schema_file_name The full path of the schema to load.
26 | @related SUClassificationsRef
27 | @return
28 | - \ref SU_ERROR_NONE on success
29 | - \ref SU_ERROR_INVALID_INPUT if classifications is not a valid object
30 | - \ref SU_ERROR_INVALID_INPUT if schema_file_name is not a valid path to a schema
31 | or is NULL
32 | */
33 | SU_RESULT SUClassificationsLoadSchema(SUClassificationsRef classifications,
34 | const char* schema_file_name);
35 |
36 | /**
37 | @brief Gets a schema from a classification object.
38 | @param[in] classifications The classification object.
39 | @param[in] schema_name The name of the schema to get.
40 | @param[out] schema_ref The schema retrieved.
41 | @related SUClassificationsRef
42 | @return
43 | - \ref SU_ERROR_NONE on success
44 | - \ref SU_ERROR_INVALID_INPUT if classifications is not a valid object
45 | - \ref SU_ERROR_NULL_POINTER_INPUT if schema_name is NULL
46 | - \ref SU_ERROR_INVALID_INPUT if schema_name is not a loaded schema
47 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if schema_ref is NULL
48 | */
49 | SU_RESULT SUClassificationsGetSchema(SUClassificationsRef classifications,
50 | const char* schema_name,
51 | SUSchemaRef* schema_ref);
52 |
53 | #ifdef __cplusplus
54 | }
55 | #endif
56 |
57 | #endif // SKETCHUP_MODEL_CLASSIFICATIONS_H_
58 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/curve.h:
--------------------------------------------------------------------------------
1 | // Copyright 2013 Trimble Inc. All Rights Reserved.
2 |
3 | /**
4 | * @file
5 | * @brief Interfaces for SUCurveRef.
6 | */
7 | #ifndef SKETCHUP_MODEL_CURVE_H_
8 | #define SKETCHUP_MODEL_CURVE_H_
9 |
10 | #include
11 | #include
12 |
13 | #ifdef __cplusplus
14 | extern "C" {
15 | #endif
16 |
17 | /**
18 | @struct SUCurveRef
19 | @extends SUEntityRef
20 | @brief References a curve.
21 | */
22 |
23 | /**
24 | @enum SUCurveType
25 | @brief Defines curve types that can be represented by \ref SUCurveRef.
26 | */
27 | enum SUCurveType {
28 | SUCurveType_Simple = 0,
29 | SUCurveType_Arc
30 | };
31 |
32 | /**
33 | @brief Converts from an \ref SUCurveRef to an \ref SUEntityRef.
34 | This is essentially an upcast operation.
35 | @param[in] curve The given curve reference.
36 | @related SUCurveRef
37 | @return
38 | - The converted \ref SUEntityRef if curve is a valid object
39 | - If not, the returned reference will be invalid
40 | */
41 | SU_EXPORT SUEntityRef SUCurveToEntity(SUCurveRef curve);
42 |
43 | /**
44 | @brief Converts from an \ref SUEntityRef to an \ref SUCurveRef.
45 | This is essentially a downcast operation so the given \ref SUEntityRef
46 | must be convertible to an \ref SUCurveRef.
47 | @param[in] entity The given entity reference.
48 | @related SUCurveRef
49 | @return
50 | - The converted \ref SUCurveRef if the downcast operation succeeds
51 | - If not, the returned reference will be invalid
52 | */
53 | SU_EXPORT SUCurveRef SUCurveFromEntity(SUEntityRef entity);
54 |
55 | /**
56 | @brief Creates a curve object with the given array of edges that is not
57 | connected to any face object. The array of N edges is sorted such that
58 | for each edge in the range [0, N] the start position of each edge is the
59 | same as the end position of the previous edge in the array. Each
60 | element of the array of edges is subsequently associated with the
61 | created curve object and must not be deallocated via SUEdgeRelease().
62 | @param curve The curve object created.
63 | @param edges The array of edge objects.
64 | @param len The number of edge objects in the array.
65 | @related SUCurveRef
66 | @return
67 | - \ref SU_ERROR_NONE on success
68 | - \ref SU_ERROR_NULL_POINTER_INPUT if edges is NULL
69 | - \ref SU_ERROR_OUT_OF_RANGE if len is 0
70 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if curve is NULL
71 | - \ref SU_ERROR_OVERWRITE_VALID if curve already references a valid object
72 | - \ref SU_ERROR_GENERIC if edge array contains an invalid edge, if the edges
73 | in the array are not connected, if any of the edges are associated with a face
74 | object, or the edges describe a loop
75 | */
76 | SU_RESULT SUCurveCreateWithEdges(SUCurveRef* curve, const SUEdgeRef edges[],
77 | size_t len);
78 |
79 | /**
80 | @brief Releases a curve object and its associated edge objects.
81 | @param curve The curve object.
82 | @related SUCurveRef
83 | @return
84 | - \ref SU_ERROR_NONE on success
85 | - \ref SU_ERROR_NULL_POINTER_INPUT if curve is NULL
86 | - \ref SU_ERROR_INVALID_INPUT if curve does not reference a valid object
87 | */
88 | SU_RESULT SUCurveRelease(SUCurveRef* curve);
89 |
90 | /**
91 | @brief Retrieves the curve type of a curve object.
92 | @param[in] curve The curve object.
93 | @param[out] type The curve type retrieved.
94 | @related SUCurveRef
95 | @return
96 | - \ref SU_ERROR_NONE on success
97 | - \ref SU_ERROR_INVALID_INPUT if curve is not a valid curve object
98 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if type is NULL
99 | */
100 | SU_RESULT SUCurveGetType(SUCurveRef curve, enum SUCurveType* type);
101 |
102 | /**
103 | @brief Retrieves the number of edges that belong to a curve object.
104 | @param[in] curve The curve object.
105 | @param[out] count The number of edges.
106 | @related SUCurveRef
107 | @return
108 | - \ref SU_ERROR_NONE on success
109 | - \ref SU_ERROR_INVALID_INPUT if curve is not a valid curve object
110 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if count is NULL
111 | */
112 | SU_RESULT SUCurveGetNumEdges(SUCurveRef curve, size_t* count);
113 |
114 | /**
115 | @brief Retrieves the edges of a curve object. Provides access to all edges in
116 | the curve. The first edge is the first element of the edges array and
117 | the last edge is the last element if all edges were retrieved.
118 | @param[in] curve The curve object.
119 | @param[in] len The number of edges to retrieve.
120 | @param[out] edges The edges retrieved.
121 | @param[out] count The number of edges retrieved.
122 | @related SUCurveRef
123 | @return
124 | - \ref SU_ERROR_NONE on success
125 | - \ref SU_ERROR_INVALID_INPUT if curve is not a valid curve object
126 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if edges or count is NULL
127 | */
128 | SU_RESULT SUCurveGetEdges(SUCurveRef curve, size_t len, SUEdgeRef edges[],
129 | size_t* count);
130 |
131 | #ifdef __cplusplus
132 | } // extern "C"
133 | #endif
134 |
135 | #endif // SKETCHUP_MODEL_CURVE_H_
136 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/dynamic_component_attribute.h:
--------------------------------------------------------------------------------
1 | // Copyright 2015 Trimble Inc. All Rights Reserved
2 |
3 |
4 | /**
5 | * @file
6 | * @brief Interfaces for SUDynamicComponentAttributeRef.
7 | */
8 | #ifndef SKETCHUP_MODEL_DYNAMIC_COMPONENT_ATTRIBUTE_H_
9 | #define SKETCHUP_MODEL_DYNAMIC_COMPONENT_ATTRIBUTE_H_
10 |
11 | #include
12 | #include
13 | #include
14 |
15 | #ifdef __cplusplus
16 | extern "C" {
17 | #endif
18 |
19 | /**
20 | @struct SUDynamicComponentAttributeRef
21 | @brief References attribute data about a dynamic component.
22 | */
23 |
24 | /**
25 | @brief Gets the name of the attribute.
26 | @since SketchUp 2016, API 4.0
27 | @param[in] attribute The dynamic component attribute object.
28 | @param[out] name The internal name of the attribute.
29 | @related SUDynamicComponentAttributeRef
30 | @return
31 | - \ref SU_ERROR_NONE on success
32 | - \ref SU_ERROR_INVALID_INPUT if attribute is not a valid object
33 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if name is NULL
34 | - \ref SU_ERROR_INVALID_OUTPUT if name does not point to a valid \ref
35 | SUStringRef object
36 | */
37 | SU_RESULT SUDynamicComponentAttributeGetName(
38 | SUDynamicComponentAttributeRef attribute,
39 | SUStringRef* name);
40 |
41 | /**
42 | @brief Gets the display name of the attribute.
43 | @since SketchUp 2016, API 4.0
44 | @param[in] attribute The dynamic component attribute object.
45 | @param[out] display_name The attribute name as it should be displayed to the
46 | user.
47 | @related SUDynamicComponentAttributeRef
48 | @return
49 | - \ref SU_ERROR_NONE on success
50 | - \ref SU_ERROR_INVALID_INPUT if attribute is not a valid object
51 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if display_name is NULL
52 | - \ref SU_ERROR_INVALID_OUTPUT if display_name does not point to a valid \ref
53 | SUStringRef object
54 | */
55 | SU_RESULT SUDynamicComponentAttributeGetDisplayName(
56 | SUDynamicComponentAttributeRef attribute,
57 | SUStringRef* display_name);
58 |
59 | /**
60 | @brief Gets the visibility setting of the attribute.
61 | @since SketchUp 2016, API 4.0
62 | @param[in] attribute The dynamic component attribute object.
63 | @param[out] visible Set to true if the attribute is visible to users and
64 | false if it is not.
65 | @related SUDynamicComponentAttributeRef
66 | @return
67 | - \ref SU_ERROR_NONE on success
68 | - \ref SU_ERROR_INVALID_INPUT if attribute is not a valid object
69 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if visible is NULL
70 | */
71 | SU_RESULT SUDynamicComponentAttributeGetVisibility(
72 | SUDynamicComponentAttributeRef attribute,
73 | bool* visible);
74 |
75 | /**
76 | @brief Gets the display value of the attribute.
77 | @since SketchUp 2016, API 4.0
78 | @param[in] attribute The dynamic component attribute object.
79 | @param[out] display_value The value data for the attribute converted to a string
80 | formatted as it should be displayed to the user.
81 | @related SUDynamicComponentAttributeRef
82 | @return
83 | - \ref SU_ERROR_NONE on success
84 | - \ref SU_ERROR_INVALID_INPUT if attribute is not a valid object
85 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if display_value is NULL
86 | - \ref SU_ERROR_INVALID_OUTPUT if display_value does not point to a valid \ref
87 | SUStringRef object
88 | */
89 | SU_RESULT SUDynamicComponentAttributeGetDisplayValue(
90 | SUDynamicComponentAttributeRef attribute,
91 | SUStringRef* display_value);
92 |
93 | #ifdef __cplusplus
94 | } // extern "C" {
95 | #endif
96 |
97 | #endif // SKETCHUP_MODEL_DYNAMIC_COMPONENT_ATTRIBUTE_H_
98 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/dynamic_component_info.h:
--------------------------------------------------------------------------------
1 | // Copyright 2015 Trimble Inc. All Rights Reserved
2 |
3 |
4 | /**
5 | * @file
6 | * @brief Interfaces for SUDynamicComponentInfoRef.
7 | */
8 | #ifndef SKETCHUP_MODEL_DYNAMIC_COMPONENT_INFO_H_
9 | #define SKETCHUP_MODEL_DYNAMIC_COMPONENT_INFO_H_
10 |
11 | #include
12 | #include
13 | #include
14 |
15 | #ifdef __cplusplus
16 | extern "C" {
17 | #endif
18 |
19 | /**
20 | @struct SUDynamicComponentInfoRef
21 | @brief References an object with information about a dynamic component.
22 | */
23 |
24 | /**
25 | @brief Releases the DC info. DC info objects are created from component instance
26 | using SUComponentInstanceCreateDCInfo(), and must be released using
27 | this function. This function also invalidates the given DC info.
28 | @since SketchUp 2016, API 4.0
29 | @param[in,out] dc_info The dynamic component info object.
30 | @related SUDynamicComponentInfoRef
31 | @return
32 | - \ref SU_ERROR_NONE on success
33 | - \ref SU_ERROR_NULL_POINTER_INPUT if dc_info is NULL
34 | - \ref SU_ERROR_INVALID_INPUT if dc_info is not a valid object
35 | */
36 | SU_RESULT SUDynamicComponentInfoRelease(SUDynamicComponentInfoRef* dc_info);
37 |
38 | /**
39 | @brief Retrieves the number of dynamic component attributes.
40 | @param[in] dc_info The dynamic component info object.
41 | @param[out] count The number of attributes.
42 | @related SUDynamicComponentInfoRef
43 | @return
44 | - \ref SU_ERROR_NONE on success
45 | - \ref SU_ERROR_INVALID_INPUT if dc_info is an invalid object
46 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if count is NULL
47 | */
48 | SU_RESULT SUDynamicComponentInfoGetNumDCAttributes(
49 | SUDynamicComponentInfoRef dc_info, size_t* count);
50 |
51 | /**
52 | @brief Retrieves the dynamic component attributes.
53 | @param[in] dc_info The dynamic component info object.
54 | @param[in] len The number of attributes to retrieve.
55 | @param[out] attributes The attributes retrieved.
56 | @param[out] count The number of attributes retrieved.
57 | @related SUDynamicComponentInfoRef
58 | @return
59 | - \ref SU_ERROR_NONE on success
60 | - \ref SU_ERROR_INVALID_INPUT if dc_info is an invalid object
61 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if attributes or count is NULL
62 | */
63 | SU_RESULT SUDynamicComponentInfoGetDCAttributes(
64 | SUDynamicComponentInfoRef dc_info, size_t len,
65 | SUDynamicComponentAttributeRef attributes[], size_t* count);
66 |
67 | #ifdef __cplusplus
68 | } // extern "C" {
69 | #endif
70 |
71 | #endif // SKETCHUP_MODEL_DYNAMIC_COMPONENT_INFO_H_
72 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/entity_list.h:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Trimble Inc. All Rights Reserved.
2 |
3 |
4 | /**
5 | * @file
6 | * @brief Interfaces for SUEntityListRef.
7 | */
8 | #ifndef SKETCHUP_MODEL_ENTITY_LIST_H_
9 | #define SKETCHUP_MODEL_ENTITY_LIST_H_
10 |
11 | #include
12 |
13 | #ifdef __cplusplus
14 | extern "C" {
15 | #endif
16 |
17 | /**
18 | @struct SUEntityListRef
19 | @brief References an entity list.
20 | @since SketchUp 2018, API 6.0
21 | */
22 |
23 | /**
24 | @brief Creates an entity list object.
25 | @since SketchUp 2018, API 6.0
26 | @param[in,out] list The entity list object to be created.
27 | @related SUEntityListRef
28 | @return
29 | - \ref SU_ERROR_NONE on success
30 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if list is NULL
31 | - \ref SU_ERROR_OVERWRITE_VALID if list already references a valid object
32 | */
33 | SU_RESULT SUEntityListCreate(SUEntityListRef* list);
34 |
35 | /**
36 | @brief Releases a list object.
37 | @since SketchUp 2018, API 6.0
38 | @param[in,out] list The list object to be released.
39 | @related SUEntityListRef
40 | @return
41 | - \ref SU_ERROR_NONE on success
42 | - \ref SU_ERROR_NULL_POINTER_INPUT if list is NULL
43 | - \ref SU_ERROR_INVALID_INPUT if list does not reference a valid object
44 | */
45 | SU_RESULT SUEntityListRelease(SUEntityListRef* list);
46 |
47 | /**
48 | @brief Sets the iterator reference to the beginning of the list. The given
49 | iterator object must have been constructed using
50 | SUEntityListIteratorCreate(). The iterator must be released using
51 | SUEntityListIteratorRelease() when it is no longer needed.
52 | @since SketchUp 2018, API 6.0
53 | @param[in] list The list.
54 | @param[out] iterator An iterator Ref reference the beginning of the list.
55 | @related SUEntityListRef
56 | @return
57 | - \ref SU_ERROR_NONE on success
58 | - \ref SU_ERROR_INVALID_INPUT if list is not a valid object
59 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if iterator is NULL
60 | - \ref SU_ERROR_INVALID_OUTPUT if *iterator is not a valid object
61 | */
62 | SU_RESULT SUEntityListBegin(SUEntityListRef list,
63 | SUEntityListIteratorRef* iterator);
64 |
65 | /**
66 | @brief Gets the number of entities in the list.
67 | @since SketchUp 2018, API 6.0
68 | @param[in] list The list object.
69 | @param[out] count The list size.
70 | @related SUEntityListRef
71 | @return
72 | - \ref SU_ERROR_NONE on success
73 | - \ref SU_ERROR_INVALID_INPUT if list is not a valid object
74 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if count is NULL
75 | */
76 | SU_RESULT SUEntityListSize(SUEntityListRef list, size_t* count);
77 |
78 | #ifdef __cplusplus
79 | } // extern "C"
80 | #endif
81 |
82 | #endif // SKETCHUP_MODEL_ENTITY_LIST_H_
83 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/entity_list_iterator.h:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Trimble Inc. All Rights Reserved.
2 |
3 |
4 | /**
5 | * @file
6 | * @brief Interfaces for SUEntityListIteratorRef.
7 | */
8 | #ifndef SKETCHUP_MODEL_ENTITY_LIST_ITERATOR_H_
9 | #define SKETCHUP_MODEL_ENTITY_LIST_ITERATOR_H_
10 |
11 | #include
12 |
13 | #ifdef __cplusplus
14 | extern "C" {
15 | #endif
16 |
17 | /**
18 | @struct SUEntityListIteratorRef
19 | @brief References an entity list iterator object.
20 | @since SketchUp 2018, API 6.0
21 | */
22 |
23 | /**
24 | @brief Creates an entity list iterator object.
25 | @since SketchUp 2018, API 6.0
26 | @param[in,out] iterator The entity list iterator object to be created.
27 | @related SUEntityListIteratorRef
28 | @return
29 | - \ref SU_ERROR_NONE on success
30 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if iterator is NULL
31 | - \ref SU_ERROR_OVERWRITE_VALID if iterator already references a valid object
32 | */
33 | SU_RESULT SUEntityListIteratorCreate(SUEntityListIteratorRef* iterator);
34 |
35 | /**
36 | @brief Releases a iterator object.
37 | @since SketchUp 2018, API 6.0
38 | @param[in,out] iterator The iterator object to be released.
39 | @related SUEntityListIteratorRef
40 | @return
41 | - \ref SU_ERROR_NONE on success
42 | - \ref SU_ERROR_NULL_POINTER_INPUT if iterator is NULL
43 | - \ref SU_ERROR_INVALID_INPUT if iterator does not reference a valid object
44 | */
45 | SU_RESULT SUEntityListIteratorRelease(SUEntityListIteratorRef* iterator);
46 |
47 | /**
48 | @brief Retrieves the specified entity pointer from the given iterator.
49 | @since SketchUp 2018, API 6.0
50 | @param[in] iterator The iterator from which to retrieve the entity.
51 | @param[out] entity The entity reference retrieved.
52 | @related SUEntityListIteratorRef
53 | @return
54 | - \ref SU_ERROR_NONE on success
55 | - \ref SU_ERROR_INVALID_INPUT if iterator is not a valid object
56 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if entity is NULL
57 | - \ref SU_ERROR_NO_DATA if the iterator references an invalid entity
58 | */
59 | SU_RESULT SUEntityListIteratorGetEntity(SUEntityListIteratorRef iterator,
60 | SUEntityRef* entity);
61 |
62 | /**
63 | @brief Increments the provided iterator.
64 | @since SketchUp 2018, API 6.0
65 | @param[in,out] iterator The iterator to be incremented.
66 | @related SUEntityListIteratorRef
67 | @return
68 | - \ref SU_ERROR_NONE on success
69 | - \ref SU_ERROR_INVALID_INPUT if iterator is not a valid object
70 | - \ref SU_ERROR_OUT_OF_RANGE if reached the end of the collection
71 | */
72 | SU_RESULT SUEntityListIteratorNext(SUEntityListIteratorRef iterator);
73 |
74 | /**
75 | @brief Checks if the iterator is still within range of the list.
76 | @since SketchUp 2018, API 6.0
77 | @param[in] iterator The iterator to be queried.
78 | @param[out] in_range A boolean indicating if the iterator is in range.
79 | @related SUEntityListIteratorRef
80 | @return
81 | - \ref SU_ERROR_NONE on success
82 | - \ref SU_ERROR_INVALID_INPUT if iterator is not a valid object
83 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if in_range is NULL
84 | - \ref SU_ERROR_OUT_OF_RANGE if the iterator is at the end of the collection
85 | */
86 | SU_RESULT SUEntityListIteratorIsInRange(SUEntityListIteratorRef iterator,
87 | bool* in_range);
88 |
89 | #ifdef __cplusplus
90 | } // extern "C"
91 | #endif
92 |
93 | #endif // SKETCHUP_MODEL_ENTITY_LIST_ITERATOR_H_
94 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/font.h:
--------------------------------------------------------------------------------
1 | // Copyright 2016 Trimble Inc. All Rights Reserved.
2 |
3 |
4 | /**
5 | * @file
6 | * @brief Interfaces for SUFontRef.
7 | */
8 | #ifndef SKETCHUP_MODEL_FONT_H_
9 | #define SKETCHUP_MODEL_FONT_H_
10 |
11 | #include
12 | #include
13 | #include
14 |
15 | #ifdef __cplusplus
16 | extern "C" {
17 | #endif
18 |
19 | /**
20 | @struct SUFontRef
21 | @extends SUEntityRef
22 | @brief A font entity reference.
23 | @since SketchUp 2017, API 5.0
24 | */
25 |
26 | /**
27 | @brief Retrieves the face name of a font object.
28 | @since SketchUp 2017, API 5.0
29 | @param[in] font The font object.
30 | @param[out] name The name retrieved.
31 | @related SUFontRef
32 | @return
33 | - \ref SU_ERROR_NONE on success
34 | - \ref SU_ERROR_INVALID_INPUT if font is not a valid object
35 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if name is NULL
36 | - \ref SU_ERROR_INVALID_OUTPUT if name does not point to a valid \ref
37 | SUStringRef object
38 | */
39 | SU_RESULT SUFontGetFaceName(SUFontRef font, SUStringRef* name);
40 |
41 | /**
42 | @brief Retrieves a font's point size.
43 | @since SketchUp 2017, API 5.0
44 | @param[in] font The font object.
45 | @param[out] size The returned font size.
46 | @related SUFontRef
47 | @return
48 | - \ref SU_ERROR_NONE on success
49 | - \ref SU_ERROR_INVALID_INPUT if font is not a valid object
50 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if size is NULL
51 | */
52 | SU_RESULT SUFontGetPointSize(SUFontRef font, size_t* size);
53 |
54 | /**
55 | @brief Retrieves a boolean indicating whether the font is bold.
56 | @since SketchUp 2017, API 5.0
57 | @param[in] font The font object.
58 | @param[out] is_bold The boolean retrieved.
59 | @related SUFontRef
60 | @return
61 | - \ref SU_ERROR_NONE on success
62 | - \ref SU_ERROR_INVALID_INPUT if font is not a valid object
63 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if is_bold is NULL
64 | */
65 | SU_RESULT SUFontGetBold(SUFontRef font, bool* is_bold);
66 |
67 | /**
68 | @brief Retrieves a boolean indicating whether the font is italic.
69 | @since SketchUp 2017, API 5.0
70 | @param[in] font The font object.
71 | @param[out] is_italic The boolean retrieved.
72 | @related SUFontRef
73 | @return
74 | - \ref SU_ERROR_NONE on success
75 | - \ref SU_ERROR_INVALID_INPUT if font is not a valid object
76 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if is_italic is NULL
77 | */
78 | SU_RESULT SUFontGetItalic(SUFontRef font, bool* is_italic);
79 |
80 | /**
81 | @brief Retrieves a boolean indicating whether the size of the font is defined
82 | as a height in world space. A false value indicates that the font size
83 | is defined in points (i.e. in screen space).
84 | @since SketchUp 2017, API 5.0
85 | @param[in] font The font object.
86 | @param[out] use_world_size The boolean retrieved.
87 | @related SUFontRef
88 | @return
89 | - \ref SU_ERROR_NONE on success
90 | - \ref SU_ERROR_INVALID_INPUT if font is not a valid object
91 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if is_italic is NULL
92 | */
93 | SU_RESULT SUFontGetUseWorldSize(SUFontRef font, bool* use_world_size);
94 |
95 | /**
96 | @brief Retrieves the height of the font in inches when the font size is defined
97 | as a height in world space. That is, when \ref SUFontGetUseWorldSize()
98 | returns true.
99 | @since SketchUp 2017, API 5.0
100 | @param[in] font The font object.
101 | @param[out] world_size The returned world size factor.
102 | @related SUFontRef
103 | @return
104 | - \ref SU_ERROR_NONE on success
105 | - \ref SU_ERROR_INVALID_INPUT if font is not a valid object
106 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if world_size is NULL
107 | */
108 | SU_RESULT SUFontGetWorldSize(SUFontRef font, double* world_size);
109 |
110 | /**
111 | @brief Converts from an \ref SUFontRef to an \ref SUEntityRef.
112 | This is essentially an upcast operation.
113 | @since SketchUp 2019, API 7.0
114 | @param[in] font The given font reference.
115 | @related SUFontRef
116 | @return
117 | - The converted SUEntityRef if font is a valid font.
118 | - If not, the returned reference will be invalid.
119 | */
120 | SU_EXPORT SUEntityRef SUFontToEntity(SUFontRef font);
121 |
122 | /**
123 | @brief Converts from an \ref SUEntityRef to an \ref SUFontRef.
124 | This is essentially a downcast operation so the given entity must be
125 | convertible to an \ref SUFontRef.
126 | @since SketchUp 2019, API 7.0
127 | @param[in] entity The given entity reference.
128 | @related SUFontRef
129 | @return
130 | - The converted SUFontRef if the downcast operation succeeds
131 | - If not, the returned reference will be invalid
132 | */
133 | SU_EXPORT SUFontRef SUFontFromEntity(SUEntityRef entity);
134 |
135 | #ifdef __cplusplus
136 | } // extern "C"
137 | #endif
138 |
139 | #endif // SKETCHUP_MODEL_FONT_H_
140 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/geometry.h:
--------------------------------------------------------------------------------
1 | // Copyright 2013 Trimble Inc., All rights reserved.
2 |
3 | /**
4 | * @file
5 | * @brief Deprecated, don't use.
6 | * @deprecated This file was left here for compatibility.
7 | * Avoid using it in future projects if possible.
8 | */
9 | #ifndef SKETCHUP_MODEL_GEOMETRY_H_
10 | #define SKETCHUP_MODEL_GEOMETRY_H_
11 |
12 | // This file was left here for compatibility. Avoid using it in future projects
13 | // if possible.
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 |
20 | #endif // SKETCHUP_MODEL_GEOMETRY_H_
21 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/line_style.h:
--------------------------------------------------------------------------------
1 | // Copyright 2018 Trimble Inc. All Rights Reserverd.
2 |
3 |
4 | /**
5 | * @file
6 | * @brief Interfaces for SULineStyleRef.
7 | */
8 | #ifndef SKETCHUP_SOURCE_SKORE_SKETCHUP_PUBLIC_MODEL_LINESTYLE_H_
9 | #define SKETCHUP_SOURCE_SKORE_SKETCHUP_PUBLIC_MODEL_LINESTYLE_H_
10 |
11 | #include
12 | #include
13 | #include
14 |
15 | #pragma pack(push, 8)
16 | #ifdef __cplusplus
17 | extern "C" {
18 | #endif
19 |
20 | /**
21 | @struct SULineStyleRef
22 | @extends SUEntityRef
23 | @brief References a line style.
24 | */
25 |
26 | /**
27 | @brief Converts from a \ref SULineStyleRef to an \ref SUEntityRef.
28 | This is essentially an upcast operation.
29 | @since SketchUp 2020.1, API 8.1
30 | @param[in] line_style The given line style reference.
31 | @related SULineStyleRef
32 | @return
33 | - The converted \ref SUEntityRef if line_style is a valid line style
34 | - If not, the returned reference will be invalid
35 | */
36 | SU_EXPORT SUEntityRef SULineStyleToEntity(SULineStyleRef line_style);
37 |
38 | /**
39 | @brief Converts from an \ref SUEntityRef to a \ref SULineStyleRef.
40 | This is essentially a downcast operation so the given entity must be
41 | convertible to a \ref SULineStyleRef.
42 | @since SketchUp 2020.1, API 8.1
43 | @param[in] entity_ref The given entity reference.
44 | @related SULineStyleRef
45 | @return
46 | - The converted \ref SULineStyleRef if the downcast operation succeeds
47 | - If not, the returned reference will be invalid
48 | */
49 | SU_EXPORT SULineStyleRef SULineStyleFromEntity(SUEntityRef entity_ref);
50 |
51 | /**
52 | @brief Retrieves the name of a line style object.
53 | @since SketchUp 2019, API 7.0
54 | @param[in] line_style The line style object.
55 | @param[out] name The name retrieved.
56 | @related SULineStyleRef
57 | @return
58 | - \ref SU_ERROR_NONE on success
59 | - \ref SU_ERROR_INVALID_INPUT if line_style is not a valid object
60 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if name is NULL
61 | - \ref SU_ERROR_INVALID_OUTPUT if name does not point to a valid \ref
62 | SUStringRef object
63 | */
64 | SU_RESULT SULineStyleGetName(SULineStyleRef line_style, SUStringRef* name);
65 | #ifdef __cplusplus
66 | }
67 | #endif
68 | #pragma pack(pop)
69 |
70 | #endif // SKETCHUP_SOURCE_SKORE_SKETCHUP_PUBLIC_MODEL_LINESTYLE_H_
71 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/line_styles.h:
--------------------------------------------------------------------------------
1 | // Copyright 2018 Trimble Inc. All Rights Reserverd.
2 |
3 |
4 | /**
5 | * @file
6 | * @brief Interfaces for SULineStylesRef.
7 | */
8 | #ifndef SKETCHUP_SOURCE_SKORE_SKETCHUP_PUBLIC_MODEL_LINESTYLES_H_
9 | #define SKETCHUP_SOURCE_SKORE_SKETCHUP_PUBLIC_MODEL_LINESTYLES_H_
10 |
11 | #include
12 | #include
13 |
14 | #pragma pack(push, 8)
15 | #ifdef __cplusplus
16 | extern "C" {
17 | #endif
18 |
19 | /**
20 | @struct SULineStylesRef
21 | @brief Provides access to the different line style objects in the model.
22 | */
23 |
24 | /**
25 | @brief Gets the number of line styles.
26 | @since SketchUp 2019, API 7.0
27 | @param[in] line_styles The line_styles manager object.
28 | @param[out] count The number of line styles available.
29 | @related SULineStylesRef
30 | @return
31 | - \ref SU_ERROR_NONE on success
32 | - \ref SU_ERROR_INVALID_INPUT if line_style_manager is not valid
33 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if count is NULL
34 | */
35 | SU_RESULT SULineStylesGetNumLineStyles(
36 | SULineStylesRef line_styles, size_t* count);
37 |
38 | /**
39 | @brief Retrieves line styles associated with the line styles manager.
40 | @since SketchUp 2019, API 7.0
41 | @param[in] line_styles The line_styles manager object.
42 | @param[in] len The number of line style names
43 | to retrieve.
44 | @param[out] line_styles_provider_names The line_style names retrieved.
45 | @param[out] count The number of line style names
46 | retrieved.
47 | @related SULineStylesRef
48 | @return
49 | - \ref SU_ERROR_NONE on success
50 | - \ref SU_ERROR_INVALID_INPUT if line_style_manager is not a valid object
51 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if line_styles_providers or count is NULL
52 | - \ref SU_ERROR_INVALID_OUTPUT if any of the strings in line_styles_provider_names
53 | are invalid
54 | */
55 | SU_RESULT SULineStylesGetLineStyleNames(
56 | SULineStylesRef line_styles, size_t len,
57 | SUStringRef line_styles_provider_names[], size_t* count);
58 |
59 | /**
60 | @brief Retrieves the line styles provider given a name.
61 | @since SketchUp 2019, API 7.0
62 | @param[in] line_styles The line_styles manager object.
63 | @param[in] name The name of the line style object to
64 | get. Assumed to be UTF-8 encoded.
65 | @param[out] line_style The line style object retrieved.
66 | @related SULineStylesRef
67 | @return
68 | - \ref SU_ERROR_NONE on success
69 | - \ref SU_ERROR_INVALID_INPUT if line_styles is not a valid object
70 | - \ref SU_ERROR_NULL_POINTER_INPUT if name is NULL
71 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if line_style is NULL
72 | - \ref SU_ERROR_NO_DATA if name does not match the name of any existing style.
73 | */
74 | SU_RESULT SULineStylesGetLineStyleByName(
75 | SULineStylesRef line_styles, const char* name,
76 | SULineStyleRef* line_style);
77 |
78 |
79 | #ifdef __cplusplus
80 | }
81 | #endif
82 | #pragma pack(pop)
83 |
84 | #endif // SKETCHUP_SOURCE_SKORE_SKETCHUP_PUBLIC_MODEL_LINESTYLES_H_
85 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/location.h:
--------------------------------------------------------------------------------
1 | // Copyright 2013 Trimble Inc. All Rights Reserved.
2 |
3 |
4 | /**
5 | * @file
6 | * @brief Interfaces for SULocationRef.
7 | */
8 | #ifndef SKETCHUP_MODEL_LOCATION_H_
9 | #define SKETCHUP_MODEL_LOCATION_H_
10 |
11 | #include
12 |
13 | /**
14 | @struct SULocationRef
15 | @brief References a type that contains location information of a model
16 | (e.g. latitude, longitude).
17 | */
18 |
19 | #ifdef __cplusplus
20 | extern "C" {
21 | #endif
22 |
23 | /**
24 | @brief Retrieves the latitude and longitude of a location object.
25 | @param[in] location The location object.
26 | @param[out] latitude The latitude value retrieved.
27 | @param[out] longitude The longitude value retrieved.
28 | @related SULocationRef
29 | @return
30 | - \ref SU_ERROR_NONE on success
31 | - \ref SU_ERROR_INVALID_INPUT if location is not a valid object
32 | - \ref SU_ERROR_NULL_POINTER_INPUT if latitude or longitude is NULL
33 | */
34 | SU_RESULT SULocationGetLatLong(SULocationRef location, double* latitude,
35 | double* longitude);
36 |
37 | /**
38 | @brief Assigns the latitude and longitude values of a location object.
39 | @param[in] location The location object.
40 | @param[in] latitude The latitude value to assign.
41 | @param[in] longitude The longitude value to assign.
42 | @related SULocationRef
43 | @return
44 | - \ref SU_ERROR_NONE on success
45 | - \ref SU_ERROR_INVALID_INPUT if location is not a valid object or if the
46 | latitude is out of range [-90, 90] or if longitude is out of range
47 | [-180, 180]
48 | */
49 | SU_RESULT SULocationSetLatLong(SULocationRef location, double latitude,
50 | double longitude);
51 |
52 | /**
53 | @brief Assigns the north angle values of a location object.
54 | @param[in] location The location object.
55 | @param[in] north_angle The north angle value to assign.
56 | @related SULocationRef
57 | @return
58 | - \ref SU_ERROR_NONE on success
59 | - \ref SU_ERROR_INVALID_INPUT if location is not a valid object or if north
60 | angle is out of range [0, 360]
61 | */
62 | SU_RESULT SULocationSetNorthAngle(SULocationRef location, double north_angle);
63 |
64 | #ifdef __cplusplus
65 | } // extern "C"
66 | #endif
67 |
68 | #endif // SKETCHUP_MODEL_LOCATION_H_
69 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/opening.h:
--------------------------------------------------------------------------------
1 | // Copyright 2013 Trimble Inc. All Rights Reserved.
2 |
3 | /**
4 | * @file
5 | * @brief Interfaces for SUOpeningRef.
6 | */
7 | #ifndef SKETCHUP_MODEL_OPENING_H_
8 | #define SKETCHUP_MODEL_OPENING_H_
9 |
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | #ifdef __cplusplus
16 | extern "C" {
17 | #endif
18 |
19 | /**
20 | @struct SUOpeningRef
21 | @brief References an opening object, which is a hole in a face created by an
22 | attached component instance or group.
23 | @since SketchUp 2014, API 2.0
24 |
25 | */
26 |
27 | /**
28 | @brief Retrieves the number of points of an opening.
29 | @since SketchUp 2014, API 2.0
30 | @param[in] opening The opening object.
31 | @param[out] count The number of points.
32 | @related SUOpeningRef
33 | @return
34 | - \ref SU_ERROR_NONE on success
35 | - \ref SU_ERROR_INVALID_INPUT if opening is not a valid object
36 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if count is NULL
37 | */
38 | SU_RESULT SUOpeningGetNumPoints(SUOpeningRef opening, size_t* count);
39 |
40 | /**
41 | @brief Retrieves the points of an opening object.
42 | @since SketchUp 2014, API 2.0
43 | @param[in] opening The opening object.
44 | @param[in] len The number of points to retrieve.
45 | @param[out] points The points retrieved.
46 | @param[out] count The number of points retrieved.
47 | @related SUOpeningRef
48 | @return
49 | - \ref SU_ERROR_NONE on success
50 | - \ref SU_ERROR_INVALID_INPUT if opening is not a valid object
51 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if points or count is NULL
52 | */
53 | SU_RESULT SUOpeningGetPoints(SUOpeningRef opening, size_t len,
54 | struct SUPoint3D points[], size_t* count);
55 |
56 | /**
57 | @brief Release an opening object.
58 | @since SketchUp 2014, API 2.0
59 | @param[in] opening The opening object.
60 | @related SUOpeningRef
61 | @return
62 | - \ref SU_ERROR_NONE on success
63 | - \ref SU_ERROR_INVALID_INPUT if opening is not a valid object
64 | - \ref SU_ERROR_NULL_POINTER_INPUT if points or count is NULL
65 | */
66 | SU_RESULT SUOpeningRelease(SUOpeningRef *opening);
67 |
68 | #ifdef __cplusplus
69 | } // extern "C" {
70 | #endif
71 |
72 | #endif // SKETCHUP_MODEL_OPENING_H_
73 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/options_manager.h:
--------------------------------------------------------------------------------
1 | // Copyright 2013 Trimble Inc. All Rights Reserved
2 |
3 |
4 | /**
5 | * @file
6 | * @brief Interfaces for SUOptionsManagerRef.
7 | */
8 | #ifndef SKETCHUP_MODEL_OPTIONS_MANAGER_H_
9 | #define SKETCHUP_MODEL_OPTIONS_MANAGER_H_
10 |
11 | #include
12 | #include
13 | #include
14 |
15 | #ifdef __cplusplus
16 | extern "C" {
17 | #endif
18 |
19 | /**
20 | @struct SUOptionsManagerRef
21 | @brief Provides access to the different options provider objects in the model.
22 | Available options providers are: PageOptions, SlideshowOptions,
23 | UnitsOptions, NamedOptions, and PrintOptions.
24 | */
25 |
26 | /**
27 | @brief Gets the number of available options providers.
28 | @param[in] options_manager The options manager object.
29 | @param[out] count The number of options available.
30 | @related SUOptionsManagerRef
31 | @return
32 | - \ref SU_ERROR_NONE on success
33 | - \ref SU_ERROR_INVALID_INPUT if options_manager is not valid
34 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if count is NULL
35 | */
36 | SU_RESULT SUOptionsManagerGetNumOptionsProviders(
37 | SUOptionsManagerRef options_manager, size_t* count);
38 |
39 | /**
40 | @brief Retrieves options providers associated with the options manager.
41 | @param[in] options_manager The options manager object.
42 | @param[in] len The number of options provider names
43 | to retrieve.
44 | @param[out] options_provider_names The options provider names retrieved.
45 | @param[out] count The number of options provider names
46 | retrieved.
47 | @related SUOptionsManagerRef
48 | @return
49 | - \ref SU_ERROR_NONE on success
50 | - \ref SU_ERROR_INVALID_INPUT if options_manager is not a valid object
51 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if options_providers or count is NULL
52 | - \ref SU_ERROR_INVALID_OUTPUT if any of the strings in options_provider_names
53 | are invalid
54 | */
55 | SU_RESULT SUOptionsManagerGetOptionsProviderNames(
56 | SUOptionsManagerRef options_manager, size_t len,
57 | SUStringRef options_provider_names[], size_t* count);
58 |
59 | /**
60 | @brief Retrieves the options provider given a name.
61 | @param[in] options_manager The options manager object.
62 | @param[in] name The name of the options provider object to get.
63 | Assumed to be UTF-8 encoded.
64 | @param[out] options_provider The options_provider object retrieved.
65 | @related SUOptionsManagerRef
66 | @return
67 | - \ref SU_ERROR_NONE on success
68 | - \ref SU_ERROR_INVALID_INPUT if options_manager is not a valid object
69 | - \ref SU_ERROR_NULL_POINTER_INPUT if name is NULL
70 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if options_providers is NULL
71 | - \ref SU_ERROR_NO_DATA if the requested options provider object does not exist
72 | */
73 | SU_RESULT SUOptionsManagerGetOptionsProviderByName(
74 | SUOptionsManagerRef options_manager, const char* name,
75 | SUOptionsProviderRef* options_provider);
76 |
77 | #ifdef __cplusplus
78 | } // extern "C" {
79 | #endif
80 |
81 | #endif // SKETCHUP_MODEL_OPTIONS_MANAGER_H_
82 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/schema.h:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Trimble Inc. All Rights Reserved.
2 |
3 |
4 | /**
5 | * @file
6 | * @brief Interfaces for SUSchemaRef.
7 | */
8 | #ifndef SKETCHUP_MODEL_SCHEMA_H_
9 | #define SKETCHUP_MODEL_SCHEMA_H_
10 |
11 | #include
12 | #include
13 |
14 | #ifdef __cplusplus
15 | extern "C" {
16 | #endif
17 |
18 | /**
19 | @struct SUSchemaRef
20 | @brief Used to manage a Schema object
21 | */
22 |
23 | /**
24 | @brief Gets a schema type from a schema.
25 | @param[in] schema_ref The schema object.
26 | @param[in] schema_type_name The name of the schema type to get.
27 | @param[out] schema_type_ref The schema type retrieved.
28 | @related SUSchemaRef
29 | @return
30 | - \ref SU_ERROR_NONE on success
31 | - \ref SU_ERROR_INVALID_INPUT if schema_ref is not a valid object
32 | - \ref SU_ERROR_NULL_POINTER_INPUT if schema_type_name is NULL
33 | - \ref SU_ERROR_INVALID_INPUT if schema_type_name is not a type from this
34 | schema
35 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if schema_type_ref is not a valid object
36 | */
37 | SU_RESULT SUSchemaGetSchemaType(SUSchemaRef schema_ref,
38 | const char* schema_type_name,
39 | SUSchemaTypeRef* schema_type_ref);
40 |
41 | #ifdef __cplusplus
42 | }
43 | #endif
44 |
45 | #endif // SKETCHUP_MODEL_SCHEMA_H_
46 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/schema_type.h:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Trimble Inc. All Rights Reserved.
2 |
3 |
4 | /**
5 | * @file
6 | * @brief Interfaces for SUSchemaTypeRef.
7 | */
8 | #ifndef SKETCHUP_MODEL_SCHEMA_TYPE_H_
9 | #define SKETCHUP_MODEL_SCHEMA_TYPE_H_
10 |
11 | #include
12 | #include
13 |
14 | #ifdef __cplusplus
15 | extern "C" {
16 | #endif
17 |
18 | /**
19 | @struct SUSchemaTypeRef
20 | @brief Used to manage a SchemaType object
21 | */
22 |
23 | #ifdef __cplusplus
24 | }
25 | #endif
26 |
27 | #endif // SKETCHUP_MODEL_SCHEMA_TYPE_H_
28 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/skp.h:
--------------------------------------------------------------------------------
1 | // Copyright 2020 Trimble Inc. All Rights Reserved.
2 |
3 | /**
4 | * @file
5 | * @brief Interfaces for reading metadata from SketchUp files without loading
6 | * the whole file.
7 | */
8 | #ifndef SKETCHUP_MODEL_SKP_H_
9 | #define SKETCHUP_MODEL_SKP_H_
10 |
11 | #include
12 | #include
13 |
14 | #ifdef __cplusplus
15 | extern "C" {
16 | #endif
17 |
18 | /**
19 | @since SketchUp 2021.0, API 9.0
20 |
21 | @brief Reads the GUID, globally unique identifier, for a model without opening
22 | the whole file.
23 |
24 | @see SUModelGetGuid
25 | @see SUComponentDefinitionGetGuid
26 |
27 | @param[in] file_path The model filepath to read from.
28 | @param[out] guid The guid string.
29 | @return
30 | - \ref SU_ERROR_NONE on success
31 | - \ref SU_ERROR_NULL_POINTER_INPUT if \p file_path is `NULL`
32 | - \ref SU_ERROR_INVALID_INPUT if \p file_path does not exist
33 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if \p guid is `NULL`
34 | - \ref SU_ERROR_INVALID_OUTPUT if \p guid does not point to a valid
35 | SUStringRef object.
36 | - \ref SU_ERROR_MODEL_INVALID if the model is not valid
37 | - \ref SU_ERROR_GENERIC if an unknown error occured reading the file
38 | */
39 | SU_RESULT SUSkpReadGuid(const char* file_path, SUStringRef* guid);
40 |
41 | #ifdef __cplusplus
42 | }
43 | #endif
44 |
45 | #endif // SKETCHUP_MODEL_SKP_H_
46 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/model/uv_helper.h:
--------------------------------------------------------------------------------
1 | // Copyright 2013 Trimble Inc. All Rights Reserved.
2 |
3 |
4 | /**
5 | * @file
6 | * @brief Interfaces for SUUVHelperRef.
7 | */
8 | #ifndef SKETCHUP_MODEL_UV_HELPER_H_
9 | #define SKETCHUP_MODEL_UV_HELPER_H_
10 |
11 | #include
12 | #include
13 |
14 | #pragma pack(push, 8)
15 | #ifdef __cplusplus
16 | extern "C" {
17 | #endif
18 |
19 | /**
20 | @struct SUUVHelperRef
21 | @brief Used to compute UV texture coordinates for a particular face.
22 | */
23 |
24 | /**
25 | @struct SUUVQ
26 | @brief Stores UV texture coordinates.
27 | */
28 | struct SUUVQ {
29 | double u; ///< U coordinate
30 | double v; ///< V coordinate
31 | double q; ///< Q coordinate
32 | };
33 |
34 | /**
35 | @brief Releases a UVHelper object that was obtained from a face.
36 | @param[in] uvhelper The UV helper object.
37 | @related SUUVHelperRef
38 | @return
39 | - \ref SU_ERROR_NONE on success
40 | - \ref SU_ERROR_NULL_POINTER_INPUT if uvhelper is NULL
41 | - \ref SU_ERROR_INVALID_INPUT if uvhelper is an invalid object
42 | */
43 | SU_RESULT SUUVHelperRelease(SUUVHelperRef* uvhelper);
44 |
45 | /**
46 | @brief Retrieves the UVQ point at the given point for the front of the face.
47 | @param[in] uvhelper The UV helper object.
48 | @param[in] point The point where the coordinates are to be computed.
49 | @param[out] uvq The coordinates retrieved.
50 | @related SUUVHelperRef
51 | @return
52 | - \ref SU_ERROR_NONE on success
53 | - \ref SU_ERROR_INVALID_INPUT if uvhelper is an invalid object
54 | - \ref SU_ERROR_NULL_POINTER_INPUT if point is NULL
55 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if uvq is NULL
56 | */
57 | SU_RESULT SUUVHelperGetFrontUVQ(SUUVHelperRef uvhelper,
58 | const struct SUPoint3D* point,
59 | struct SUUVQ* uvq);
60 |
61 | /**
62 | @brief Retrieves the UVQ point at the given point for the back of the face.
63 | @param[in] uvhelper The UVHelper object.
64 | @param[in] point The point where the coordinates are to be computed.
65 | @param[out] uvq The coordinates retrieved.
66 | @related SUUVHelperRef
67 | @return
68 | - \ref SU_ERROR_NONE on success
69 | - \ref SU_ERROR_INVALID_INPUT if uvhelper is an invalid object
70 | - \ref SU_ERROR_NULL_POINTER_INPUT if point is NULL
71 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if uvq is NULL
72 | */
73 | SU_RESULT SUUVHelperGetBackUVQ(SUUVHelperRef uvhelper,
74 | const struct SUPoint3D* point,
75 | struct SUUVQ* uvq);
76 |
77 | #ifdef __cplusplus
78 | } // extern "C" {
79 | #endif
80 | #pragma pack(pop)
81 |
82 | #endif // SKETCHUP_MODEL_UV_HELPER_H_
83 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/sketchup.h:
--------------------------------------------------------------------------------
1 | // Copyright 2015-2020 Trimble Inc., All rights reserved.
2 | // This file is intended for public distribution.
3 |
4 | /**
5 | * @file
6 | * @brief Utility header that loads all other headers in the SDK package.
7 | */
8 | #ifndef SKETCHUP_SKETCHUP_H_
9 | #define SKETCHUP_SKETCHUP_H_
10 |
11 | /**
12 | * @dir SketchUpAPI
13 | * @brief Interfaces for the SketchUp SDK.
14 | */
15 |
16 | /**
17 | * @dir SketchUpAPI/application
18 | * @brief Interfaces for usage within the SketchUp application.
19 | */
20 |
21 | /**
22 | * @dir SketchUpAPI/geometry
23 | * @brief Interfaces for geometric operations.
24 | */
25 |
26 | /**
27 | * @dir SketchUpAPI/import_export
28 | * @brief Interfaces for importers and exporters.
29 | */
30 |
31 | /**
32 | * @dir SketchUpAPI/model
33 | * @brief Interfaces for the SketchUp model.
34 | */
35 |
36 | /**
37 | * @dir SketchUpAPI/utils
38 | * @brief General utility interfaces.
39 | */
40 |
41 | #include
42 | #include
43 | #include
44 | #include
45 | #include
46 | #include
47 | #include
48 | #include
49 | #include
50 | #include
51 | #include
52 | #include
53 | #include
54 | #include
55 | #include
56 | #include
57 | #include
58 | #include
59 | #include
60 | #include
61 | #include
62 | #include
63 | #include
64 | #include
65 | #include
66 | #include
67 | #include
68 | #include
69 | #include
70 | #include
71 | #include
72 | #include
73 | #include
74 | #include
75 | #include
76 | #include
77 | #include
78 | #include
79 | #include
80 | #include
81 | #include
82 | #include
83 | #include
84 | #include
85 | #include
86 | #include
87 | #include
88 | #include
89 | #include
90 | #include
91 | #include
92 | #include
93 | #include
94 | #include
95 | #include
96 | #include
97 | #include
98 | #include
99 | #include
100 | #include
101 | #include
102 | #include
103 | #include
104 | #include
105 | #include
106 | #include
107 | #include
108 | #include
109 | #include
110 | #include
111 | #include
112 | #include
113 | #include
114 | #include
115 | #include
116 | #include
117 | #include
118 | #include
119 | #include
120 | #include
121 | #endif // SKETCHUP_SKETCHUP_H_
122 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/sketchup_info.h:
--------------------------------------------------------------------------------
1 | // Copyright 2015 Trimble Inc., All rights reserved.
2 |
3 | /**
4 | * @file
5 | * @brief Interfaces for obtaining information about the executing SketchUp
6 | * application.
7 | * @note This is only relevant for the Live API.
8 | */
9 | #ifndef SKETCHUP_SKETCHUP_INFO_H_
10 | #define SKETCHUP_SKETCHUP_INFO_H_
11 |
12 | #include
13 |
14 | #pragma pack(push, 8)
15 | #ifdef __cplusplus
16 | extern "C" {
17 | #endif
18 |
19 | /**
20 | @enum SUEdition
21 | @brief This is the edition of SketchUp currently running.
22 | @since SketchUp 2016, API 4.0
23 | */
24 | enum SUEdition {
25 | SUEdition_Unknown,
26 | SUEdition_Make, ///< SketchUp Make
27 | SUEdition_Pro ///< SketchUp Pro
28 | };
29 |
30 | /**
31 | @brief Returns the version string for the current SketchUp version. This is
32 | exported only by the SketchUp executable. It is not part of the
33 | standalone SDK.
34 | @since SketchUp 2016, API 4.0
35 | @param[in] length Length of the string buffer passed in including null
36 | terminator.
37 | @param[out] version The UTF-8 encoded version string. This must be large enough
38 | to hold the version string including null terminator.
39 | @return
40 | - \ref SU_ERROR_NONE on success
41 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if version is NULL
42 | - \ref SU_ERROR_INSUFFICIENT_SIZE if length is too small
43 | */
44 | SU_RESULT SUGetVersionStringUtf8(size_t length, char* version);
45 |
46 | /**
47 | @brief Returns the SketchUp edition (Pro or Make). This is only exported by
48 | the SketchUp executable. It is not part of the standalone SDK. Note:
49 | Starting with version 2018, SketchUp Make is no longer available. So this
50 | function will always return \ref SUEdition_Pro.
51 | @since SketchUp 2016, API 4.0
52 | @param[out] edition The edition of Sketchup
53 | @see SUEdition
54 | @return
55 | - \ref SU_ERROR_NONE on success
56 | - \ref SU_ERROR_NULL_POINTER_OUTPUT if edition is NULL
57 | */
58 | SU_RESULT SUGetEdition(enum SUEdition* edition);
59 |
60 | #ifdef __cplusplus
61 | } // extern "C" {
62 | #endif
63 | #pragma pack(pop)
64 |
65 | #endif // SKETCHUP_SKETCHUP_INFO_H_
66 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/slapi.h:
--------------------------------------------------------------------------------
1 | // Copyright 2015 Trimble Inc., All rights reserved.
2 | // This file is intended for public distribution.
3 |
4 | /**
5 | * @file
6 | * @brief Deprecated, don't use.
7 | * @deprecated This file was left here for compatibility.
8 | * Avoid using it in future projects if possible.
9 | */
10 |
11 | // NOTE: This file is provided as a shim header to include common.h, which now
12 | // contains the contents of the original slapi.h. This rename is due to the
13 | // addition of the Layout API for consistency. This header is deprecated and
14 | // will be removed in the future.
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/transformation.h:
--------------------------------------------------------------------------------
1 | // Copyright 2013 Trimble Inc., All rights reserved.
2 |
3 | /**
4 | * @file
5 | * @brief Deprecated, don't use.
6 | * @deprecated This file was left here for compatibility.
7 | * Avoid using it in future projects if possible.
8 | */
9 | #ifndef SKETCHUP_TRANSFORMATION_H_
10 | #define SKETCHUP_TRANSFORMATION_H_
11 |
12 | // This file was left here for compatibility. Avoid using it in future projects
13 | // if possible.
14 | #include
15 |
16 | #endif // SKETCHUP_TRANSFORMATION_H_
17 |
--------------------------------------------------------------------------------
/API/SketchUpAPI/utils/math_helpers.h:
--------------------------------------------------------------------------------
1 | // Copyright 2015 Trimble Inc. All rights reserved.
2 |
3 | /**
4 | * @file
5 | * @brief Interfaces for comparing values with tolerances.
6 | */
7 | #ifndef SKETCHUP_UTILS_MATH_HELPERS_H_
8 | #define SKETCHUP_UTILS_MATH_HELPERS_H_
9 |
10 | #include
11 |
12 |
13 | #ifdef __cplusplus
14 | extern "C" {
15 | #endif
16 |
17 | /**
18 | @brief Converts a value from degrees to radians.
19 | @since SketchUp 2018, API 6.0
20 | @param[in] value A value in degrees.
21 | @return The value converted to radians.
22 | */
23 | SU_EXPORT double SUDegreesToRadians(double value);
24 |
25 | /**
26 | @brief Converts a value from radians to degrees.
27 | @since SketchUp 2018, API 6.0
28 | @param[in] value A value in radians.
29 | @return The value converted to degrees.
30 | */
31 | SU_EXPORT double SURadiansToDegrees(double value);
32 |
33 | /**
34 | @brief Compares two values for equality with a tolerance.
35 | @since SketchUp 2018, API 6.0
36 | @param[in] val1 The first value.
37 | @param[in] val2 The second value.
38 | @return True if the values are equal.
39 | */
40 | SU_EXPORT bool SUEquals(double val1, double val2);
41 |
42 | /**
43 | @brief Compares two values with a tolerance to see if val1 is less than val2.
44 | @since SketchUp 2018, API 6.0
45 | @param[in] val1 The first value.
46 | @param[in] val2 The second value.
47 | @return True if val1 is less than val2.
48 | */
49 | SU_EXPORT bool SULessThan(double val1, double val2);
50 |
51 | /**
52 | @brief Compares two values with a tolerance to see if val1 is less than or equal
53 | to val2.
54 | @since SketchUp 2018, API 6.0
55 | @param[in] val1 The first value.
56 | @param[in] val2 The second value.
57 | @return True if val1 is less than or equal to val2.
58 | */
59 | SU_EXPORT bool SULessThanOrEqual(double val1, double val2);
60 |
61 | /**
62 | @brief Compares two values with a tolerance to see if val1 is greater than val2.
63 | @since SketchUp 2018, API 6.0
64 | @param[in] val1 The first value.
65 | @param[in] val2 The second value.
66 | @return True if val1 is greater than val2.
67 | */
68 | SU_EXPORT bool SUGreaterThan(double val1, double val2);
69 |
70 | /**
71 | @brief Compares two values with a tolerance to see if val1 is greater than or
72 | equal to val2.
73 | @since SketchUp 2018, API 6.0
74 | @param[in] val1 The first value.
75 | @param[in] val2 The second value.
76 | @return True if val1 is greater than or equal to val2.
77 | */
78 | SU_EXPORT bool SUGreaterThanOrEqual(double val1, double val2);
79 |
80 | // SketchUp 2017 added these functions, but lacked the SU* prefix. As of
81 | // SketchUp 2018 they were renamed. This compatibility macro is left around
82 | // until SketchUp 2019. Enable to temporarily re-enable the old function names.
83 | #ifdef SU_COMPAT_MATH_UTILS
84 |
85 | SU_DEPRECATED_FUNCTION("6.0")
86 | static double DegreesToRadians(double value) {
87 | return SUDegreesToRadians(value);
88 | }
89 |
90 | SU_DEPRECATED_FUNCTION("6.0")
91 | static bool Equals(double val1, double val2) {
92 | return SUEquals(val1, val2);
93 | }
94 |
95 | SU_DEPRECATED_FUNCTION("6.0")
96 | static bool GreaterThan(double val1, double val2) {
97 | return SUGreaterThan(val1, val2);
98 | }
99 |
100 | SU_DEPRECATED_FUNCTION("6.0")
101 | static bool GreaterThanOrEqual(double val1, double val2) {
102 | return SUGreaterThanOrEqual(val1, val2);
103 | }
104 |
105 | SU_DEPRECATED_FUNCTION("6.0")
106 | static bool LessThan(double val1, double val2) {
107 | return SULessThan(val1, val2);
108 | }
109 |
110 | SU_DEPRECATED_FUNCTION("6.0")
111 | static bool LessThanOrEqual(double val1, double val2) {
112 | return SULessThanOrEqual(val1, val2);
113 | }
114 |
115 | SU_DEPRECATED_FUNCTION("6.0")
116 | static double RadiansToDegrees(double value) {
117 | return SURadiansToDegrees(value);
118 | }
119 | #endif
120 |
121 | #ifdef __cplusplus
122 | } // end extern "C"
123 | #endif // __cplusplus
124 |
125 | #endif // SKETCHUP_UTILS_MATH_HELPERS_H_
126 |
--------------------------------------------------------------------------------
/API/SketchUpCommonPreferences.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moethu/SketchUpNET/eed3cd9a734ec6a3ed66a28a9f85d1d1d6b325e0/API/SketchUpCommonPreferences.dll
--------------------------------------------------------------------------------
/API/sketchup.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moethu/SketchUpNET/eed3cd9a734ec6a3ed66a28a9f85d1d1d6b325e0/API/sketchup.lib
--------------------------------------------------------------------------------
/Icons/ReadSKP.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moethu/SketchUpNET/eed3cd9a734ec6a3ed66a28a9f85d1d1d6b325e0/Icons/ReadSKP.png
--------------------------------------------------------------------------------
/Icons/ReadSKPSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moethu/SketchUpNET/eed3cd9a734ec6a3ed66a28a9f85d1d1d6b325e0/Icons/ReadSKPSmall.png
--------------------------------------------------------------------------------
/Icons/SKP.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moethu/SketchUpNET/eed3cd9a734ec6a3ed66a28a9f85d1d1d6b325e0/Icons/SKP.png
--------------------------------------------------------------------------------
/Icons/SKPSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moethu/SketchUpNET/eed3cd9a734ec6a3ed66a28a9f85d1d1d6b325e0/Icons/SKPSmall.png
--------------------------------------------------------------------------------
/Icons/WriteSKP.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moethu/SketchUpNET/eed3cd9a734ec6a3ed66a28a9f85d1d1d6b325e0/Icons/WriteSKP.png
--------------------------------------------------------------------------------
/Icons/WriteSKPSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moethu/SketchUpNET/eed3cd9a734ec6a3ed66a28a9f85d1d1d6b325e0/Icons/WriteSKPSmall.png
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Maximilian Thumfart
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SketchUpNET
2 |
3 | C++/CLI API Wrapper for the Trimble(R) SketchUp(R) C API.
4 | http://www.sketchup.com/intl/en/developer/api-terms-of-service.pdf
5 |
6 | This library adds .NET support to the existing SketchUp C-API. It makes most SketchUp C-API features available in .NET and therefore accessible in C# or VB applications. You can download a pre-built release of the library or build it yourself from scratch.
7 |
8 | ### Code-Examples
9 |
10 | This Repo contains three sample projects using SketchUpNET in C#.NET:
11 |
12 | - SketchUpForDynamo: An Autodesk's(R) Dynamo Node Package allowing you to read/write SketchUp files from Dynamo.
13 | - SketchUpForGrasshopper: A Set of Components for McNeel's(R) Grasshopper(R) allowing you to read/write SketchUp files from GH.
14 | - SketchUpNETConsole: A sample C# console application using SketchUpNET.
15 |
16 | If you want to build your own application using the SketchUp API take the following steps:
17 |
18 | #### Loading a Model
19 |
20 | ```csharp
21 | SketchUpNET.SketchUp skp = new SketchUp();
22 | skp.LoadModel("myfile.skp", true);
23 | foreach (var srf in skp.Surfaces) {
24 | // do something with your surfaces
25 | }
26 | ```
27 |
28 | #### Saving a Model
29 |
30 | ```csharp
31 | skp.WriteNewModel("filename.skp");
32 | ```
33 |
34 | #### Converting a Model
35 |
36 | ```csharp
37 | SketchUpNET.SketchUp skp = new SketchUp();
38 | skp.SaveAs("old-file.skp", SKPVersion.V2020, "new-file.skp");
39 | ```
40 |
41 | #### Writing a Surface to a File
42 |
43 | ```csharp
44 | SketchUpNET.SketchUp skp = new SketchUpNET.SketchUp();
45 | skp.Layers = new List() { new Layer("Layer0") };
46 | skp.Surfaces = new List();
47 | skp.Curves = new List();
48 | skp.Edges = new List();
49 | List Verticies = new List();
50 |
51 | SketchUpNET.Loop OuterEdges = new SketchUpNET.Loop();
52 | OuterEdges.Edges = new List();
53 | {
54 | OuterEdges.Edges.Add(new SketchUpNET.Edge(new Vertex(0, 0, 0), new Vertex(500, 0, 0), "Layer0"));
55 | OuterEdges.Edges.Add(new SketchUpNET.Edge(new Vertex(500, 0, 0), new Vertex(500, 500, 0), "Layer0"));
56 | OuterEdges.Edges.Add(new SketchUpNET.Edge(new Vertex(500, 500, 0), new Vertex(0, 500, 0), "Layer0"));
57 | OuterEdges.Edges.Add(new SketchUpNET.Edge(new Vertex(0, 500, 0), new Vertex(0, 0, 0), "Layer0"));
58 | }
59 |
60 | List InnerLoops = new List();
61 | {
62 | SketchUpNET.Loop InnerEdges = new SketchUpNET.Loop();
63 | InnerEdges.Edges = new List();
64 | InnerEdges.Edges.Add(new SketchUpNET.Edge(new Vertex(100, 100, 0), new Vertex(400, 100, 0), "Layer0"));
65 | InnerEdges.Edges.Add(new SketchUpNET.Edge(new Vertex(400, 100, 0), new Vertex(400, 400, 0), "Layer0"));
66 | InnerEdges.Edges.Add(new SketchUpNET.Edge(new Vertex(400, 400, 0), new Vertex(100, 400, 0), "Layer0"));
67 | InnerEdges.Edges.Add(new SketchUpNET.Edge(new Vertex(100, 400, 0), new Vertex(100, 100, 0), "Layer0"));
68 | InnerLoops.Add(InnerEdges);
69 | }
70 |
71 | SketchUpNET.Surface s = new SketchUpNET.Surface(OuterEdges, InnerLoops);
72 | skp.Surfaces.Add(s);
73 |
74 | skp.WriteNewModel(@"TempModel.skp");
75 | ```
76 |
77 | ### Requirements
78 |
79 | If not installed you might requires Visual C++ Redistributable Packages for Visual Studio
80 | https://www.microsoft.com/en-sg/download/details.aspx?id=40784
81 |
82 | The library requires the SketchUp C API which is part of the package.
83 |
84 |
85 | ### nuget Binaries
86 |
87 | SketchUpNET is available as a precompiled binary on nuget:
88 | https://www.nuget.org/packages/SketchUpNET/
89 |
--------------------------------------------------------------------------------
/SketchUpForDynamo/Material.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace SketchUpForDynamo
8 | {
9 | public class Material
10 | {
11 | private SketchUpNET.Material Internal;
12 |
13 | internal Material(SketchUpNET.Material mat)
14 | {
15 | Internal = mat;
16 | }
17 |
18 | ///
19 | /// Get Material Name
20 | ///
21 | ///
22 | public string GetName()
23 | {
24 | return Internal.Name;
25 | }
26 |
27 | ///
28 | /// Get Texture Filename
29 | ///
30 | ///
31 | public string GetTextureFileName()
32 | {
33 | return Internal.MaterialTexture.Name;
34 | }
35 |
36 | ///
37 | /// Get Textrue Height
38 | ///
39 | ///
40 | public int GetTextureHeight()
41 | {
42 | return Internal.MaterialTexture.Height;
43 | }
44 |
45 | ///
46 | /// Get Texture Width
47 | ///
48 | ///
49 | public int GetTextureWidth()
50 | {
51 | return Internal.MaterialTexture.Width;
52 | }
53 |
54 | ///
55 | /// Get Texture Scale in Height
56 | ///
57 | ///
58 | public double GetTextureScaleH()
59 | {
60 | return Internal.MaterialTexture.ScaleH;
61 | }
62 |
63 | ///
64 | /// Get Textute Scale in Width
65 | ///
66 | ///
67 | public double GetTextureScaleW()
68 | {
69 | return Internal.MaterialTexture.ScaleW;
70 | }
71 |
72 | ///
73 | /// Does the material texture use alpha?
74 | ///
75 | ///
76 | public bool GetTextureUsesAlpha()
77 | {
78 | return Internal.MaterialTexture.useAlpha;
79 | }
80 |
81 | ///
82 | /// Get Colour
83 | ///
84 | ///
85 | public DSCore.Color GetColour()
86 | {
87 | return Internal.Colour.ToDSColour();
88 | }
89 |
90 | ///
91 | /// Get Texture Colour
92 | ///
93 | ///
94 | public DSCore.Color GetTextureColour()
95 | {
96 | return Internal.MaterialTexture.Colour.ToDSColour();
97 | }
98 |
99 | ///
100 | /// Get Opacity
101 | ///
102 | ///
103 | public double GetOpacity()
104 | {
105 | return Internal.Opacity;
106 | }
107 |
108 | ///
109 | /// Does the material use opacity?
110 | ///
111 | ///
112 | public bool GetUseOpacity()
113 | {
114 | return Internal.UseOpacity;
115 | }
116 |
117 | ///
118 | /// Does the material use colour?
119 | ///
120 | ///
121 | public bool GetUsesColor()
122 | {
123 | return Internal.UsesColor;
124 | }
125 |
126 | ///
127 | /// Does the material use texture?
128 | ///
129 | ///
130 | public bool GetUsesTexture()
131 | {
132 | return Internal.UsesTexture;
133 | }
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/SketchUpForDynamo/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("SketchUp for Dynamo")]
9 | [assembly: AssemblyDescription("SketchUp for Dynamo")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SketchUp for Dynamo")]
13 | [assembly: AssemblyCopyright("Copyright © 2022")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("866d0b3e-a772-4436-adeb-f3f7bdfe9455")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.7.2.0")]
36 | [assembly: AssemblyFileVersion("1.7.2.0")]
37 |
--------------------------------------------------------------------------------
/SketchUpForDynamo/SketchUpForDynamoImages.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moethu/SketchUpNET/eed3cd9a734ec6a3ed66a28a9f85d1d1d6b325e0/SketchUpForDynamo/SketchUpForDynamoImages.resources
--------------------------------------------------------------------------------
/SketchUpForGrasshopper/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("SketchUpSharp.Grasshopper")]
9 | [assembly: AssemblyDescription("SketchUp Components for Grasshopper")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SketchUpSharp.Grasshopper")]
13 | [assembly: AssemblyCopyright("Copyright © 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("99c5b02d-bcb1-41d6-af0d-263f86136889")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.1.0")]
36 | [assembly: AssemblyFileVersion("1.0.1.0")]
37 |
--------------------------------------------------------------------------------
/SketchUpForGrasshopper/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace SketchUpForGrasshopper.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SketchUpForGrasshopper.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Looks up a localized resource of type System.Drawing.Bitmap.
65 | ///
66 | internal static System.Drawing.Bitmap Skp {
67 | get {
68 | object obj = ResourceManager.GetObject("Skp", resourceCulture);
69 | return ((System.Drawing.Bitmap)(obj));
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/SketchUpForGrasshopper/Resources/Skp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moethu/SketchUpNET/eed3cd9a734ec6a3ed66a28a9f85d1d1d6b325e0/SketchUpForGrasshopper/Resources/Skp.png
--------------------------------------------------------------------------------
/SketchUpForGrasshopper/SketchUpForGrasshopper.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {942583E2-369B-4A00-8E34-F22073A911B2}
8 | Library
9 | Properties
10 | SketchUpForGrasshopper
11 | SketchUpForGrasshopper
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 | C:\Program Files\Rhino 6\Plug-ins\Grasshopper\GH_IO.dll
35 | False
36 |
37 |
38 | C:\Program Files\Rhino 6\Plug-ins\Grasshopper\Grasshopper.dll
39 | False
40 |
41 |
42 | C:\Program Files\Rhino 6\System\RhinoCommon.dll
43 | False
44 |
45 |
46 | C:\Program Files\Rhino 6\System\Rhino_DotNet.dll
47 | False
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | True
63 | True
64 | Resources.resx
65 |
66 |
67 |
68 |
69 | ResXFileCodeGenerator
70 | Resources.Designer.cs
71 |
72 |
73 |
74 |
75 | sketchup.lib
76 | Always
77 |
78 |
79 | SketchUpAPI.lib
80 | Always
81 |
82 |
83 |
84 |
85 |
86 | {1c4d4501-eb39-45c8-bed0-609a978e823f}
87 | SketchUpNET
88 |
89 |
90 |
91 |
92 | SketchUpAPI.dll
93 | Always
94 |
95 |
96 | SketchUpCommonPreferences.dll
97 | Always
98 |
99 |
100 |
101 |
102 | move $(TargetDir)$(TargetFileName) $(TargetDir)$(TargetName).gha
103 | copy $(TargetDir)*.* %25AppData%25\Grasshopper\Libraries
104 |
105 |
112 |
--------------------------------------------------------------------------------
/SketchUpNET.Unittest/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("SketchUpNET.Unittest")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SketchUpNET.Unittest")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("5aac9c72-cfbd-4b20-83fc-dbafa4fc7a53")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/SketchUpNET/Color.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | SketchUpNET - a C++ Wrapper for the Trimble(R) SketchUp(R) C API
4 | Copyright(C) 2015, Autor: Maximilian Thumfart
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software
7 | and associated documentation files (the "Software"), to deal in the Software without restriction,
8 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
20 | */
21 | #pragma once
22 |
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 |
31 | using namespace System;
32 | using namespace System::Collections;
33 | using namespace System::Collections::Generic;
34 |
35 | namespace SketchUpNET
36 | {
37 | public ref class Color
38 | {
39 | public:
40 |
41 | byte R;
42 | byte G;
43 | byte B;
44 | byte A;
45 |
46 | Color(byte a, byte r, byte g, byte b)
47 | {
48 | this->R = r;
49 | this->G = g;
50 | this->B = b;
51 | this->A = a;
52 | };
53 |
54 | Color() {};
55 | internal:
56 | static Color^ FromSU(SUColor color)
57 | {
58 | Color^ v = gcnew Color(color.alpha, color.red, color.green, color.blue);
59 |
60 | return v;
61 | };
62 |
63 | SUColor ToSU()
64 | {
65 | SUColor c = { this->R,this->G,this->B,this->A };
66 | return c;
67 | }
68 |
69 | };
70 |
71 |
72 | }
--------------------------------------------------------------------------------
/SketchUpNET/Color.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | SketchUpNET - a C++ Wrapper for the Trimble(R) SketchUp(R) C API
4 | Copyright(C) 2015, Autor: Maximilian Thumfart
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software
7 | and associated documentation files (the "Software"), to deal in the Software without restriction,
8 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
20 | */
21 | #include "Color.cpp"
--------------------------------------------------------------------------------
/SketchUpNET/Component.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | SketchUpNET - a C++ Wrapper for the Trimble(R) SketchUp(R) C API
4 | Copyright(C) 2015, Autor: Maximilian Thumfart
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software
7 | and associated documentation files (the "Software"), to deal in the Software without restriction,
8 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
20 | */
21 |
22 | #pragma once
23 |
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 | #include "surface.h"
37 | #include "edge.h"
38 | #include "group.h"
39 | #include "curve.h"
40 | #include "utilities.h"
41 | #include "Transform.h"
42 | #include "Instance.h"
43 |
44 | using namespace System;
45 | using namespace System::Collections;
46 | using namespace System::Collections::Generic;
47 |
48 | namespace SketchUpNET
49 | {
50 | public ref class Component
51 | {
52 | public:
53 | System::String^ Name;
54 | System::String^ Description;
55 | List^ Surfaces;
56 | List^ Instances;
57 | System::String^ Guid;
58 | List^ Curves;
59 | List^ Edges;
60 | List^ Groups;
61 |
62 | Component(System::String^ name, System::String^ guid, List^ surfaces, List^ curves, List^ edges, List^ instances, System::String^ desc, List^ groups)
63 | {
64 | this->Name = name;
65 | this->Surfaces = surfaces;
66 | this->Guid = guid;
67 | this->Curves = curves;
68 | this->Edges = edges;
69 | this->Description = desc;
70 | this->Instances = instances;
71 | this->Groups = groups;
72 | };
73 |
74 | Component(){};
75 | internal:
76 | static Component^ FromSU(SUComponentDefinitionRef comp, bool includeMeshes, System::Collections::Generic::Dictionary^ materials)
77 | {
78 | SUStringRef name = SU_INVALID;
79 | SUStringCreate(&name);
80 | SUComponentDefinitionGetName(comp, &name);
81 |
82 | SUStringRef desc = SU_INVALID;
83 | SUStringCreate(&desc);
84 | SUComponentDefinitionGetDescription(comp, &desc);
85 |
86 | SUEntitiesRef entities = SU_INVALID;
87 | SUComponentDefinitionGetEntities(comp, &entities);
88 |
89 | size_t faceCount = 0;
90 | SUEntitiesGetNumFaces(entities, &faceCount);
91 |
92 |
93 | SUStringRef guid = SU_INVALID;
94 | SUStringCreate(&guid);
95 | SUComponentDefinitionGetGuid(comp, &guid);
96 |
97 | List^ surfaces = Surface::GetEntitySurfaces(entities, includeMeshes, materials);
98 | List^ curves = Curve::GetEntityCurves(entities);
99 | List^ edges = Edge::GetEntityEdges(entities);
100 | List^ instances = Instance::GetEntityInstances(entities, materials);
101 | List^ grps = Group::GetEntityGroups(entities, includeMeshes, materials);
102 |
103 |
104 |
105 | Component^ v = gcnew Component(Utilities::GetString(name), Utilities::GetString(guid), surfaces, curves, edges,instances, Utilities::GetString(desc), grps);
106 |
107 | return v;
108 | };
109 |
110 | };
111 |
112 |
113 | }
--------------------------------------------------------------------------------
/SketchUpNET/Component.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | SketchUpNET - a C++ Wrapper for the Trimble(R) SketchUp(R) C API
4 | Copyright(C) 2015, Autor: Maximilian Thumfart
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software
7 | and associated documentation files (the "Software"), to deal in the Software without restriction,
8 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
20 | */
21 | #include "Component.cpp"
--------------------------------------------------------------------------------
/SketchUpNET/Curve.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | SketchUpNET - a C++ Wrapper for the Trimble(R) SketchUp(R) C API
4 | Copyright(C) 2015, Autor: Maximilian Thumfart
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software
7 | and associated documentation files (the "Software"), to deal in the Software without restriction,
8 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
20 | */
21 |
22 | #pragma once
23 |
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 | #include "edge.h"
37 |
38 | using namespace System;
39 | using namespace System::Collections;
40 | using namespace System::Collections::Generic;
41 |
42 | namespace SketchUpNET
43 | {
44 | public ref class Curve
45 | {
46 | public:
47 |
48 | ///
49 | /// Collection of edges forming the curve
50 | ///
51 | List^ Edges = gcnew List();
52 |
53 | ///
54 | /// Indicates if this curve should be interpreted as an arc
55 | ///
56 | bool isArc;
57 |
58 | ///
59 | /// Creates a new curve based on a set of edges
60 | ///
61 | /// Underlying edges
62 | /// Should be interpreted as an arc
63 | Curve(List^ edges, bool isarc)
64 | {
65 | this->Edges = edges;
66 | this->isArc = isarc;
67 | };
68 |
69 | Curve(){};
70 |
71 | internal:
72 |
73 | static Curve^ FromSU(SUCurveRef curve)
74 | {
75 | List^ edgelist = gcnew List();
76 |
77 | size_t edgecount = 0;
78 | SUCurveGetNumEdges(curve, &edgecount);
79 | if (edgecount > 0)
80 | {
81 | std::vector edges(edgecount);
82 | SUCurveGetEdges(curve, edgecount, &edges[0], &edgecount);
83 |
84 | for (size_t j = 0; j < edgecount; j++)
85 | {
86 | edgelist->Add(Edge::FromSU(edges[j]));
87 | }
88 | }
89 |
90 | SUCurveType type = SUCurveType::SUCurveType_Simple;
91 | SUCurveGetType(curve, &type);
92 | bool isArc = false;
93 | if (type == SUCurveType::SUCurveType_Arc) isArc = true;
94 |
95 |
96 | Curve^ v = gcnew Curve(edgelist, isArc);
97 |
98 | return v;
99 | };
100 |
101 | SUCurveRef ToSU()
102 | {
103 | SUCurveRef curve = SU_INVALID;
104 | size_t size = this->Edges->Count;
105 |
106 | SUEdgeRef * edges = (SUEdgeRef *)malloc(*&size * sizeof(SUEdgeRef));
107 |
108 | for (int i = 0; i < size; i++)
109 | {
110 | edges[i] = this->Edges[i]->ToSU();
111 | }
112 | SUCurveCreateWithEdges(&curve, edges, size);
113 | return curve;
114 | }
115 |
116 | static SUCurveRef* ListToSU(List^ curves)
117 | {
118 | size_t size = curves->Count;
119 | SUCurveRef * result = (SUCurveRef *)malloc(*&size * sizeof(SUCurveRef));
120 | for (int i = 0; i < size; i++)
121 | {
122 | result[i] = curves[i]->ToSU();
123 | }
124 | return result;
125 | }
126 |
127 | static List^ GetEntityCurves(SUEntitiesRef entities)
128 | {
129 | List^ curves = gcnew List();
130 |
131 | // GetCurves
132 | size_t curveCount = 0;
133 | SUEntitiesGetNumCurves(entities, &curveCount);
134 | if (curveCount > 0)
135 | {
136 | std::vector curvevector(curveCount);
137 | SUEntitiesGetCurves(entities, curveCount, &curvevector[0], &curveCount);
138 |
139 |
140 | for (size_t i = 0; i < curveCount; i++) {
141 | Curve^ curve = Curve::FromSU(curvevector[i]);
142 | curves->Add(curve);
143 | }
144 | }
145 |
146 | return curves;
147 | }
148 |
149 |
150 | };
151 |
152 |
153 |
154 |
155 | }
--------------------------------------------------------------------------------
/SketchUpNET/Curve.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | SketchUpNET - a C++ Wrapper for the Trimble(R) SketchUp(R) C API
4 | Copyright(C) 2015, Autor: Maximilian Thumfart
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software
7 | and associated documentation files (the "Software"), to deal in the Software without restriction,
8 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
20 | */
21 | #include "Curve.cpp"
--------------------------------------------------------------------------------
/SketchUpNET/Edge.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | SketchUpNET - a C++ Wrapper for the Trimble(R) SketchUp(R) C API
4 | Copyright(C) 2015, Autor: Maximilian Thumfart
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software
7 | and associated documentation files (the "Software"), to deal in the Software without restriction,
8 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
20 | */
21 |
22 | #pragma once
23 |
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 | #include
37 | #include "vertex.h"
38 | #include "utilities.h"
39 |
40 | using namespace System;
41 | using namespace System::Collections;
42 | using namespace System::Collections::Generic;
43 |
44 | namespace SketchUpNET
45 | {
46 | public ref class Edge
47 | {
48 | public:
49 |
50 | Vertex^ Start;
51 | Vertex^ End;
52 | System::String^ Layer;
53 |
54 | ///
55 | /// Creates a new edge by startpoint, endpoint and layer name
56 | ///
57 | /// Startpoint
58 | /// Endpoint
59 | /// Layername
60 | Edge(Vertex ^ start, Vertex ^ end, System::String^ layer)
61 | {
62 | this->Start = start;
63 | this->End = end;
64 | this->Layer = layer;
65 | };
66 |
67 | Edge() {};
68 |
69 | ///
70 | /// Creates a new edge by start end endpoint
71 | ///
72 | /// Startpoint
73 | /// Endpoint
74 | Edge(Vertex^ start, Vertex^ end){
75 | this->Start = start;
76 | this->End = end;
77 | };
78 |
79 | internal:
80 | static Edge^ FromSU(SUEdgeRef edge)
81 | {
82 | SUVertexRef startVertex = SU_INVALID;
83 | SUVertexRef endVertex = SU_INVALID;
84 | SUEdgeGetStartVertex(edge, &startVertex);
85 | SUEdgeGetEndVertex(edge, &endVertex);
86 | SUPoint3D start;
87 | SUPoint3D end;
88 | SUVertexGetPosition(startVertex, &start);
89 | SUVertexGetPosition(endVertex, &end);
90 |
91 | // Layer
92 | SULayerRef layer = SU_INVALID;
93 | SUDrawingElementGetLayer(SUEdgeToDrawingElement(edge), &layer);
94 |
95 | System::String^ layername = gcnew System::String("");
96 | if (!SUIsInvalid(layer))
97 | {
98 | layername = SketchUpNET::Utilities::GetLayerName(layer);
99 | }
100 |
101 | Edge^ v = gcnew Edge(Vertex::FromSU(start), Vertex::FromSU(end), layername);
102 |
103 | return v;
104 | };
105 |
106 | SUEdgeRef ToSU()
107 | {
108 | SUEdgeRef edge = SU_INVALID;
109 | SUPoint3D start = this->Start->ToSU();
110 | SUPoint3D end = this->End->ToSU();
111 | SUEdgeCreate(&edge,&start,&end);
112 | return edge;
113 | }
114 |
115 | static SUEdgeRef* ListToSU(List^ list)
116 | {
117 | size_t size = list->Count;
118 | SUEdgeRef * result = (SUEdgeRef *)malloc(*&size * sizeof(SUEdgeRef));
119 | for (int i = 0; i < size; i++)
120 | {
121 | result[i] = list[i]->ToSU();
122 | }
123 | return result;
124 | }
125 |
126 | static List^ GetEntityEdges(SUEntitiesRef entities)
127 | {
128 | List^ edges = gcnew List();
129 |
130 | // Get Edges
131 | size_t edgeCount = 0;
132 | SUEntitiesGetNumEdges(entities, false, &edgeCount);
133 |
134 | if (edgeCount > 0)
135 | {
136 | std::vector edgevector(edgeCount);
137 | SUEntitiesGetEdges(entities, false, edgeCount, &edgevector[0], &edgeCount);
138 |
139 |
140 | for (size_t i = 0; i < edgeCount; i++) {
141 | Edge^ edge = Edge::FromSU(edgevector[i]);
142 | edges->Add(edge);
143 | }
144 | }
145 |
146 | return edges;
147 | }
148 |
149 |
150 | };
151 |
152 |
153 |
154 |
155 | }
--------------------------------------------------------------------------------
/SketchUpNET/Edge.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | SketchUpNET - a C++ Wrapper for the Trimble(R) SketchUp(R) C API
4 | Copyright(C) 2015, Autor: Maximilian Thumfart
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software
7 | and associated documentation files (the "Software"), to deal in the Software without restriction,
8 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
20 | */
21 | #include "Edge.cpp"
--------------------------------------------------------------------------------
/SketchUpNET/Group.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | SketchUpNET - a C++ Wrapper for the Trimble(R) SketchUp(R) C API
4 | Copyright(C) 2015, Autor: Maximilian Thumfart
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software
7 | and associated documentation files (the "Software"), to deal in the Software without restriction,
8 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
20 | */
21 | #include "Group.cpp"
--------------------------------------------------------------------------------
/SketchUpNET/Instance.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | SketchUpNET - a C++ Wrapper for the Trimble(R) SketchUp(R) C API
4 | Copyright(C) 2015, Autor: Maximilian Thumfart
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software
7 | and associated documentation files (the "Software"), to deal in the Software without restriction,
8 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
20 | */
21 | #pragma once
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 | #include
37 | #include "transform.h"
38 | #include "utilities.h"
39 | #include "Material.h"
40 |
41 | using namespace System;
42 | using namespace System::Collections;
43 | using namespace System::Collections::Generic;
44 |
45 | namespace SketchUpNET
46 | {
47 | public ref class Instance
48 | {
49 | public:
50 | System::String^ Name;
51 | Transform^ Transformation;
52 | String^ ParentID;
53 | System::String^ Guid;
54 | System::Object^ Parent;
55 | System::String^ Layer;
56 | SketchUpNET::Material^ Material;
57 |
58 | Instance(System::String^ name, System::String^ guid, String^ parent, Transform^ transformation, System::String^ layername, SketchUpNET::Material^ mat)
59 | {
60 | this->Name = name;
61 | this->Transformation = transformation;
62 | this->ParentID = parent;
63 | this->Guid = guid;
64 | this->Layer = layername;
65 | this->Material = mat;
66 | };
67 |
68 |
69 | Instance(){};
70 | internal:
71 | static Instance^ FromSU(SUComponentInstanceRef comp, System::Collections::Generic::Dictionary^ materials)
72 | {
73 | SUStringRef name = SU_INVALID;
74 | SUStringCreate(&name);
75 | SUComponentInstanceGetName(comp, &name);
76 |
77 | SUComponentDefinitionRef definition = SU_INVALID;
78 | SUComponentInstanceGetDefinition(comp, &definition);
79 |
80 | SUStringRef instanceguid = SU_INVALID;
81 | SUStringCreate(&instanceguid);
82 | SUComponentInstanceGetGuid(comp, &instanceguid);
83 |
84 |
85 | SUMaterialRef mat = SU_INVALID;
86 | SUDrawingElementGetMaterial(SUComponentInstanceToDrawingElement(comp), &mat);
87 | SUStringRef matNameRef = SU_INVALID;
88 | SUStringCreate(&matNameRef);
89 | SUMaterialGetName(mat, &matNameRef);
90 | System::String^ matName = SketchUpNET::Utilities::GetString(matNameRef);
91 | SketchUpNET::Material^ groupMat = (materials->ContainsKey(matName)) ? materials[matName] : SketchUpNET::Material::FromSU(mat);
92 |
93 |
94 | // Layer
95 | SULayerRef layer = SU_INVALID;
96 | SUDrawingElementGetLayer(SUComponentInstanceToDrawingElement(comp), &layer);
97 |
98 | System::String^ layername = gcnew System::String("");
99 | if (!SUIsInvalid(layer))
100 | {
101 | layername = Utilities::GetLayerName(layer);
102 | }
103 |
104 | SUStringRef guid = SU_INVALID;
105 | SUStringCreate(&guid);
106 | SUComponentDefinitionGetGuid(definition, &guid);
107 | System::String^ guidstring = SketchUpNET::Utilities::GetString(guid);
108 |
109 | String^ parent = guidstring;
110 |
111 |
112 | SUTransformation transform = SU_INVALID;
113 | SUComponentInstanceGetTransform(comp, &transform);
114 |
115 |
116 | Instance^ v = gcnew Instance(SketchUpNET::Utilities::GetString(name), SketchUpNET::Utilities::GetString(instanceguid), parent, Transform::FromSU(transform), layername, groupMat);
117 |
118 | return v;
119 | };
120 | static List^ GetEntityInstances(SUEntitiesRef entities, System::Collections::Generic::Dictionary^ materials)
121 | {
122 | List^ instancelist = gcnew List();
123 |
124 | //Get All Component Instances
125 |
126 | size_t instanceCount = 0;
127 | SUEntitiesGetNumInstances(entities, &instanceCount);
128 |
129 | if (instanceCount > 0) {
130 | std::vector instances(instanceCount);
131 | SUEntitiesGetInstances(entities, instanceCount, &instances[0], &instanceCount);
132 |
133 | for (size_t i = 0; i < instanceCount; i++) {
134 | Instance^ inst = Instance::FromSU(instances[i], materials);
135 | instancelist->Add(inst);
136 | }
137 |
138 | }
139 |
140 | return instancelist;
141 | }
142 | };
143 |
144 |
145 | }
--------------------------------------------------------------------------------
/SketchUpNET/Instance.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | SketchUpNET - a managed C++ Wrapper for the SketchUp C API
4 | Copyright(C) 2015, Autor: Maximilian Thumfart
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software
7 | and associated documentation files (the "Software"), to deal in the Software without restriction,
8 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
20 | */
21 | #include "Instance.cpp"
--------------------------------------------------------------------------------
/SketchUpNET/Layer.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | SketchUpNET - a C++ Wrapper for the Trimble(R) SketchUp(R) C API
4 | Copyright(C) 2015, Autor: Maximilian Thumfart
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software
7 | and associated documentation files (the "Software"), to deal in the Software without restriction,
8 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
20 | */
21 |
22 | #pragma once
23 |
24 | #include