c4d.modules.snap

Follow me to the Inheritance diagramm .

New in version R14.034.

This is the snap module to access the snap settings, quantizing options, workplane etc.

(You can find the following script in the examples )

Functions

c4d.modules.snap. IsSnapEnabled ( doc [ , snapmode ] )

Check if snap is enabled for the document doc or for a specific snapmode .

Parameters:
  • doc ( c4d.documents.BaseDocument ) – The document to test for.
  • snapmode ( int ) –

    Optionnally set a snap mode instead of checking snap for the document. One of the following:

    SNAPMODE_GUIDE Snap to guide objects.
    SNAPMODE_INTERSECTION Snap to the intersections of objects and guides.
    SNAPMODE_POINT Snap to a vertex on a mesh.
    SNAPMODE_SPLINE Snap to any point along a spline.
    SNAPMODE_DYNAMICGUIDE Snap using dynamic or “inferred” guides.
    SNAPMODE_SPLINEMID Snap to the middle of a spline segment.
    SNAPMODE_EDGE Snap to any point along an edge.
    SNAPMODE_EDGEMID Snap to the middle of an edge.
    SNAPMODE_POLYGON Snap to the surface of a polygon.
    SNAPMODE_POLYGONCENTER Snap to the center of individual polygons.
    SNAPMODE_WORKPLANE Snap to the surface of the workplane.
    SNAPMODE_AXIS Snap to the axis of an object.
    SNAPMODE_ORTHO Snap perpendicular to guides edges and splines.
    SNAPMODE_GRIDPOINT Snap to the intersection points of the grid on the workplane.
    SNAPMODE_GRIDLINE Snap to the grid lines on the workplane.
    SNAPMODE_MIDPOINT Snap for mid points. Allow subsnap for each parent mode that have it.
    SNAPMODE_GUIDEMID Snap the middle point in between of static guides interesections.
Return type:

bool

Returns:

True if snap is enabled, otherwise False .

c4d.modules.snap. EnableSnap ( state , doc [ , snapmode ] )

Set the snap enabled status for the document doc or a particular snapmode .

Parameters:
  • state ( bool ) – The state to set: True to enable, False to disable.
  • doc ( c4d.documents.BaseDocument ) – The document to set the snap mode state for.
  • snapmode ( int ) –

    Optionnally set a snap mode instead of enabling snap for the document. One of the following:

    SNAPMODE_GUIDE Snap to guide objects.
    SNAPMODE_INTERSECTION Snap to the intersections of objects and guides.
    SNAPMODE_POINT Snap to a vertex on a mesh.
    SNAPMODE_SPLINE Snap to any point along a spline.
    SNAPMODE_DYNAMICGUIDE Snap using dynamic or “inferred” guides.
    SNAPMODE_SPLINEMID Snap to the middle of a spline segment.
    SNAPMODE_EDGE Snap to any point along an edge.
    SNAPMODE_EDGEMID Snap to the middle of an edge.
    SNAPMODE_POLYGON Snap to the surface of a polygon.
    SNAPMODE_POLYGONCENTER Snap to the center of individual polygons.
    SNAPMODE_WORKPLANE Snap to the surface of the workplane.
    SNAPMODE_AXIS Snap to the axis of an object.
    SNAPMODE_ORTHO Snap perpendicular to guides edges and splines.
    SNAPMODE_GRIDPOINT Snap to the intersection points of the grid on the workplane.
    SNAPMODE_GRIDLINE Snap to the grid lines on the workplane.
    SNAPMODE_MIDPOINT Snap for mid points. Allow subsnap for each parent mode that have it.
    SNAPMODE_GUIDEMID Snap the middle point in between of static guides interesections.
c4d.modules.snap. GetSnapSettings ( doc [ , snapmode ] )

Get the snap settings for the document doc or a specific snapmode .

Parameters:
  • doc ( c4d.documents.BaseDocument ) – The document related snap settings to retrieve.
  • snapmode ( int ) –

    Specify a snap mode to get or modify its specific settings instead of the global settings (pass NOTOK ). One of the following:

    SNAPMODE_GUIDE Snap to guide objects.
    SNAPMODE_INTERSECTION Snap to the intersections of objects and guides.
    SNAPMODE_POINT Snap to a vertex on a mesh.
    SNAPMODE_SPLINE Snap to any point along a spline.
    SNAPMODE_DYNAMICGUIDE Snap using dynamic or “inferred” guides.
    SNAPMODE_SPLINEMID Snap to the middle of a spline segment.
    SNAPMODE_EDGE Snap to any point along an edge.
    SNAPMODE_EDGEMID Snap to the middle of an edge.
    SNAPMODE_POLYGON Snap to the surface of a polygon.
    SNAPMODE_POLYGONCENTER Snap to the center of individual polygons.
    SNAPMODE_WORKPLANE Snap to the surface of the workplane.
    SNAPMODE_AXIS Snap to the axis of an object.
    SNAPMODE_ORTHO Snap perpendicular to guides edges and splines.
    SNAPMODE_GRIDPOINT Snap to the intersection points of the grid on the workplane.
    SNAPMODE_GRIDLINE Snap to the grid lines on the workplane.
    SNAPMODE_MIDPOINT Snap for mid points. Allow subsnap for each parent mode that have it.
    SNAPMODE_GUIDEMID Snap the middle point in between of static guides interesections.
Return type:

c4d.BaseContainer

Returns:

A copy of the settings in a BaseContainer form. See dmodeling.h for more information on the returned container.

c4d.modules.snap. SetSnapSettings ( doc , bc [ , snapmode ] )

Set the snap settings for the document doc or a specific snapmode .

Parameters:
  • doc ( c4d.documents.BaseDocument ) – The document to set the snap settings for.
  • bc ( c4d.BaseContainer ) – The BaseContainer with the settings for the document doc and/or snapmode . See dmodeling.h for more information on the container.
  • snapmode ( int ) –

    Optionally specify the snap mode to set the settings for instead of the global settings. One of the following:

    SNAPMODE_GUIDE Snap to guide objects.
    SNAPMODE_INTERSECTION Snap to the intersections of objects and guides.
    SNAPMODE_POINT Snap to a vertex on a mesh.
    SNAPMODE_SPLINE Snap to any point along a spline.
    SNAPMODE_DYNAMICGUIDE Snap using dynamic or “inferred” guides.
    SNAPMODE_SPLINEMID Snap to the middle of a spline segment.
    SNAPMODE_EDGE Snap to any point along an edge.
    SNAPMODE_EDGEMID Snap to the middle of an edge.
    SNAPMODE_POLYGON Snap to the surface of a polygon.
    SNAPMODE_POLYGONCENTER Snap to the center of individual polygons.
    SNAPMODE_WORKPLANE Snap to the surface of the workplane.
    SNAPMODE_AXIS Snap to the axis of an object.
    SNAPMODE_ORTHO Snap perpendicular to guides edges and splines.
    SNAPMODE_GRIDPOINT Snap to the intersection points of the grid on the workplane.
    SNAPMODE_GRIDLINE Snap to the grid lines on the workplane.
    SNAPMODE_MIDPOINT Snap for mid points. Allow subsnap for each parent mode that have it.
    SNAPMODE_GUIDEMID Snap the middle point in between of static guides interesections.
c4d.modules.snap. IsQuantizeEnabled ( doc )

Check if quantizing is enabled for the document doc .

Parameters: doc ( c4d.documents.BaseDocument ) – The document to test for.
Return type: bool
Returns: True if quantizing is enabled, otherwise False .
c4d.modules.snap. GetQuantizeStep ( doc , bd , quantize_mode )

Get the quantize step values from QUANTIZE_MOVE , QUANTIZE_SCALE etc.

Parameters:
  • doc ( c4d.documents.BaseDocument ) – The document to get the values.
  • bd ( c4d.BaseDraw ) – The view that you want to retrieve the correct QUANTIZE_MOVE value for. Not relevant for other quantize modes (pass None ).
  • quantize_mode ( int ) – The mode you want to retrieve the value for, e.g. QUANTIZE_ROTATE , QUANTIZE_MOVE , QUANTIZE_SCALE or QUANTIZE_TEXTURE .
c4d.modules.snap. SetQuantizeStep ( doc , bd , quantize_mode , val )

Set the quantize step values for QUANTIZE_MOVE , QUANTIZE_SCALE etc.

Parameters:
  • doc ( c4d.documents.BaseDocument ) – The document to set the values.
  • bd ( c4d.BaseDraw ) – The view that you want to set the correct QUANTIZE_MOVE value for. Not relevant for other quantize modes (pass None ).
  • quantize_mode ( int ) – The mode you want to set the value for, e.g. QUANTIZE_ROTATE , QUANTIZE_MOVE , QUANTIZE_SCALE or QUANTIZE_TEXTURE .
  • val ( float ) – The new quantizing step value.
c4d.modules.snap. GetWorkplaneObject ( doc )

Retrieve the workplane object for document doc .

Parameters: doc ( c4d.documents.BaseDocument ) – The document.
Return type: c4d.BaseObject
Returns: The workplane object.
c4d.modules.snap. IsWorkplaneLock ( doc )

Get the workplane locked status for document doc .

Parameters: doc ( c4d.documents.BaseDocument ) – The document.
Return type: bool
Returns: True if the workplane is locked.
c4d.modules.snap. SetWorkplaneLock ( bd , locked )

Set the workplane locked status.

Parameters:
  • bd ( c4d.BaseDraw ) – The viewport to lock the workplane.
  • locked ( bool ) – True to lock the workplane.
c4d.modules.snap. GetWorkplaneMatrix ( doc , bd )

Get the workplane matrix.

Parameters:
Return type:

c4d.Matrix

Returns:

The workplane matrix.

Table Of Contents