Possible Addon?

Hi all,

I’m currently working on a sort of personal addon to automate some of the tasks I do when taking models from revit to render with Cycles.

My first issue is that all the geometry imports horribly - many triangles no matter the format (dwg, fbx etc.)
This task I’ve used a for loop of quad faces command to quickly fix this. I know the decimate modifier is more thourough but takes much longer.

Secondly the origins are all over the place, which at best makes the model look extremely messy and at worst makes editing the componenets annoying. Another for loop for this which uses the parent clear and set origin commands.

Lastly are the materials. This is possibly the most important aspect of what I hope to achive. What i really want is to be able to auto assign materials from a library based on the object name (since these usually import into blender intact). This is simply checking the items name and applying a material I’ve already got in my startup file.

So far I can select a bunch of objects, click my GUI button and hey presto! it works.

The first issue is that it is slow. Painfully slow.So slow in fact that I’m loath to select more than about 50 objects at time. This brings me onto my second issue. There is litterally no way at the moment for the user to see how long the operation will take or how long theyll have to go or how fast the script is working. This is probably because of the large scale project I work on containing upwards of 11000 objects.

In fact this second issue might be the most important. Because even if the task was going to take two hours, at least the user would know!

I was wondering in the first instance… Has anyone done this before? is there already a tool for reducing geometry? Does it tell you how long it will take? Does it tell you how much the geometry has been reduced by? Can I auto assign materials based on name with the click of a button in some other addon?

If not are there any resources out there for learning first of all how to optimise these tasks in my code (beyond the obvious google searches). And secondly is there a way in blender to have the script give you a running count of how many objects youve processed (29 of 11000) for example. A time would be nice but from what I’ve read this is either very hard to do or impossible.

This project is sort of a learning experience for me so I’m going to try and not ask for direct code help and rather resources to learn about these things or code snippets with short explanations of how they work.

Again, appologies for the essay and thanks in advance for any help what so ever.

If it would help I can also post the script somewhere… not sure where to do this as I am quite new to the whole python thing…

Hi, take a look at
http://ifcopenshell.sourceforge.net/ifcblender.html
as a possible gateway between revit and blender
Also revit general objects structure is a pain for blender, attaching similar objects together may lead to significant performance enhancement.

Hey stephen,

Thanks for your reply. I’d had a look at IFC and will do so a bit more in the coming weeks/ months as it appears to retain a little more information.

I’m interested about what you said regarding attaching similar objects together. Is there a reason for this performance enhancement?
Do you know if performing commands on single objects is faster than doing so on many even if the number of ‘separate’ geometries and faces are the same? Definately something for me to test.

The problem does still remain about the geometry, origins and the fact I have to apply many materials to many objects. As I can see from your link even with the IFC the origins are all over the place and so I’m still wondering if i can itterate through them so as to clean up geometry, fix origins and auto apply materials from my library.

Ill post here again any progress i make with the IFC method :slight_smile:

Ok small update…

So I tried what you said (selecting similarly named objects and joining) and hey presto! The fix origins function and the automaterial function I’ve made work like a charm!

This still leaves me the issue of there being a lot of different object types. As one might imagine on larger commercial projects there end up being a lot of different object/ wall/ etc types which i need to select and join.

As before if anyone has any suggestions on how to do I’d be more than happy to hear them.

In the first instance what im going to try and do is
-select all the objects in the scene, make the first object in the list active, get the first ten characters of the name of the object, perform the select pattern with those, join all the subsequently selected objects…?

Anyway, more updates to come if I ever get this thing working :slight_smile: