Parametric Model Generator

Hi!
I would like to show my Parametric Model Generator.

Download from attachment Parametric-Model-Generator.zip (14.7 KB) (zip contains 1 python file, model database pmg.json oraz single models that can be loaded via import).
It’s my first Blender plugin also first bigger project in Python.

To be able to load my example database copy pmg.json to ~/.config/blender/version/config/ .
Use reload button to be see list on new database.
How to create a new model? Remove existing model if any in interface. Add new object(Plane or circle based). Edit faces for extrude, 0 is base face. Only first face is used on global location/scale/rotation. Faces 1+ are based on location,rotation,scale of previous face. While updating all faces object will be changing in 3d view.

How to use modifiers?
Every time doing a change in model faces object is recreated in scene. It is removing object and it modifiers then remake it from scratch and add modifiers used in object before.
When you have active object add supported modifier and do a change to a active face( Like change scale of x from 1 to 1, it is to save modifiers to object. Otherwise modifiers changes will be lost. Can’t see when modifiers are changes to it’s like manual update.
I will add later screencast how to make a simple model.

For using multiple objects in database, please use unique name for model parts(objects). otherwise it get replaced.


Interface Info:

  • List of models in your local database. (~/.config/{version}/blender/config/pmg.json
  • Button to reload database, when you install plugin by settings and don’t open new file need to reload database(if any) to see models.
  • Remove from plugin panel all data about objects(names, faces,modifiers). It doesn’t remove objects from scene.
  • Field to set name of object to create.
  • Add plane based object. (object name must be set)
  • Add circle based object. (object name must be set)
  • Save single model to file
  • Open single model from file
  • List of objects, when you choose 1 the object will be active and it faces data will be shown.
  • List of faces with descriptions.
  • Number only list of faces for fast access.
  • Button to add new face.
  • Field to set description(comment) of face. (Not required)
  • Here you set all settings for single face. Location XYZ, Rotation XYZ, Scale XYZ.





Supported Modifiers:

  • Array
  • Bevel
  • Boolean
  • Build
  • Decimate
  • Edge Split
  • Mirror
  • Multiresolution
  • Remesh
  • Screw
  • Skin
  • Solidify
  • Subdivision Surface
  • Triangulate
  • Wireframe

Models included as examples. Availible as single models or as local database (pmg.json).

Every model,models can be edited via any text editor. Models are saved as json files.

Currently Features :

  • Create many models as you want

  • Extrude last face multiple times

  • Add rotation/scale/direction for every new extruded face

  • Import/Export models

  • Local database

  • Some modifers ( List is above)

  • Models are saved as json, can be edited via text editor or plugin interface.

It seems to be quite cool idea, if you allow for exporting setup of this plugin. This way is can serve as a mesh-generator, and after some polishing is worth a penny at least.

What about modifiers? Can they be put on each individual part of the object or it is just a silly idea?

I tested it, it looks good for a starting point, but it has waay to go until it becomes useful.Here are some issues and suggestions:

Issues:(I tried to replicate the table that you did, nothing fancy…)
1.it doesent respect newly added modifiers. I added a mirror modifier around empty to the leg I created, and then I tried to modify the leg - the leg jumped to the original position in the center of the world and the mirror modifier was gone
2.the second object inherits the values of the first, i.e., the rotations and scales of the faces are the same as the faces of the first, so I was forced to reset to default values all properties, which is annoying and timeconsuming
3. after selecting some other object and then reselecting the second object it displays the properties for the first object, when it should show the settings of the active object, which is the second created.
4. it doesent respect parenting of the objects. I parented the legs to the table plane, then tried to edit the plane and the parenting and modifiers were gone.
5. the UI is not good, ( as youve wrote you plan on improving it. I could suggest moving it to IU region (ie, Properties side panel) or making this an operator with presets and undo options, which will be better, because we will be able to have presets such as Leg, Tower, Arc etc., as many presets as we need.
These are fundamental problems that you need to solve in the first place before adding new features

Suggestions for new features:
1.right now the faces can be only rectangles or quads. It could be nice if in the future you add more options to that, ie, arc, circle, etc.
2 a global tapering/twisting/bending/buldging for all faces would be nice and handy also
I cannot help you with the code review, but there are few parametric addons out there, you can read them and take ideas from them. such parametric objects scripts are for example: Window generator, Chimney generator, Archimesh rooms (which has dynamic number of rooms like yours number of faces. From what I understand, the properties should be generated locally on objects, not globally on the scene. This way you can even append parametic objects between scenes and they will still have the properties that you can edit in any time. And here is a link to a tutorial about parametric objects in Blender - the user created few parametric objects and I believe that he has other posts as well on that subject. http://www.swineworld.org/2015/02/parameterized-objects-in-blender-python.html

Thanks for current feedback and ideas.

@piotao
Modifiers are not supported yet. Maybe in future releases and probably just for whole object.

@TurboBlender
I will add soon feature to copy properties of existing model. Like leg2 from leg1. Modifiers doesn’t work yet.
1.Every time, a property is changed, object is destroyed and drawn from scratch. That’s why mirror modifier was gone. I just used is at simple example, I know it’s not any fancy.
2. Currently only way to create new model is change it name to new on “Model name” field. It should create new object with faces = 0 and all fields should be reset to default, but sometimes a bug can occur.
3. Yes I noticed this today. Is it first to fix.
4. Parenting is bound to object which is destroyed every change so that’s why. I will think about it, maybe I could fix this.
5.UI will be new, but can’t tell date. Implementation of new UI shouldn’t be a problem but I’m not good at design, but I will try my best.
First of all I need to fix current most annoying bugs and add export/import.

Yeah I was thinking about some of these ideas but some need new UI first, otherwise it is big mess in panel. When i started to work on this addon it was a pain to get through panels, documentation not much helpful and many things can just be done with C ( Keyings Sets).

I hope i share next build on next week with some bugs fixes and also export/import feature that would be better for testing purposes.

I tested the example addon on the link that I gave you - 'Add Spokes" and it actually removes all the problems that I reported for your script - it appends properties on the object itself, thats why we can add modifiers, parent the objects, move/rotate scale them, and every object is with separate propeties. The only option that it doesent have is the importing/exporting of presets, but the ‘add_room.py’ from the archimesh addon has this option, plus, the add room has the dynamic options per object like your script, except it adds dynamically any number of walls to the room. I think that the second script is even closer to what you want to create, it should be a matter of copying and reediting it to fit your needs. You should definetely check these two scripts.

You dont need C for this addon, python is dynamic enough to do it properly. The same goes for keying sets - no need for this eighter.

@Reeborn

Could you please make a short screen cast to show how your add-on works?

New version is available. Sorry for delay.