Giter VIP home page Giter VIP logo

Comments (4)

sexfio avatar sexfio commented on June 23, 2024 1

Repeat the code for several times. There is about a 5% chance that an object cannot be displayed. The Z coordinate is - nan m
: )
sorry, youtube blocked the codes and URL I sent, I dunno >.<

from blender_plus_python.

sexfio avatar sexfio commented on June 23, 2024

https://github.com/sexfio/blender/blob/main/test.py

from blender_plus_python.

CGArtPython avatar CGArtPython commented on June 23, 2024

Thanks for sharing your code!

So the issue seems to be in the order of operations in your code.

On line 52 from your example, you are removing the cube before you use the location reference you got on line 51
https://github.com/sexfio/blender/blob/main/test.py

Basically, there is a good chance that the reference to the location vector object will be invalid.

Notice that I delete the object after using it in my example
https://gist.github.com/CGArtPython/cb53598625fd6dd3f9d1b0f2b49aecb8

This also can be solved by making a copy of the location vector.
You would need to import
import copy
and then
do this
location = copy.copy(cube.location)

So your code would look like this

 for cube in cubes:
	 location = copy.copy(cube.location)
	 bpy.data.objects.remove(cube)
	 bpy.ops.mesh.primitive_monkey_add(location=location)

from blender_plus_python.

sexfio avatar sexfio commented on June 23, 2024

thank you very much, I made a mistake :)

from blender_plus_python.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.