To get the name of the primitive etc. generated immediately before

Introduction

Recently, using Blender seems to be able to do various interesting things, so I'm investigating whether Python can do this.

This time, when operating Blender from Python, it seemed that when specifying added primitives etc., it was common to specify a name and perform subsequent processing, so I investigated how to obtain this name.

I didn't know how to specify the name when adding the primitive, so I looked it up and arrived at this method.

To get the name of the immediately generated primitive

bpy.context.object.name

How to use

bpy.ops.mesh.primitive_uv_sphere_add(location=(0, 0, 0.5))
#The primitive name added in ↑ is
bpy.context.object.name

Related posts

-First step to use Blender from Python --Qiita -How to know the current directory in Python in Blender --Qiita

-Running mruby with Python or Blender-Qiita -Using OpenCV with Blender on OSX-Qiita

Related article

-Until making the first add-on in Blender-Part 2- -Until you make your first add-on in Blender-Part 1- -Draw the brachistochrone curve using Python in Blender -Solved the problem that JSON exported by Blender has strange color in Three.js -I tried ctypes with Blender on OSX -Running gRPC (client & server) with blender

Recommended Posts

To get the name of the primitive etc. generated immediately before
I want to get the name of the function / method being executed
Get the song name from the title of the video you tried to sing
How to get the variable name itself in python
Get the variable name of the variable as a character string.
How to get the number of digits in Python
Get to know the feelings of gradient boosting trees
Try to get the contents of Word with Golang
Script to get the expiration date of the SSL certificate
Try to get the function list of Python> os package
I tried to get the location information of Odakyu Bus
Get the number of digits
I want to get the operation information of yahoo route
Keras I want to get the output of any layer !!
Get the host name of the host PC with Docker on Linux
Get the source of the page to load infinitely with python.
How to get and set the NTP server name by DHCP
I tried to get the index of the list using the enumerate function
How to get the ID of Type2Tag NXP NTAG213 with nfcpy
How to get the vertex coordinates of a feature in ArcPy
PhytoMine-I tried to get the genetic information of plants with Python
Get the number of views of Qiita
Get the attributes of an object
Get the first element of queryset
Get the number of Youtube subscribers
Get the host name in Python
Supplement to the explanation of vscode
Web scraping beginners tried to make a command to get the movie name of next Friday Road Show
Click the Selenium links in order to get the elements of individual pages
[Linux] Command to get a list of commands executed in the past
I measured 6 methods to get the index of the maximum value (minimum value) of the list
I tried to get the authentication code of Qiita API with Python.
Get the number of visits to each page with ReportingAPI + Cloud Functions
[Addition] Convert the time stamp including the English name of the month to datetime
I tried to get the movie information of TMDb API with Python
The story of trying to reconnect the client
Script to change the description of fasta
How to get rid of long comprehensions
How to check the version of Django
The story of adding MeCab to ubuntu 16.04
Get the column list & data list of CASTable
[Python] Get the variable name with str
Get the minutes of the Diet via API
Get the path to the systemd unit file
How to get colored output to the console
Get the value of the middle layer of NN
Get the last day of the specified month
Set the process name of the Python program
[Python] Get the character code of the file
Get the filename of a directory (glob)
The story of pep8 changing to pycodestyle
[PowerShell] Get the reading of the character string
Get the hierarchy name using the OpenMaya iterator
python I don't know how to get the printer name that I usually use.
A programming beginner tried to find out the execution time of sorting etc.
How to get the notebook name you are currently using in Google Colab
Python / subprocess> Symbolic link Implementation to get only the destination file name> os.readlink ()
Try to display the Fibonacci sequence in various languages in the name of algorithm practice
Use twitter API to get the number of tweets related to a certain keyword
I want to store the result of% time, %% time, etc. in an object (variable)
Python script to get a list of input examples for the AtCoder contest