user: Show practical ways to work with Bpy.Types.Geometrynodesamplenearest in a Blender add-on or script – include code.

assistant: GeometryNodeSampleNearest(GeometryNode) - Blender Python API Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Hide navigation sidebar Hide table of contents sidebar Skip to content Toggle site navigation sidebar Blender Python API Toggle Light / Dark / Auto color theme Toggle table of contents sidebar Blender Python API Documentation Quickstart API Overview API Reference Usage Best Practice Tips and Tricks Gotchas Toggle navigation of Gotchas Troubleshooting Errors & Crashes Python Threads are Not Supported Internal Data & Their Python Objects Using Operators Modes and Mesh Access Bones & Armatures File Paths & String Encoding Advanced Toggle navigation of Advanced Blender as a Python Module Change Log Application Modules Context Access (bpy.context) Data Access (bpy.data) Message Bus (bpy.msgbus) Operators (bpy.ops) Toggle navigation of Operators (bpy.ops) Action Operators Anim Operators Armature Operators Asset Operators Boid Operators Brush Operators Buttons Operators Cachefile Operators Camera Operators Clip Operators Cloth Operators Collection Operators Console Operators Constraint Operators Curve Operators Curves Operators Cycles Operators Dpaint Operators Ed Operators Export Anim Operators Export Scene Operators Extensions Operators File Operators Fluid Operators Font Operators Geometry Operators Gizmogroup Operators Gpencil Operators Graph Operators Grease Pencil Operators Image Operators Import Anim Operators Import Curve Operators Import Scene Operators Info Operators Lattice Operators Marker Operators Mask Operators Material Operators Mball Operators Mesh Operators Nla Operators Node Operators Object Operators Outliner Operators Paint Operators Paintcurve Operators Palette Operators Particle Operators Pointcloud Operators Pose Operators Poselib Operators Preferences Operators Ptcache Operators Render Operators Rigidbody Operators Scene Operators Screen Operators Script Operators Sculpt Operators Sculpt Curves Operators Sequencer Operators Sound Operators Spreadsheet Operators Surface Operators Text Operators Text Editor Operators Texture Operators Transform Operators Ui Operators Uilist Operators Uv Operators View2D Operators View3D Operators Wm Operators Workspace Operators World Operators Types (bpy.types) Toggle navigation of Types (bpy.types) AOV(bpy_struct) AOVs(bpy_struct) ASSETBROWSER_UL_metadata_tags(UIList) Action(ID) ActionChannelbag(bpy_struct) ActionChannelbagFCurves(bpy_struct) ActionChannelbagGroups(bpy_struct) ActionChannelbags(bpy_struct) ActionConstraint(Constraint) ActionGroup(bpy_struct) ActionKeyframeStrip(ActionStrip) ActionLayer(bpy_struct) ActionLayers(bpy_struct) ActionPoseMarkers(bpy_struct) ActionSlot(bpy_struct) ActionSlots(bpy_struct) ActionStrip(bpy_struct) ActionStrips(bpy_struct) AddStrip(EffectStrip) Addon(bpy_struct) AddonPreferences(bpy_struct) Addons(bpy_struct) AdjustmentStrip(EffectStrip) AlphaOverStrip(EffectStrip) AlphaUnderStrip(EffectStrip) AnimData(bpy_struct) AnimDataDrivers(bpy_struct) AnimViz(bpy_struct) AnimVizMotionPaths(bpy_struct) Annotation(ID) AnnotationFrame(bpy_struct) AnnotationFrames(bpy_struct) AnnotationLayer(bpy_struct) AnnotationLayers(bpy_struct) AnnotationStroke(bpy_struct) AnnotationStrokePoint(bpy_struct) AnyType(bpy_struct) Area(bpy_struct) AreaLight(Light) AreaSpaces(bpy_struct) Armature(ID) ArmatureBones(bpy_struct) ArmatureConstraint(Constraint) ArmatureConstraintTargets(bpy_struct) ArmatureEditBones(bpy_struct) ArmatureModifier(Modifier) ArrayModifier(Modifier) AssetLibraryCollection(bpy_struct) AssetLibraryReference(bpy_struct) AssetMetaData(bpy_struct) AssetRepresentation(bpy_struct) AssetShelf(bpy_struct) AssetTag(bpy_struct) AssetTags(bpy_struct) AssetWeakReference(bpy_struct) Attribute(bpy_struct) AttributeGroupCurves(bpy_struct) AttributeGroupGreasePencil(bpy_struct) AttributeGroupGreasePencilDrawing(bpy_struct) AttributeGroupMesh(bpy_struct) AttributeGroupPointCloud(bpy_struct) BakeSettings(bpy_struct) BevelModifier(Modifier) BezierSplinePoint(bpy_struct) BlendData(bpy_struct) BlendDataActions(bpy_struct) BlendDataAnnotations(bpy_struct) BlendDataArmatures(bpy_struct) BlendDataBrushes(bpy_struct) BlendDataCacheFiles(bpy_struct) BlendDataCameras(bpy_struct) BlendDataCollections(bpy_struct) BlendDataCurves(bpy_struct) BlendDataFonts(bpy_struct) BlendDataGreasePencilsV3(bpy_struct) BlendDataHairCurves(bpy_struct) BlendDataImages(bpy_struct) BlendDataLattices(bpy_struct) BlendDataLibraries(bpy_struct) BlendDataLights(bpy_struct) BlendDataLineStyles(bpy_struct) BlendDataMasks(bpy_struct) BlendDataMaterials(bpy_struct) BlendDataMeshes(bpy_struct) BlendDataMetaBalls(bpy_struct) BlendDataMovieClips(bpy_struct) BlendDataNodeTrees(bpy_struct) BlendDataObjects(bpy_struct) BlendDataPaintCurves(bpy_struct) BlendDataPalettes(bpy_struct) BlendDataParticles(bpy_struct) BlendDataPointClouds(bpy_struct) BlendDataProbes(bpy_struct) BlendDataScenes(bpy_struct) BlendDataScreens(bpy_struct) BlendDataSounds(bpy_struct) BlendDataSpeakers(bpy_struct) BlendDataTexts(bpy_struct) BlendDataTextures(bpy_struct) BlendDataVolumes(bpy_struct) BlendDataWindowManagers(bpy_struct) BlendDataWorkSpaces(bpy_struct) BlendDataWorlds(bpy_struct) BlendFileColorspace(bpy_struct) BlendImportContext(bpy_struct) BlendImportContextItem(bpy_struct) BlendImportContextItems(bpy_struct) BlendImportContextLibraries(bpy_struct) BlendImportContextLibrary(bpy_struct) BlendTexture(Texture) BlenderRNA(bpy_struct) BoidRule(bpy_struct) BoidRuleAverageSpeed(BoidRule) BoidRuleAvoid(BoidRule) BoidRuleAvoidCollision(BoidRule) BoidRuleFight(BoidRule) BoidRuleFollowLeader(BoidRule) BoidRuleGoal(BoidRule) BoidSettings(bpy_struct) BoidState(bpy_struct) Bone(bpy_struct) BoneCollection(bpy_struct) BoneCollectionMemberships(bpy_struct) BoneCollections(bpy_struct) BoneColor(bpy_struct) BoolAttribute(Attribute) BoolAttributeValue(bpy_struct) BoolProperty(Property) BooleanModifier(Modifier) BrightContrastModifier(StripModifier) Brush(ID) BrushCapabilities(bpy_struct) BrushCapabilitiesImagePaint(bpy_struct) BrushCapabilitiesSculpt(bpy_struct) BrushCapabilitiesVertexPaint(bpy_struct) BrushCapabilitiesWeightPaint(bpy_struct) BrushCurvesSculptSettings(bpy_struct) BrushGpencilSettings(bpy_struct) BrushTextureSlot(TextureSlot) BuildModifier(Modifier) ByteColorAttribute(Attribute) ByteColorAttributeValue(bpy_struct) ByteIntAttribute(Attribute) ByteIntAttributeValue(bpy_struct) CLIP_UL_tracking_objects(UIList) CURVES_UL_attributes(UIList) CacheFile(ID) CacheFileLayer(bpy_struct) CacheFileLayers(bpy_struct) CacheObjectPath(bpy_struct) CacheObjectPaths(bpy_struct) Camera(ID) CameraBackgroundImage(bpy_struct) CameraBackgroundImages(bpy_struct) CameraDOFSettings(bpy_struct) CameraSolverConstraint(Constraint) CameraStereoData(bpy_struct) CastModifier(Modifier) ChannelDriverVariables(bpy_struct) ChildOfConstraint(Constraint) ChildParticle(bpy_struct) ClampToConstraint(Constraint) ClothCollisionSettings(bpy_struct) ClothModifier(Modifier) ClothSettings(bpy_struct) ClothSolverResult(bpy_struct) CloudsTexture(Texture) Collection(ID) CollectionChild(bpy_struct) CollectionChildren(bpy_struct) CollectionExport(bpy_struct) CollectionExports(bpy_struct) CollectionLightLinking(bpy_struct) CollectionObject(bpy_struct) CollectionObjects(bpy_struct) CollectionProperty(Property) CollisionModifier(Modifier) CollisionSettings(bpy_struct) ColorBalanceModifier(StripModifier) ColorManagedDisplaySettings(bpy_struct) ColorManagedInputColorspaceSettings(bpy_struct) ColorManagedSequencerColorspaceSettings(bpy_struct) ColorManagedViewSettings(bpy_struct) ColorMapping(bpy_struct) ColorMixStrip(EffectStrip) ColorRamp(bpy_struct) ColorRampElement(bpy_struct) ColorRampElements(bpy_struct) ColorStrip(EffectStrip) CompositorNode(NodeInternal) CompositorNodeAlphaOver(CompositorNode) CompositorNodeAntiAliasing(CompositorNode) CompositorNodeBilateralblur(CompositorNode) CompositorNodeBlur(CompositorNode) CompositorNodeBokehBlur(CompositorNode) CompositorNodeBokehImage(CompositorNode) CompositorNodeBoxMask(CompositorNode) CompositorNodeBrightContrast(CompositorNode) CompositorNodeChannelMatte(CompositorNode) CompositorNodeChromaMatte(CompositorNode) CompositorNodeColorBalance(CompositorNode) CompositorNodeColorCorrection(CompositorNode) CompositorNodeColorMatte(CompositorNode) CompositorNodeColorSpill(CompositorNode) CompositorNodeCombineColor(CompositorNode) CompositorNodeConvertColorSpace(CompositorNode) CompositorNodeConvertToDisplay(CompositorNode) CompositorNodeConvolve(CompositorNode) CompositorNodeCornerPin(CompositorNode) CompositorNodeCrop(CompositorNode) CompositorNodeCryptomatte(CompositorNode) CompositorNodeCryptomatteV2(CompositorNode) CompositorNodeCurveRGB(CompositorNode) CompositorNodeCustomGroup(CompositorNode) CompositorNodeDBlur(CompositorNode) CompositorNodeDefocus(CompositorNode) CompositorNodeDenoise(CompositorNode) CompositorNodeDespeckle(CompositorNode) CompositorNodeDiffMatte(CompositorNode) CompositorNodeDilateErode(CompositorNode) CompositorNodeDisplace(CompositorNode) CompositorNodeDistanceMatte(CompositorNode) CompositorNodeDoubleEdgeMask(CompositorNode) CompositorNodeEllipseMask(CompositorNode) CompositorNodeExposure(CompositorNode) CompositorNodeFilter(CompositorNode) CompositorNodeFlip(CompositorNode) CompositorNodeGamma(CompositorNode) CompositorNodeGlare(CompositorNode) CompositorNodeGroup(CompositorNode) CompositorNodeHueCorrect(CompositorNode) CompositorNodeHueSat(CompositorNode) CompositorNodeIDMask(CompositorNode) CompositorNodeImage(CompositorNode) CompositorNodeImageCoordinates(CompositorNode) CompositorNodeImageInfo(CompositorNode) CompositorNodeInpaint(CompositorNode) CompositorNodeInvert(CompositorNode) CompositorNodeKeying(CompositorNode) CompositorNodeKeyingScreen(CompositorNode) CompositorNodeKuwahara(CompositorNode) CompositorNodeLensdist(CompositorNode) CompositorNodeLevels(CompositorNode) CompositorNodeLumaMatte(CompositorNode) CompositorNodeMapUV(CompositorNode) CompositorNodeMask(CompositorNode) CompositorNodeMovieClip(CompositorNode) CompositorNodeMovieDistortion(CompositorNode) CompositorNodeNormal(CompositorNode) CompositorNodeNormalize(CompositorNode) CompositorNodeOutputFile(CompositorNode) CompositorNodePixelate(CompositorNode) CompositorNodePlaneTrackDeform(CompositorNode) CompositorNodePosterize(CompositorNode) CompositorNodePremulKey(CompositorNode) CompositorNodeRGB(CompositorNode) CompositorNodeRGBToBW(CompositorNode) CompositorNodeRLayers(CompositorNode) CompositorNodeRelativeToPixel(CompositorNode) CompositorNodeRotate(CompositorNode) CompositorNodeScale(CompositorNode) CompositorNodeSceneTime(CompositorNode) CompositorNodeSeparateColor(CompositorNode) CompositorNodeSetAlpha(CompositorNode) CompositorNodeSplit(CompositorNode) CompositorNodeStabilize(CompositorNode) CompositorNodeSwitch(CompositorNode) CompositorNodeSwitchView(CompositorNode) CompositorNodeTime(CompositorNode) CompositorNodeTonemap(CompositorNode) CompositorNodeTrackPos(CompositorNode) CompositorNodeTransform(CompositorNode) CompositorNodeTranslate(CompositorNode) CompositorNodeTree(NodeTree) CompositorNodeVecBlur(CompositorNode) CompositorNodeViewer(CompositorNode) CompositorNodeZcombine(CompositorNode) ConsoleLine(bpy_struct) Constraint(bpy_struct) ConstraintTarget(bpy_struct) ConstraintTargetBone(bpy_struct) Context(bpy_struct) CopyLocationConstraint(Constraint) CopyRotationConstraint(Constraint) CopyScaleConstraint(Constraint) CopyTransformsConstraint(Constraint) CorrectiveSmoothModifier(Modifier) CrossStrip(EffectStrip) CryptomatteEntry(bpy_struct) Curve(ID) CurveMap(bpy_struct) CurveMapPoint(bpy_struct) CurveMapPoints(bpy_struct) CurveMapping(bpy_struct) CurveModifier(Modifier) CurvePaintSettings(bpy_struct) CurvePoint(bpy_struct) CurveProfile(bpy_struct) CurveProfilePoint(bpy_struct) CurveProfilePoints(bpy_struct) CurveSlice(bpy_struct) CurveSplines(bpy_struct) Curves(ID) CurvesModifier(StripModifier) CurvesSculpt(Paint) DATA_UL_bone_collections(UIList) DampedTrackConstraint(Constraint) DataTransferModifier(Modifier) DecimateModifier(Modifier) Depsgraph(bpy_struct) DepsgraphObjectInstance(bpy_struct) DepsgraphUpdate(bpy_struct) DisplaceModifier(Modifier) DisplaySafeAreas(bpy_struct) DistortedNoiseTexture(Texture) DopeSheet(bpy_struct) Driver(bpy_struct) DriverTarget(bpy_struct) DriverVariable(bpy_struct) DynamicPaintBrushSettings(bpy_struct) DynamicPaintCanvasSettings(bpy_struct) DynamicPaintModifier(Modifier) DynamicPaintSurface(bpy_struct) DynamicPaintSurfaces(bpy_struct) EQCurveMappingData(bpy_struct) EdgeSplitModifier(Modifier) EditBone(bpy_struct) EffectStrip(Strip) EffectorWeights(bpy_struct) EnumProperty(Property) EnumPropertyItem(bpy_struct) EvaluateClosureNodeViewerPathElem(ViewerPathElem) Event(bpy_struct) ExplodeModifier(Modifier) FCurve(bpy_struct) FCurveKeyframePoints(bpy_struct) FCurveModifiers(bpy_struct) FCurveSample(bpy_struct) FFmpegSettings(bpy_struct) FILEBROWSER_UL_dir(UIList) FModifier(bpy_struct) FModifierCycles(FModifier) FModifierEnvelope(FModifier) FModifierEnvelopeControlPoint(bpy_struct) FModifierEnvelopeControlPoints(bpy_struct) FModifierFunctionGenerator(FModifier) FModifierGenerator(FModifier) FModifierLimits(FModifier) FModifierNoise(FModifier) FModifierStepped(FModifier) FieldSettings(bpy_struct) FileAssetSelectIDFilter(bpy_struct) FileAssetSelectParams(FileSelectParams) FileBrowserFSMenuEntry(bpy_struct) FileHandler(bpy_struct) FileSelectEntry(bpy_struct) FileSelectIDFilter(bpy_struct) FileSelectParams(bpy_struct) Float2Attribute(Attribute) Float2AttributeValue(bpy_struct) Float4x4Attribute(Attribute) Float4x4AttributeValue(bpy_struct) FloatAttribute(Attribute) FloatAttributeValue(bpy_struct) FloatColorAttribute(Attribute) FloatColorAttributeValue(bpy_struct) FloatProperty(Property) FloatVectorAttribute(Attribute) FloatVectorAttributeValue(bpy_struct) FloatVectorValueReadOnly(bpy_struct) FloorConstraint(Constraint) FluidDomainSettings(bpy_struct) FluidEffectorSettings(bpy_struct) FluidFlowSettings(bpy_struct) FluidModifier(Modifier) FollowPathConstraint(Constraint) FollowTrackConstraint(Constraint) ForeachGeometryElementGenerationItem(bpy_struct) ForeachGeometryElementInputItem(bpy_struct) ForeachGeometryElementMainItem(bpy_struct) ForeachGeometryElementZoneViewerPathElem(ViewerPathElem) FreestyleLineSet(bpy_struct) FreestyleLineStyle(ID) FreestyleModuleSettings(bpy_struct) FreestyleModules(bpy_struct) FreestyleSettings(bpy_struct) Function(bpy_struct) FunctionNode(NodeInternal) FunctionNodeAlignEulerToVector(FunctionNode) FunctionNodeAlignRotationToVector(FunctionNode) FunctionNodeAxesToRotation(FunctionNode) FunctionNodeAxisAngleToRotation(FunctionNode) FunctionNodeBitMath(FunctionNode) FunctionNodeBooleanMath(FunctionNode) FunctionNodeCombineColor(FunctionNode) FunctionNodeCombineMatrix(FunctionNode) FunctionNodeCombineTransform(FunctionNode) FunctionNodeCompare(FunctionNode) FunctionNodeEulerToRotation(FunctionNode) FunctionNodeFindInString(FunctionNode) FunctionNodeFloatToInt(FunctionNode) FunctionNodeFormatString(FunctionNode) FunctionNodeHashValue(FunctionNode) FunctionNodeInputBool(FunctionNode) FunctionNodeInputColor(FunctionNode) FunctionNodeInputInt(FunctionNode) FunctionNodeInputRotation(FunctionNode) FunctionNodeInputSpecialCharacters(FunctionNode) FunctionNodeInputString(FunctionNode) FunctionNodeInputVector(FunctionNode) FunctionNodeIntegerMath(FunctionNode) FunctionNodeInvertMatrix(FunctionNode) FunctionNodeInvertRotation(FunctionNode) FunctionNodeMatchString(FunctionNode) FunctionNodeMatrixDeterminant(FunctionNode) FunctionNodeMatrixMultiply(FunctionNode) FunctionNodeProjectPoint(FunctionNode) FunctionNodeQuaternionToRotation(FunctionNode) FunctionNodeRandomValue(FunctionNode) FunctionNodeReplaceString(FunctionNode) FunctionNodeRotateEuler(FunctionNode) FunctionNodeRotateRotation(FunctionNode) FunctionNodeRotateVector(FunctionNode) FunctionNodeRotationToAxisAngle(FunctionNode) FunctionNodeRotationToEuler(FunctionNode) FunctionNodeRotationToQuaternion(FunctionNode) FunctionNodeSeparateColor(FunctionNode) FunctionNodeSeparateMatrix(FunctionNode) FunctionNodeSeparateTransform(FunctionNode) FunctionNodeSliceString(FunctionNode) FunctionNodeStringLength(FunctionNode) FunctionNodeStringToValue(FunctionNode) FunctionNodeTransformDirection(FunctionNode) FunctionNodeTransformPoint(FunctionNode) FunctionNodeTransposeMatrix(FunctionNode) FunctionNodeValueToString(FunctionNode) GPENCIL_UL_annotation_layer(UIList) GPENCIL_UL_matslots(UIList) GPencilInterpolateSettings(bpy_struct) GPencilSculptGuide(bpy_struct) GPencilSculptSettings(bpy_struct) GREASE_PENCIL_UL_attributes(UIList) GREASE_PENCIL_UL_masks(UIList) GammaCrossStrip(EffectStrip) GaussianBlurStrip(EffectStrip) GeometryAttributeConstraint(Constraint) GeometryNode(NodeInternal) GeometryNodeAccumulateField(GeometryNode) GeometryNodeAttributeDomainSize(GeometryNode) GeometryNodeAttributeStatistic(GeometryNode) GeometryNodeBake(GeometryNode) GeometryNodeBlurAttribute(GeometryNode) GeometryNodeBoundBox(GeometryNode) GeometryNodeCameraInfo(GeometryNode) GeometryNodeCaptureAttribute(GeometryNode) GeometryNodeCollectionInfo(GeometryNode) GeometryNodeConvexHull(GeometryNode) GeometryNodeCornersOfEdge(GeometryNode) GeometryNodeCornersOfFace(GeometryNode) GeometryNodeCornersOfVertex(GeometryNode) GeometryNodeCurveArc(GeometryNode) GeometryNodeCurveEndpointSelection(GeometryNode) GeometryNodeCurveHandleTypeSelection(GeometryNode) GeometryNodeCurveLength(GeometryNode) GeometryNodeCurveOfPoint(GeometryNode) GeometryNodeCurvePrimitiveBezierSegment(GeometryNode) GeometryNodeCurvePrimitiveCircle(GeometryNode) GeometryNodeCurvePrimitiveLine(GeometryNode) GeometryNodeCurvePrimitiveQuadrilateral(GeometryNode) GeometryNodeCurveQuadraticBezier(GeometryNode) GeometryNodeCurveSetHandles(GeometryNode) GeometryNodeCurveSpiral(GeometryNode) GeometryNodeCurveSplineType(GeometryNode) GeometryNodeCurveStar(GeometryNode) GeometryNodeC