[ADDON][MostlyComplete]Add Grating

There have been several projects that I have needed metal grating for and it takes a lot of time to create, so as my first real addon I created a script to automate all this. You can adjust width, length, number of slates width wise and length wise, height, and thickness. All normals seem to be looking ok, only problem that I know of is the fact you can make the thickness larger than the spacing between slates. Leading to some ugly results. Still looking for a way to easily correct that. Suggestions are welcome. Here is the link to the download

EDIT 8/30/14 version 0.2:
I update the script, you can now rotate while adjusting the properties. Also made lengths up to 2000 in possible. Also noticed that at 60" x 1200" with 12 width slates and 150 length slates the face count was around 17,000. A lot of faces for just grating, but that is a pretty big example. New script here

EDIT 8/31/14 version 0.3:
Added button to Create panel, under new heading called “Addons”. Fixed some normal issues, so all normals are now good. Hope to for next update fix problem were thickness can be larger than distance between slates. Causing a mess. Here is the current version, I will update it once I fix the thickness issue. UPDATE: thickness issue fixed, changed so smallest length is 1 inch

EDIT 9/7/14 version 0.4:
Fixed inner faces issue. Link here

EDIT 10/9/14 version 0.4:
Updated the panel, to add to the View3D > Toolbar > Create > Addons panel you now need this script.
Link in above post has been update to adjusted grating script

Hi Jacob Morris,

Thanks for sharing your job for add-on.
WARNING:
But your add-on don’t run because you have keeped the main function in comment!

And with the conventionnal name in python file for Blender:

  • no capital-> add.mesh.grating.py like Blenderfoundation.


Congrats.
Spirou4D

I updated the name and the link in my first post, I have the last lines commented out because they are just for running the script from the text editor. As an addon it works fine for me.

Great Tool!
But it does not work.

#if name == “main”:
#register()

You have forgotten to delete the rhombus at the line beginning.

if name == “main”:
register()

I think it will be good to have all new Mesh Plugins in a new Panel under the Create TAB
> not in Add Mesh alone.
Show this Thread > http://www.blenderartists.org/forum/showthread.php?347795-New-Panel-for-new-Mesh-Plugins&p=2718238#post2718238

thx for sharing!

Thks mkbreuer,

> new Panel under the Create TAB
it’s a nice idea…I save the code for me.
Bye bye

that is really odd, I have the lines commented out and it works just fine for me as a plug-in. I thought that those lines were only needed to get the code to run from the text editor, but as a plug-in you didn’t need them. And I will look into add it to the Create tab, thanks for the suggestion.

Added button to View3D > Tools > Create > Addons, also fixed some normal issues, link here and in first post.

Works well! thx

(…sorry for my bad english. It was more a suggestion than an idea. Thinking and writing does not always mean the same thing.)

@mkbreuer it was no problem.

Hrm a thread w/o screenshots!

Some example pictures:
It adds another section to the Create panel:
[ATTACH=CONFIG]330697[/ATTACH]
UI:
[ATTACH=CONFIG]330698[/ATTACH]
Default settings:
[ATTACH=CONFIG]330699[/ATTACH]

Traceback (most recent call last):
File “/home/peter/.config/blender/2.71/scripts/addons/add_mesh_grating.py”, line 176, in execute
self.over_width, self.width_num, self.over_length, self.length_num, self.thickness, self.height, self.rotation)
File “/home/peter/Blender/blender-2.71-ee8dafe-linux-glibc211-x86_64/2.71/scripts/modules/bpy_types.py”, line 584, in getattribute
return super().getattribute(attr)
AttributeError: ‘MESH_OT_primitive_grating_add’ object has no attribute ‘rotation’

location: <unknown location>:-1

Did you get this on import of the addon? Or upon running it? What version of blender are you running? Thanks

Blender 2.71

This occurred when I attempted to run it (add a grating that is)

That is really odd, I played around with it and couldn’t get an error, although I get some pretty funky results from when I was in Edit Mode, so I made it so that it won’t add unless in object mode. Get the latest version here, or in update 0.3 from main post.

Added ability to have to slates in middle, so you can use this for easily controllable frames, link in above post and in update 0.3 in main post

nice ,gonna come in handy. Thanks

Convenient (and works nicely in Win64 2.71 here ^_^)… but, there’s something slightly odd about the mesh it generates - visible when you try to bevel the inner edges. Perhaps there are some generated internal faces that shouldn’t be there? (alternatively, maybe add a “Bevel Amount” setting to the panel?).

In the following image, the blue was made manually and bevelled (to check that the 5-pole corners weren’t confusing the Bevel tool), while the grey one shows glitches at some corners…


(EDIT: ‘Select -> Interior Faces’ shows that there’s an extra face on each ‘hole’ of the grating, that probably shouldn’t be there…).

The addon generates inner faces. Then remove the interior faces.
I use MeshLint for this.

I’m wondering if it is a windows vs. Linux thing… I run Linux Mint 15