[Addon] Boolean 2D Union


This is addon for 2d mesh polygon boolean union.
I have show what it can do in the image.

How to install:

Addons–> Mesh–> Boolean 2D Union

How to use:

Mesh edit mode–>w–>Boolean 2D Union

Enjoy!

download here:
boolean_2d_union.zip (1.7 KB)

fixed some bugs:
boolean_2d_union_01.zip (1.72 KB)

7 Likes

A must-have tool I’ve ever seen! Thanks for the work! It looks like the famous addon X ALL, but even nicer.

Mixy,

A great Thanks for your job so usefull: I’m architect!
Congrats
Spirou4D

Yes. This’s a good idea to improving blender That If something selected just processing selected objects(elements).
Each selecting tool should be improved like this.

Thank you nixy.

Really great addon ! it has some similarity with the “xall” function of the good tinyCAD VTX addon but has the enormous advantage of not removing the faces, working around the failure of the official booleans when it comes to 2D.

Thank you very much for it , definitively one of those addons that should be a default functionality

yep, this stuff should totally be included in the standard distribution, as fast C code – this is why I’m not writing this kind of scripts anymore. Welldone nixy you will soon make my tinyCAD addon redundant!

…yes, anothr create function…
…it cut in view direction without overlapping faces…


(my test / top view)
…thx for sharing…

1 Like

Thank you very much ! I see also a use for geometry :slight_smile:

zeffii, thanks for your encouragement.

Yes, mkbreuer, you are right. It can work not only for co-planar faces, and can cut in view direction.

working. delete prints()

That’s so nice!

nixy:

Would it be possible to extend the addon with Boolean 2D Intersection and Boolean 2D Subtraction?

Guys, why don’t you just use shapely, the powerful geometry library, for these kind of things? Then we dont need a separate addon whenever somebody tries to solve his own problems. Shapely does union, intersections, offsets. Just use this library and make ONE addon.

Some people like solving their problems by creating their own solution. It’s kind of a learning experience. I know I needed a particular feature that wasn’t in Blender, so I just decided to make my own add-on.

I totally agree that it is a good learning experience. It just might turn off the potential users of those addons if they have to install miriads of them.

Thanks for the link :slight_smile:
Would there be a way to have a crossplatform version of it that doesn’t require to install deps that have to be updated on every new version of Python? I find libraries really good, but in that case, wouldn’t it be faster and less “manual updating” intensive to include the C part directly into Blender.
I’m ok with it if you want to maintain that, but most of the time, such niche projects die with the maintainer leaving the project.

Below you’ll find the build instructions I packed also into the downloads. I just post it here to minimize chance for it to get lost.
It allows you to build libgeos for your platform and relatively link the binaries to each other. Put them in the DLL folder of shapely. Shapely should support Python3.x now. No need to adapt it yourself: https://pypi.python.org/pypi/Shapely. With these instructions it’s not much work to maintain the lib. I can do it. You can help me. (Especially the linux part). Deal?

EDIT: I can imagine Blender devs not really want to include a geometry library if it’s not used by a built in operator. They anyway want to keep the size of Blender as small as possible. That means: Only if libgeos should become more important for several parts of Blender they would integrate it.

Linux & MacOs:
¨¨¨¨¨¨¨¨¨¨¨¨¨¨
Install CMake if you haven’t. Build libgeos according to their documentation:
http://trac.osgeo.org/geos/wiki/BuildingOnUnixWithCMake


Modify the rpath attribute of libgeos_c.dylib/.so in order to link libgeos.dylib/.so
with a relative path:
https://blogs.oracle.com/dipol/entry/dynamic_libraries_rpath_and_mac

OSX examples:
install_name_tool -change “/absolute/path/to/your/libgeos.3.4.0dev.dylib” “@loader_path/libgeos.3.4.0dev.dylib” libgeos_c.dylib

–> this tells libgeos_c.dylib (which can be called from python) where it can find the c++ library “libgeos.3.4.0dev.dylib”.
so you do this with “libstdc++.6.dylib” and “libSystem.B.dylib” too and it should work

LINUX: replace install_name_tool with chrpath and dylib with so.
¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨

on a mac: install_name_tool
on linux: sudo apt-get install chrpath, if you don’t already have it


WINDOWS:
¨¨¨¨¨¨¨¨
install Visual Studio: follow the libgeos build instructions:
http://trac.osgeo.org/geos/wiki/BuildingOnWindowsWithNMake
(nmake typically is loacated somewhere like C:\Programs(x86)\Visual Studio\VC\bin)

set your path’s: http://jahboite.co.uk/blog/2009/01/path-env-var-setx.html

shapely automatically sets the environment variable on windows from within python
to include this DLLs directory to its path: no rpath alike steps necessary

Im seeing this error in BL 2.77 on OSX

Traceback (most recent call last): File “/Users/romboutversluijs/Library/Application Support/Blender/2.77/scripts/addons/boolean_2d_union.py”, line 55, in invoke
self.execute(context)
File “/Users/romboutversluijs/Library/Application Support/Blender/2.77/scripts/addons/boolean_2d_union.py”, line 74, in execute
bpy.ops.object.mode_set(mode = ‘EDIT’)
File “/Applications/blender-2.77-OSX_10.6-x86_64/blender.app/Contents/MacOS/…/Resources/2.77/scripts/modules/bpy/ops.py”, line 189, in call
ret = op_call(self.idname_py(), None, kw)
TypeError: Converting py args to operator properties: enum “EDIT” not found in (‘OBJECT’)

location: <unknown location>:-1

Does any one have this working on current version. Ive selected 2 faces, 1 is a bmesh though. Im trying to intersect the curved one from the squared one

Attachments