This is my first question, so bear with me!

I'm trying to create a program that lets you build your own houses and buildings and export the final model as an stl for 3D printing. I'm good at 3D modelling and decent at Python, but I've only recently gotten back into Blender and just started playing with the API. I'm having trouble figuring out how to get an object to "do something" when I click on it.

Here's what I want to do: I'd like the user to be able to place planes in the viewport that will represent the walls of a house or building. I'd like to be able to click on on a plane and bring up a pop-up window allowing me to add another plane next to or above the selected plane. The user could keep clicking on planes and adding new ones until they create a nice outline of the house they want to make. I'd also like to be able to click on a plane and add things like windows and doors. This is meant for people that don't have any modelling experience, so ideally, placing planes would be very simple and wouldn't require to much tinkering. Just have newly created planes snap to the selected plane. In the end, I would like to replace the planes with models I've created--different types of walls (bricks, wood, etc.), windows, doors, things like that. Then You would combine everything into one stl and export it for 3D printing.

So there are two things I need to figure out:

  1. How to get an object to "do something" when you click on it. I think a custom pop-up box would be the best way to go. I've thought about adding separate arrow objects on each side of a plane (maybe child objects?) that will create another plane when clicked...but that also requires figuring out how to get an object to do something when it is selected.

  2. Create a custom window with pictures of assets I've created that can be selected to replace the planes with actual wall assets. So far I've only seen people use the icons available in Blender.

THanks so much for any advice!

  • 1
    $\begingroup$ The question is well written and we're always happy to have new users, but I fear it may get closed for being too general, or out of scope for BSE. If it does, fear not. You can edit your question into something that's a better fit, and it will be queued for review. $\endgroup$ – Allen Simpson Mar 11 at 0:00
  • $\begingroup$ Gotcha. In that case, I'll be more specific: How do I check to see if an object is selected or clicked? $\endgroup$ – Anthony Joseph Schilling Mar 11 at 0:06
  • $\begingroup$ I would try bpy.context for the needed info here. Have you looked at the python documentation at docs.blender.org ? $\endgroup$ – TheLabCat Mar 11 at 1:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.