SketchUp C API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Related Functions
SUSnapRef Struct Reference

References a snap. More...

#include <SketchUpAPI/model/snap.h>

Inherits SUDrawingElementRef.

Related Functions

(Note that these are not member functions.)

SUEntityRef SUSnapToEntity (SUSnapRef snap)
 Converts from an SUSnapRef to an SUEntityRef. This is essentially an upcast operation. More...
 
SUSnapRef SUSnapFromEntity (SUEntityRef entity)
 Converts from an SUEntityRef to an SUSnapRef. This is essentially a downcast operation so the given entity must be convertible to an SUSnapRef. More...
 
SUDrawingElementRef SUSnapToDrawingElement (SUSnapRef snap)
 Converts from an SUSnapRef to an SUDrawingElementRef. This is essentially an upcast operation. More...
 
SUSnapRef SUSnapFromDrawingElement (SUDrawingElementRef drawing_elem)
 Converts from an SUDrawingElementRef to an SUSnapRef. This is essentially a downcast operation so the given element must be convertible to an SUSnapRef. More...
 
enum SUResult SUSnapCreate (SUSnapRef *snap, const struct SUPoint3D position, const struct SUVector3D *direction, const struct SUVector3D *up)
 Creates a snap at the given position and orientation. More...
 
enum SUResult SUSnapRelease (SUSnapRef *snap)
 Releases a snap object and its associated resources. More...
 
enum SUResult SUSnapGetPosition (SUSnapRef snap, struct SUPoint3D *position)
 Retrieves the position of a snap. More...
 
enum SUResult SUSnapGetDirection (SUSnapRef snap, struct SUVector3D *direction)
 Retrieves the orientation of a snap. More...
 
enum SUResult SUSnapGetUp (SUSnapRef snap, struct SUVector3D *up)
 Retrieves the up vector of a snap. More...
 
enum SUResult SUSnapSet (SUSnapRef snap, const struct SUPoint3D position, const struct SUVector3D *direction, const struct SUVector3D *up)
 Sets the position, direction and up vector of the snap. More...
 

Detailed Description

References a snap.

Since
SketchUp 2025.0, API 13.0

A Snap is a custom grip used by SketchUp's Move tool. Snaps can be added at strategic places such as connectors to help assembling objects.

snaps.png

SUSnapGetDirection() is the direction a snap is "pointing". This can be thought of as the normal direction of the snap. It can also be thought of as the direction you move an object when plugging it into another object, e.g. inserting a power coord.

SUSnapGetUp() controls the rotation around the Snap's axis.

When two objects are snapped together, the Snaps have opposite SUSnapGetDirection() vectors but matching SUSnapGetUp() vectors.

Friends And Related Function Documentation

enum SUResult SUSnapCreate ( SUSnapRef snap,
const struct SUPoint3D  position,
const struct SUVector3D direction,
const struct SUVector3D up 
)
related

Creates a snap at the given position and orientation.

Since
SketchUp 2025.0, API 13.0
Parameters
[out]snapThe snap object created.
[in]positionThe position of the snap.
[in]directionThe orientation of the snap. Pass NULL to use the default orientation.
[in]upThe up vector controls the rotation around the orientation of the snap. Pass NULL to use the default up vector.
Returns
SUSnapRef SUSnapFromDrawingElement ( SUDrawingElementRef  drawing_elem)
related

Converts from an SUDrawingElementRef to an SUSnapRef. This is essentially a downcast operation so the given element must be convertible to an SUSnapRef.

Since
SketchUp 2025.0, API 13.0
Parameters
[in]drawing_elemThe given element reference.
Returns
  • The converted SUSnapRef if the downcast operation succeeds
  • If not, the returned reference will be invalid
SUSnapRef SUSnapFromEntity ( SUEntityRef  entity)
related

Converts from an SUEntityRef to an SUSnapRef. This is essentially a downcast operation so the given entity must be convertible to an SUSnapRef.

Since
SketchUp 2025.0, API 13.0
Parameters
[in]entityThe given entity reference.
Returns
  • The converted SUSnapRef if the downcast operation succeeds
  • If not, the returned reference will be invalid
enum SUResult SUSnapGetDirection ( SUSnapRef  snap,
struct SUVector3D direction 
)
related

Retrieves the orientation of a snap.

Since
SketchUp 2025.0, API 13.0
Parameters
[in]snapThe snap object.
[out]directionThe direction of the snap.
Returns
enum SUResult SUSnapGetPosition ( SUSnapRef  snap,
struct SUPoint3D position 
)
related

Retrieves the position of a snap.

Since
SketchUp 2025.0, API 13.0
Parameters
[in]snapThe snap object.
[out]positionThe position retrieved.
Returns
enum SUResult SUSnapGetUp ( SUSnapRef  snap,
struct SUVector3D up 
)
related

Retrieves the up vector of a snap.

Since
SketchUp 2025.0, API 13.0
Parameters
[in]snapThe snap object.
[out]upThe up vector of the snap.
Returns
enum SUResult SUSnapRelease ( SUSnapRef snap)
related

Releases a snap object and its associated resources.

Since
SketchUp 2025.0, API 13.0
Parameters
[in]snapThe snap object.
Returns
enum SUResult SUSnapSet ( SUSnapRef  snap,
const struct SUPoint3D  position,
const struct SUVector3D direction,
const struct SUVector3D up 
)
related

Sets the position, direction and up vector of the snap.

If only position is provided then direction and up remains unchanged.

Since
SketchUp 2025.0, API 13.0
Parameters
[in]snapThe snap object.
[in]positionThe position of the snap.
[in]directionThe orientation of the snap. Pass NULL to use the default orientation.
[in]upThe up vector of the snap. Pass NULL to use the default up vector.
Returns
SUDrawingElementRef SUSnapToDrawingElement ( SUSnapRef  snap)
related

Converts from an SUSnapRef to an SUDrawingElementRef. This is essentially an upcast operation.

Since
SketchUp 2025.0, API 13.0
Parameters
[in]snapThe given snap reference.
Returns
  • The converted SUEntityRef if snap is a valid snap.
  • If not, the returned reference will be invalid.
SUEntityRef SUSnapToEntity ( SUSnapRef  snap)
related

Converts from an SUSnapRef to an SUEntityRef. This is essentially an upcast operation.

Since
SketchUp 2025.0, API 13.0
Parameters
[in]snapThe given snap reference.
Returns
  • The converted SUEntityRef if snap is a valid snap.
  • If not, the returned reference will be invalid.

The documentation for this struct was generated from the following files: