c4d.modules.snap¶
-
class
c4d.modules.
snap
¶
This is the snap module to access the snap settings, quantizing options, workplane etc.
You can find various examples in the following GitHub repository.
New in version R14.034.
Functions Signatures
Check if snap is enabled for the document doc or for a specific snapmode. |
|
Set the snap enabled status for the document doc or a particular snapmode. |
|
Get the snap settings for the document doc or a specific snapmode. |
|
Set the snap settings for the document doc or a specific snapmode. |
|
Check if quantizing is enabled for the document doc. |
|
Gets a quantize step value. |
|
Sets a quantize step value. |
|
Retrieve the workplane object for document doc. |
|
Get the workplane locked status for document doc. |
|
Set the workplane locked status. |
|
Get the workplane matrix. |
Functions Documentation
-
c4d.modules.snap.
IsSnapEnabled
(doc, snapmode=NOTOK)¶ 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 (Optional[int]) –
Optionnally set a snap mode instead of checking snap for the document. One of the following:
SNAPMODE_POINT
Snap to a vertex on a mesh.
SNAPMODE_EDGE
Snap to any point along an edge.
SNAPMODE_POLYGON
Snap to the surface of a polygon.
SNAPMODE_SPLINE
Snap to any point along a spline.
SNAPMODE_AXIS
Snap to the axis of an object.
SNAPMODE_INTERSECTION
Snap to the intersections of objects and guides.
SNAPMODE_MIDPOINT
Snap to midpoint. Allows sub-snapping.
SNAPMODE_EDGEMID
Snap to middle of an edge.
SNAPMODE_POLYGONCENTER
Snap to the center of individual polygons.
SNAPMODE_SPLINEMID
Snap to the middle of a spline segment.
SNAPMODE_WORKPLANE
Snap to the surface of the workplane.
SNAPMODE_GRIDPOINT
Snap to the intersection points of the grid on the workplane.
SNAPMODE_GRIDLINE
Snap to the grid lines on the workplane.
SNAPMODE_GUIDEMID
Snap to the mid point in between of static guides intersections.
SNAPMODE_GUIDE
Snap to guide obejcts.
SNAPMODE_DYNAMICGUIDE
Snap using dynamic or inferred guides.
SNAPMODE_ORTHO
Snap perpendicular to guides edges and splines.
SNAPMODE_PIXEL
Snap to the texture’s pixels in the UV viewport.
- Return type
bool
- Returns
True if snap is enabled, otherwise False.
-
c4d.modules.snap.
EnableSnap
(state, doc, snapmode=NOTOK)¶ 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 (Optional[int]) –
Optionnally set a snap mode instead of enabling snap for the document. One of the following:
SNAPMODE_POINT
Snap to a vertex on a mesh.
SNAPMODE_EDGE
Snap to any point along an edge.
SNAPMODE_POLYGON
Snap to the surface of a polygon.
SNAPMODE_SPLINE
Snap to any point along a spline.
SNAPMODE_AXIS
Snap to the axis of an object.
SNAPMODE_INTERSECTION
Snap to the intersections of objects and guides.
SNAPMODE_MIDPOINT
Snap to midpoint. Allows sub-snapping.
SNAPMODE_EDGEMID
Snap to middle of an edge.
SNAPMODE_POLYGONCENTER
Snap to the center of individual polygons.
SNAPMODE_SPLINEMID
Snap to the middle of a spline segment.
SNAPMODE_WORKPLANE
Snap to the surface of the workplane.
SNAPMODE_GRIDPOINT
Snap to the intersection points of the grid on the workplane.
SNAPMODE_GRIDLINE
Snap to the grid lines on the workplane.
SNAPMODE_GUIDEMID
Snap to the mid point in between of static guides intersections.
SNAPMODE_GUIDE
Snap to guide obejcts.
SNAPMODE_DYNAMICGUIDE
Snap using dynamic or inferred guides.
SNAPMODE_ORTHO
Snap perpendicular to guides edges and splines.
SNAPMODE_PIXEL
Snap to the texture’s pixels in the UV viewport.
-
c4d.modules.snap.
GetSnapSettings
(doc, snapmode=NOTOK)¶ 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 (Optional[int]) –
Specify a snap mode to get or modify its specific settings instead of the global settings (pass NOTOK). One of the following:
SNAPMODE_POINT
Snap to a vertex on a mesh.
SNAPMODE_EDGE
Snap to any point along an edge.
SNAPMODE_POLYGON
Snap to the surface of a polygon.
SNAPMODE_SPLINE
Snap to any point along a spline.
SNAPMODE_AXIS
Snap to the axis of an object.
SNAPMODE_INTERSECTION
Snap to the intersections of objects and guides.
SNAPMODE_MIDPOINT
Snap to midpoint. Allows sub-snapping.
SNAPMODE_EDGEMID
Snap to middle of an edge.
SNAPMODE_POLYGONCENTER
Snap to the center of individual polygons.
SNAPMODE_SPLINEMID
Snap to the middle of a spline segment.
SNAPMODE_WORKPLANE
Snap to the surface of the workplane.
SNAPMODE_GRIDPOINT
Snap to the intersection points of the grid on the workplane.
SNAPMODE_GRIDLINE
Snap to the grid lines on the workplane.
SNAPMODE_GUIDEMID
Snap to the mid point in between of static guides intersections.
SNAPMODE_GUIDE
Snap to guide obejcts.
SNAPMODE_DYNAMICGUIDE
Snap using dynamic or inferred guides.
SNAPMODE_ORTHO
Snap perpendicular to guides edges and splines.
SNAPMODE_PIXEL
Snap to the texture’s pixels in the UV viewport.
- Return type
- Returns
A copy of the settings in a
BaseContainer
. The snap settings IDs are:SNAP_SETTINGS_ENABLED
bool
Enable snapping.
SNAP_SETTINGS_RADIUS
float
Snap radius.
SNAP_SETTINGS_TOOL
bool
Tool specific.
SNAP_SETTINGS_GUIDEANGLE
float
Guide angle.
SNAP_SETTINGS_MODE
int
Mode:
SNAP_SETTINGS_MODE_AUTO
Auto snapping.
SNAP_SETTINGS_MODE_2D
2D snapping.
SNAP_SETTINGS_MODE_3D
3D snapping.
SNAP_SETTINGS_PIXELMODE
int
Mode:
SNAP_SETTINGS_PIXELMODE_CENTER
Snap to the center of the pixels.
SNAP_SETTINGS_PIXELMODE_EDGE
Snap to the top left corner of the pixel.
QUANTIZE_ENABLED
bool
Enable quantizing.
QUANTIZE_GRID
bool
Set quantize move step to use the grid size.
QUANTIZE_MOVE
float
Movement.
QUANTIZE_ROTATE
float
Rotation.
QUANTIZE_SCALE
float
Scaling.
QUANTIZE_TEXTURE
float
Texture.
-
c4d.modules.snap.
SetSnapSettings
(doc, bc, snapmode=NOTOK)¶ 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. The snap settings IDs are:SNAP_SETTINGS_ENABLED
bool
Enable snapping.
SNAP_SETTINGS_RADIUS
float
Snap radius.
SNAP_SETTINGS_TOOL
bool
Tool specific.
SNAP_SETTINGS_GUIDEANGLE
float
Guide angle.
SNAP_SETTINGS_MODE
int
Mode:
SNAP_SETTINGS_MODE_AUTO
Auto snapping.
SNAP_SETTINGS_MODE_2D
2D snapping.
SNAP_SETTINGS_MODE_3D
3D snapping.
SNAP_SETTINGS_PIXELMODE
int
Mode:
SNAP_SETTINGS_PIXELMODE_CENTER
Snap to the center of the pixels.
SNAP_SETTINGS_PIXELMODE_EDGE
Snap to the top left corner of the pixel.
QUANTIZE_ENABLED
bool
Enable quantizing.
QUANTIZE_GRID
bool
Set quantize move step to use the grid size.
QUANTIZE_MOVE
float
Movement.
QUANTIZE_ROTATE
float
Rotation.
QUANTIZE_SCALE
float
Scaling.
QUANTIZE_TEXTURE
float
Texture.
snapmode (Optional[int]) –
Deprecated since version R25.010.
-
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)¶ Gets a quantize step value.
- Parameters
doc (c4d.documents.BaseDocument) – The document.
bd (Optional[c4d.BaseDraw]) – Currently not used. Pass None.
quantize_mode (int) –
The mode to retrieve the value for:
QUANTIZE_GRID
bool
Set quantize move step to use the grid size.
QUANTIZE_MOVE
float
Movement.
QUANTIZE_ROTATE
float
Rotation.
QUANTIZE_SCALE
float
Scaling.
QUANTIZE_TEXTURE
float
Texture.
-
c4d.modules.snap.
SetQuantizeStep
(doc, bd, quantize_mode, val)¶ Sets a quantize step value.
- Parameters
doc (c4d.documents.BaseDocument) – The document.
bd (Optional[c4d.BaseDraw]) – Currently not used. Pass None.
quantize_mode (int) –
The mode to set the value for:
QUANTIZE_GRID
bool
Set quantize move step to use the grid size.
QUANTIZE_MOVE
float
Movement.
QUANTIZE_ROTATE
float
Rotation.
QUANTIZE_SCALE
float
Scaling.
QUANTIZE_TEXTURE
float
Texture.
val (float) – The quantize step value to set.
-
c4d.modules.snap.
GetWorkplaneObject
(doc)¶ Retrieve the workplane object for document doc.
- Parameters
doc (c4d.documents.BaseDocument) – The document.
- Return type
- 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
doc (c4d.documents.BaseDocument) – The document.
bd (Optional[c4d.BaseDraw]) – The viewport you want to get the workplane’s matrix from. If None the locked matrix is returned independently from view.
- Return type
- Returns
The workplane matrix.