SketchUp C API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
geometry_input.h File Reference
#include <SketchUpAPI/geometry.h>
#include <SketchUpAPI/common.h>
#include <SketchUpAPI/model/defs.h>
#include <SketchUpAPI/model/curve.h>

Go to the source code of this file.

Data Structures

struct  SUMaterialInput
 SUMaterialInput contains information that is needed to apply a material to a face. The conventional method for applying a material to a face is to use 1 to 4 UV coordinates, which are Cartesian textures coordinates and corresponding vertex indices on the face. The vertices are referenced by index into the top level SUGeometryInputRef's vertex array. The member variable 'material' must be a valid material object, and once the material input is used (e.g. with /ref SUEntitiesFill), the material object must not be released since it will be associated with a parent object. More...
 

Functions

SU_RESULT SUGeometryInputCreate (SUGeometryInputRef *geom_input)
 Creates a geometry input object. More...
 
SU_RESULT SUGeometryInputRelease (SUGeometryInputRef *geom_input)
 Deallocates a geometry input object. More...
 
SU_RESULT SUGeometryInputAddVertex (SUGeometryInputRef geom_input, const struct SUPoint3D *point)
 Adds a vertex to a geometry input object. More...
 
SU_RESULT SUGeometryInputSetVertices (SUGeometryInputRef geom_input, size_t num_vertices, const struct SUPoint3D points[])
 Sets all vertices of a geometry input object. Any existing vertices will be overridden. More...
 
SU_RESULT SUGeometryInputAddEdge (SUGeometryInputRef geom_input, size_t vertex0_index, size_t vertex1_index, size_t *added_edge_index)
 Adds an edge to a geometry input object. This method is intended for specifying edges which are not associated with loop inputs. For specifying edge properties on a face use the SULoopInput interface. More...
 
SU_RESULT SUGeometryInputEdgeSetHidden (SUGeometryInputRef geom_input, size_t edge_index, bool hidden)
 Sets the hidden flag of an edge in a geometry input object which is not associated with a loop input. More...
 
SU_RESULT SUGeometryInputEdgeSetSoft (SUGeometryInputRef geom_input, size_t edge_index, bool soft)
 Sets the soft flag of an edge in a geometry input object which is not associated with a loop input. More...
 
SU_RESULT SUGeometryInputEdgeSetSmooth (SUGeometryInputRef geom_input, size_t edge_index, bool smooth)
 Sets the smooth flag of an edge in a geometry input object which is not associated with a loop input. More...
 
SU_RESULT SUGeometryInputEdgeSetMaterial (SUGeometryInputRef geom_input, size_t edge_index, SUMaterialRef material)
 Sets the material of an edge in the geometry input. More...
 
SU_RESULT SUGeometryInputEdgeSetLayer (SUGeometryInputRef geom_input, size_t edge_index, SULayerRef layer)
 Sets the layer of an edge in the geometry input. More...
 
SU_RESULT SUGeometryInputAddCurve (SUGeometryInputRef geom_input, size_t num_edges, const size_t edge_indices[], size_t *added_curve_index)
 Adds a curve to a geometry input object. This method is intended for specifying curves which are not associated with loop inputs. For specifying curves on faces use the SULoopInput interface. More...
 
SU_RESULT SUGeometryInputAddArcCurve (SUGeometryInputRef geom_input, size_t start_point, size_t end_point, const struct SUPoint3D *center, const struct SUVector3D *normal, size_t num_segments, size_t *added_curve_index, size_t *control_edge_index)
 Adds an arccurve to a geometry input object. In addition to adding an arccurve to the geometry input this method will append num_segments edges to the geometry's edge collection where control_edge_index is the index of the first new edge. Also, num_segments-1 vertices along the arc will be appended to the geometry's collection of verttices. In order to include an arccurve in a loop the user only needs add the arccurve's points to a loop using SULoopInputAddVertexIndex. More...
 
SU_RESULT SULoopInputCreate (SULoopInputRef *loop_input)
 Creates a loop input object. More...
 
SU_RESULT SULoopInputRelease (SULoopInputRef *loop_input)
 Deallocates a loop input object. More...
 
SU_RESULT SULoopInputAddVertexIndex (SULoopInputRef loop_input, size_t vertex_index)
 Adds a vertex index to a loop input object. More...
 
SU_RESULT SULoopInputEdgeSetHidden (SULoopInputRef loop_input, size_t edge_index, bool hidden)
 Sets the hidden flag of an edge in a loop input object. More...
 
SU_RESULT SULoopInputEdgeSetSoft (SULoopInputRef loop_input, size_t edge_index, bool soft)
 Sets the soft flag of an edge in a loop input object. More...
 
SU_RESULT SULoopInputEdgeSetSmooth (SULoopInputRef loop_input, size_t edge_index, bool smooth)
 Sets the smooth flag of an edge in a loop input object. More...
 
SU_RESULT SULoopInputEdgeSetMaterial (SULoopInputRef loop_input, size_t edge_index, SUMaterialRef material)
 Sets the material of an edge in the loop input. More...
 
SU_RESULT SULoopInputEdgeSetLayer (SULoopInputRef loop_input, size_t edge_index, SULayerRef layer)
 Sets the layer of an edge in the loop input. More...
 
SU_RESULT SULoopInputAddCurve (SULoopInputRef loop_input, size_t first_edge_index, size_t last_edge_index)
 Adds a simple curve to a loop input object. More...
 
SU_RESULT SULoopInputIsClosed (SULoopInputRef loop_input, bool *is_closed)
 Retrieves whether the loop input is closed. A loop input can be closed either by re-adding the start vertex to the end of the loop using SULoopInputAddVertexIndex or by adding a curve to the loop input which connects the loop's start and end points using SULoopInputAddCurve. More...
 
SU_RESULT SUGeometryInputAddFace (SUGeometryInputRef geom_input, SULoopInputRef *outer_loop, size_t *added_face_index)
 Adds a face to a geometry input object with a given outer loop for the face. More...
 
SU_RESULT SUGeometryInputFaceSetReverse (SUGeometryInputRef geom_input, size_t face_index, bool reverse)
 Sets a flag in the geometry input that, when true, will create a face by reversing the orientations of all of its loops. More...
 
SU_RESULT SUGeometryInputFaceSetLayer (SUGeometryInputRef geom_input, size_t face_index, SULayerRef layer)
 Sets the layer of a face in the geometry input. More...
 
SU_RESULT SUGeometryInputFaceAddInnerLoop (SUGeometryInputRef geom_input, size_t face_index, SULoopInputRef *loop_input)
 Adds an inner loop to a face in the geometry input. More...
 
SU_RESULT SUGeometryInputFaceSetFrontMaterial (SUGeometryInputRef geom_input, size_t face_index, const struct SUMaterialInput *material_input)
 Sets the front material of a face in the geometry input. More...
 
SU_RESULT SUGeometryInputFaceSetBackMaterial (SUGeometryInputRef geom_input, size_t face_index, const struct SUMaterialInput *material_input)
 Sets the back material of a face in the geometry input. More...
 
SU_RESULT SUGeometryInputFaceSetHidden (SUGeometryInputRef geom_input, size_t face_index, bool hidden)
 Sets a flag in the geometry input that, when true, will create a hidden face. More...
 
SU_RESULT SUGeometryInputGetCounts (SUGeometryInputRef geom_input, size_t *vertices_count, size_t *faces_count, size_t *edge_count, size_t *curve_count, size_t *arc_count)
 Returns all the various geometry counts. More...
 

Function Documentation

SU_RESULT SUGeometryInputAddArcCurve ( SUGeometryInputRef  geom_input,
size_t  start_point,
size_t  end_point,
const struct SUPoint3D center,
const struct SUVector3D normal,
size_t  num_segments,
size_t *  added_curve_index,
size_t *  control_edge_index 
)

Adds an arccurve to a geometry input object. In addition to adding an arccurve to the geometry input this method will append num_segments edges to the geometry's edge collection where control_edge_index is the index of the first new edge. Also, num_segments-1 vertices along the arc will be appended to the geometry's collection of verttices. In order to include an arccurve in a loop the user only needs add the arccurve's points to a loop using SULoopInputAddVertexIndex.

Since
SketchUp 2017 M2, API 5.2
Parameters
[in]geom_inputThe geometry input object.
[in]start_pointThe index of the vertex at the start of the arc.
[in]end_pointThe index of the vertex at the end of the arc.
[in]centerThe center point of the arc's circle.
[in]normalThe normal vector of the arc plane.
[in]num_segmentsThe number of edges for the arc.
[out]added_curve_index(optional) If not NULL, returns the index of the added curve.
[out]control_edge_index(optional) If not NULL, returns the index of the the arc's control edge which can be used to set the arc's edge properties.
Returns
SU_RESULT SUGeometryInputAddCurve ( SUGeometryInputRef  geom_input,
size_t  num_edges,
const size_t  edge_indices[],
size_t *  added_curve_index 
)

Adds a curve to a geometry input object. This method is intended for specifying curves which are not associated with loop inputs. For specifying curves on faces use the SULoopInput interface.

Since
SketchUp 2017, API 5.0
Parameters
[in]geom_inputThe geometry input object.
[in]num_edgesThe number of edges to be used in the curve.
[in]edge_indicesThe edge indices to be used in defining the curve.
[out]added_curve_index(optional) If not NULL, returns the index of the added curve.
Returns
SU_RESULT SUGeometryInputAddEdge ( SUGeometryInputRef  geom_input,
size_t  vertex0_index,
size_t  vertex1_index,
size_t *  added_edge_index 
)

Adds an edge to a geometry input object. This method is intended for specifying edges which are not associated with loop inputs. For specifying edge properties on a face use the SULoopInput interface.

Since
SketchUp 2017, API 5.0
Parameters
[in]geom_inputThe geometry input object.
[in]vertex0_indexThe vertex index of the edge's first vertex.
[in]vertex1_indexThe vertex index of the edge's last vertex.
[out]added_edge_index(optional) If not NULL, returns the index of the added edge.
Returns
SU_RESULT SUGeometryInputAddFace ( SUGeometryInputRef  geom_input,
SULoopInputRef *  outer_loop,
size_t *  added_face_index 
)

Adds a face to a geometry input object with a given outer loop for the face.

Warning
*** Breaking Change: The behavior of this method was changed in SketchUp 2017 M2, API 5.2. An additional error code was added (SU_ERROR_INVALID_ARGUMENT) to indicate to users when the loop contains invalid data.
Parameters
[in]geom_inputThe geometry input object.
[in]outer_loopThe outer loop to be set for the face. If the function succeeds (i.e. returns SU_ERROR_NONE), this loop will be deallocated.
[out]added_face_index(optional) If not NULL, returns the index of the added face.
Returns
SU_RESULT SUGeometryInputAddVertex ( SUGeometryInputRef  geom_input,
const struct SUPoint3D point 
)

Adds a vertex to a geometry input object.

Parameters
[in]geom_inputThe geometry input object.
[in]pointThe location of the vertex to be added.
Returns
SU_RESULT SUGeometryInputCreate ( SUGeometryInputRef geom_input)

Creates a geometry input object.

Parameters
[out]geom_inputThe object created. This object can be passed into SUEntitiesFill to populate an entities object. It should be released subsequently by calling SUGeometryInputRelease.
Returns
SU_RESULT SUGeometryInputEdgeSetHidden ( SUGeometryInputRef  geom_input,
size_t  edge_index,
bool  hidden 
)

Sets the hidden flag of an edge in a geometry input object which is not associated with a loop input.

Since
SketchUp 2017, API 5.0
Parameters
[in]geom_inputThe geometry input object.
[in]edge_indexThe zero-based index of the edge which is not associated with a loop input.
[in]hiddenThe flag to set.
Returns
SU_RESULT SUGeometryInputEdgeSetLayer ( SUGeometryInputRef  geom_input,
size_t  edge_index,
SULayerRef  layer 
)

Sets the layer of an edge in the geometry input.

Since
SketchUp 2017, API 5.0
Parameters
[in]geom_inputThe geometry input object.
[in]edge_indexIndex of the edge to set the layer.
[in]layerThe layer to be set.
Returns
SU_RESULT SUGeometryInputEdgeSetMaterial ( SUGeometryInputRef  geom_input,
size_t  edge_index,
SUMaterialRef  material 
)

Sets the material of an edge in the geometry input.

Since
SketchUp 2017, API 5.0
Parameters
[in]geom_inputThe geometry input object.
[in]edge_indexIndex of the edge to set the material.
[in]materialThe material to be set.
Returns
SU_RESULT SUGeometryInputEdgeSetSmooth ( SUGeometryInputRef  geom_input,
size_t  edge_index,
bool  smooth 
)

Sets the smooth flag of an edge in a geometry input object which is not associated with a loop input.

Since
SketchUp 2017, API 5.0
Parameters
[in]geom_inputThe geometry input object.
[in]edge_indexThe zero-based index of the edge which is not associated with a loop input.
[in]smoothThe flag to set.
Returns
SU_RESULT SUGeometryInputEdgeSetSoft ( SUGeometryInputRef  geom_input,
size_t  edge_index,
bool  soft 
)

Sets the soft flag of an edge in a geometry input object which is not associated with a loop input.

Since
SketchUp 2017, API 5.0
Parameters
[in]geom_inputThe geometry input object.
[in]edge_indexThe zero-based index of the edge which is not associated with a loop input.
[in]softThe flag to set.
Returns
SU_RESULT SUGeometryInputFaceAddInnerLoop ( SUGeometryInputRef  geom_input,
size_t  face_index,
SULoopInputRef *  loop_input 
)

Adds an inner loop to a face in the geometry input.

Warning
*** Breaking Change: The behavior of this method was changed in SketchUp 2017 M2, API 5.2. An additional error code was added (SU_ERROR_INVALID_ARGUMENT) to indicate to users when the loop contains invalid data.
Parameters
[in]geom_inputThe geometry input object.
[in]face_indexIndex of the face to receive the inner loop.
[in]loop_inputThe inner loop to be added. If the function succeeds (i.e. returns SU_ERROR_NONE), this loop will be deallocated.
Returns
SU_RESULT SUGeometryInputFaceSetBackMaterial ( SUGeometryInputRef  geom_input,
size_t  face_index,
const struct SUMaterialInput material_input 
)

Sets the back material of a face in the geometry input.

Parameters
[in]geom_inputThe geometry input object.
[in]face_indexIndex of the face to receive the material.
[in]material_inputThe material input to set.
Returns
SU_RESULT SUGeometryInputFaceSetFrontMaterial ( SUGeometryInputRef  geom_input,
size_t  face_index,
const struct SUMaterialInput material_input 
)

Sets the front material of a face in the geometry input.

Parameters
[in]geom_inputThe geometry input object.
[in]face_indexIndex of the face to receive the material.
[in]material_inputThe material input to set.
Returns
SU_RESULT SUGeometryInputFaceSetHidden ( SUGeometryInputRef  geom_input,
size_t  face_index,
bool  hidden 
)

Sets a flag in the geometry input that, when true, will create a hidden face.

Since
SketchUp 2017, API 5.0
Parameters
[in]geom_inputThe geometry input object.
[in]face_indexIndex of the face to be hidden.
[in]hiddenThe given hidden flag.
Returns
SU_RESULT SUGeometryInputFaceSetLayer ( SUGeometryInputRef  geom_input,
size_t  face_index,
SULayerRef  layer 
)

Sets the layer of a face in the geometry input.

Parameters
[in]geom_inputThe geometry input object.
[in]face_indexIndex of the face to be reversed.
[in]layerThe layer to be set.
Returns
SU_RESULT SUGeometryInputFaceSetReverse ( SUGeometryInputRef  geom_input,
size_t  face_index,
bool  reverse 
)

Sets a flag in the geometry input that, when true, will create a face by reversing the orientations of all of its loops.

Parameters
[in]geom_inputThe geometry input object.
[in]face_indexIndex of the face to be reversed.
[in]reverseThe given reverse flag.
Returns
SU_RESULT SUGeometryInputGetCounts ( SUGeometryInputRef  geom_input,
size_t *  vertices_count,
size_t *  faces_count,
size_t *  edge_count,
size_t *  curve_count,
size_t *  arc_count 
)

Returns all the various geometry counts.

Since
SketchUp 2018, API 6.0
Parameters
[in]geom_inputThe geometry input object.
[out]vertices_countThe total count of vertices.
[out]faces_countThe total count of faces.
[out]edge_countThe total count of edges.
[out]curve_countThe total count of curves.
[out]arc_countThe total count of arcs.
Returns
SU_RESULT SUGeometryInputRelease ( SUGeometryInputRef geom_input)

Deallocates a geometry input object.

Parameters
[in]geom_inputThe object to deallocate.
Returns
SU_RESULT SUGeometryInputSetVertices ( SUGeometryInputRef  geom_input,
size_t  num_vertices,
const struct SUPoint3D  points[] 
)

Sets all vertices of a geometry input object. Any existing vertices will be overridden.

Parameters
[in]geom_inputThe geometry input object.
[in]num_verticesThe number of vertices in the given point array.
[in]pointsThe points array containing the location of vertices.
Returns
SU_RESULT SULoopInputAddCurve ( SULoopInputRef  loop_input,
size_t  first_edge_index,
size_t  last_edge_index 
)

Adds a simple curve to a loop input object.

Parameters
[in]loop_inputThe loop input object.
[in]first_edge_indexFirst edge index to be associated with the curve.
[in]last_edge_indexLast edge index to be associated with the curve.
Returns
SU_RESULT SULoopInputAddVertexIndex ( SULoopInputRef  loop_input,
size_t  vertex_index 
)

Adds a vertex index to a loop input object.

Warning
*** Breaking Change: The behavior of this method was changed in SketchUp 2017 M2, API 5.2. In previous releases this method returned SU_ERROR_INVALID_INPUT if the specified index was already anywhere in the loop. In SketchUp 2017 M1 the concept of an explicitly closed loop was introduced. A loop can be explicitly closed by either using this method to insert an index which is already at the beginning of the loop, or by adding a curve to the loop which connects the loop's start and end points using SULoopInputAddCurve. If a loop was not previously closed and SULoopInputAddVertexIndex is used to add the loop's start vertex, the loop will be closed and SU_ERROR_NONE will be returned. If attempts are made to add vertices after a loop has been explicitly closed SU_ERROR_UNSUPPORTED will be returned. If an attempt is made to add a vertex that already existed in an open loop not at the front SU_ERROR_INVALID_ARGUMENT will be returned.
Parameters
[in]loop_inputThe loop input object.
[in]vertex_indexThe vertex index to add. This references a vertex within the parent geometry input's vertex collection (as a zero- based index).
Returns
SU_RESULT SULoopInputCreate ( SULoopInputRef *  loop_input)

Creates a loop input object.

Parameters
[out]loop_inputThe object created.
Returns
SU_RESULT SULoopInputEdgeSetHidden ( SULoopInputRef  loop_input,
size_t  edge_index,
bool  hidden 
)

Sets the hidden flag of an edge in a loop input object.

Parameters
[in]loop_inputThe loop input object.
[in]edge_indexThe zero-based index of the edge within the loop.
[in]hiddenThe flag to set.
Returns
SU_RESULT SULoopInputEdgeSetLayer ( SULoopInputRef  loop_input,
size_t  edge_index,
SULayerRef  layer 
)

Sets the layer of an edge in the loop input.

Since
SketchUp 2017, API 5.0
Parameters
[in]loop_inputThe loop input object.
[in]edge_indexIndex of the edge to set the layer.
[in]layerThe layer to be set.
Returns
SU_RESULT SULoopInputEdgeSetMaterial ( SULoopInputRef  loop_input,
size_t  edge_index,
SUMaterialRef  material 
)

Sets the material of an edge in the loop input.

Since
SketchUp 2017, API 5.0
Parameters
[in]loop_inputThe loop input object.
[in]edge_indexIndex of the edge to set the material.
[in]materialThe material to be set.
Returns
SU_RESULT SULoopInputEdgeSetSmooth ( SULoopInputRef  loop_input,
size_t  edge_index,
bool  smooth 
)

Sets the smooth flag of an edge in a loop input object.

Parameters
[in]loop_inputThe loop input object.
[in]edge_indexThe zero-based index of the edge within the loop.
[in]smoothThe flag to set.
Returns
SU_RESULT SULoopInputEdgeSetSoft ( SULoopInputRef  loop_input,
size_t  edge_index,
bool  soft 
)

Sets the soft flag of an edge in a loop input object.

Parameters
[in]loop_inputThe loop input object.
[in]edge_indexThe zero-based index of the edge within the loop.
[in]softThe flag to set.
Returns
SU_RESULT SULoopInputIsClosed ( SULoopInputRef  loop_input,
bool *  is_closed 
)

Retrieves whether the loop input is closed. A loop input can be closed either by re-adding the start vertex to the end of the loop using SULoopInputAddVertexIndex or by adding a curve to the loop input which connects the loop's start and end points using SULoopInputAddCurve.

Since
SketchUp 2017 M2, API 5.2
Parameters
[in]loop_inputThe loop input object.
[out]is_closedThe flag retrieved (true if the loop is closed).
Returns
SU_RESULT SULoopInputRelease ( SULoopInputRef *  loop_input)

Deallocates a loop input object.

Parameters
[in]loop_inputThe object to deallocate.
Returns