AddRoad curve-based road generator

addRoad road generator

This add-on uses curves to create a parametric road, with variable widths for lanes, accessories, etc. Later functionality will include loading additional meshes (like street lights or highway dividers every N feet) and have presets based on some road types (highway, country road, etc.)

EDIT 1/1/2019: Now works on Blender 2.8!

Github

12 Likes

Im getting this funny result. Whats the problem with the addon or other. I have added a curve circle and click on the road addon i get the below result. After adding a normal Add-> mesh → road i get normal road and tweaking the setting nothing change.

road

Any suggestion or help. Im i doing wrong or the addon working. Thanks

1 Like

Really interesting addon.
i think it could be really helpful to be able to change the sections widths without using the scale of the vertices (or at least not just this way) but with some properties for every road sections and per-segment.
I want to be more clear with an example:
Imagine to have a road that is 4 meters wide with a sideroad 50cm wide.
At a specific point, the road become 8 meters wide but the sideroad stay 50cm wide.
If you use just the curve vertex scale, you’ll have it to scale at 200% but your sideroad will double width and this is not what you want.

Do you think it’s doable?

Very interesting idea.

Like Alt M on a bezier? It’s fun to grow/shrink roads that way right now, but I dunno how to have individual mesh chunks use the bezier weight and others not.

Right now my assumption is that for tricky road areas (intersections, off ramps, lane merges, temporary passing lanes) you’d have to do two separate roads and make their transition by hand. For instance, I guess if this was via skin modifier you could do a Y split for an offramp, but with curves you can’t; even if it looks pretty and keeps the intersection connected with a hook, that split still gets stored as spline[0] and spline [1]. Thus, you can have the array duplicate along both, but it’s technically ugly mesh-on-mesh geo.

Some of the extra lanes are really metaphorical, too. You could have a 2 lane country road where the thin divider represents where the yellow dashed line goes, the 1 lane each way is plain, the shoulder is just narrow dirt, the “bike lane” is a ditch, and the gutter, sidewalk, and greenway are just more dirt, orchard trees, and the path after them.

how would you install this?

Download it and from user prefs > Add-ons use the “Install add-ons from file” button. Navigate to the .zip.

okay what I needed to know.

Newest update: no major changes, but the code is prettier. I’m still looking for ways to group bpy.props and then combine them, both for help iterating and also just for prettier, collapsible code. Material import is in place so that if materials.blend (included in the zip) is polished up a bit more, it’ll have some nice actual road materials to work off.

Next up: make the materials nice and purty, get accessory import working

1 Like

I think I spotted a bug. At least this script does not work fo rme using Windows 10 64bit Pro with blender 2.79 version release December 17th 2017

I get this error screen that pops up in the blender interface but these errors do not get logged to the blender console( first place that Iooked)/

This is the ouput in the 3D Viewport

I intially just copied and pasted the addRoads-master folder from the zip to my C:\User<My Name>\Desktop\Blender Files\Blender279\Blender\scripts\addon\ folder. Becasue I like to know where things are going on my hard drive. I thought maybe that was the problem so I removed the addon in user preference, shut down blender completely delected the addRoads-master folder, then opened blender again and chose install from file in the user perferences. I got the same exact popup.

Friend, I’m shocked my puerile python skills have gotten this add-on this far, and I have no freakin’ clue what that error(s) means :joy::joy::joy:

When somebody downloads from github and installs from zip addon gets installed in folder named “addRoad-master”. In materialSetup.py path to material.blend is hardcoded as
path += “\addons\addRoad\materials.blend”
. This is why OS can not find file materials.blend.
One either needs to rename downloaded zip deleting “-master” before install or rename addon’s folder after the install.
Alternatively - hardcoded paths need to go.

Ahhh. Something like this…?

path +=os.path.dirname(os.path.realpath(__file__)))/../material.blend

Or something? As mentioned, me dumdum

I’d say


mat_lib =os.path.dirname(os.path.realpath(__file__))+ os.sep + "materials.blend"
***
with bpy.data.libraries.load(mat_lib) as (data_from, data_to):
        data_to.materials = [mat]

would work for both Win and Nix worlds.

Edit: How in the World one puts code snippets in this???

" eppoMember

1d

I’d say

Copy to clipboard

mat_lib =os.path.dirname(os.path.realpath(__file__))+ os.sep + "materials.blend"
***
with bpy.data.libraries.load(mat_lib) as (data_from, data_to):
        data_to.materials = [mat]

would work for both Win and Nix worlds.

Edit: How in the World one puts code snippets in this???"

I just copied the addRoads-master folder from the zip file and pasted it to the desktop. I renamed it AddRoads and then cut and pasted it to the …\scripts\addoon\ directory. Then used user preferences addons to enable it and tried to add a road to a bezier curve. I got the same pop ups. So It has to be some other type of bug.

Ok what file and in what line does a person put this in? Should this not be incorporated in the github zip? Not every blender user is a programmer or has any interest in programming at all.

@SHABA1 Unfortunately this really is posted in “Released Scripts” and not “WIP programming” still error is in the code.
My first answer and snippet was to @ogbog’s

not for all potential addon’s users, sry.

Here is a full code of addon’s file materialSetup.py https://pastebin.com/MUXx5vTR which works here on win10 64bit OS and does not fire error while addon itself lives in .\addons\addRoad-master
Hope helps.

thanks eppo: I will give it a shot tonight and let you know my progress.

Is that a better location? I can start a thread there instead or see if a mod can migrate this one.

Great addon thanks for sharing it, sadly isn’t working now, would be great as parametric river generator too