MoI discussion forum
MoI discussion forum

Full Version: Boolean stencil?

Show messages: All  1-7  8-20

From: Michael Gibson
22 Jul 2019   [#8] In reply to [#7]
Hi Przemas, I'll take a look at adding options for those in the regular Trim command.

But usually NURBS modeling is at its best when you are doing things with profile curves and booleans rather than trying to directly manipulate faces like you would in a polygon modeling program.


> I guess it might be scriptable, but I don't know howto achieve it, how can we specify which
> objects are "source" (the one you cut from) and which are trim objects (the ones that "stencil"
> on source and which should get deleted after the operation), then finally howto join. Is it doable?

Usually these different object categories like "source" vs "stenciil" are specified by separate uses of an object picker. You can see how it's done in the current Trim.js file.


> then finally howto join.

There's an example in the Join.js command.

- Michael
From: Frenchy Pilou (PILOU)
22 Jul 2019   [#9]
Seems this workflow must work: very speedy & simple

A = Big Box
B = Little Boxes

A Boolean Diff by B (Keep objects)
B Boolean Diff by A (Keep objects )

Move A or B as you want as following result wished
A Boolean Diff by B (Don't Keep objects) Of course you can save the Cutting objects inside a library if wanted before last Diff...

A & B are stay "solids" along the process!

And no need to script ;)


From: Przemas
22 Jul 2019   [#10]
I get the manual way Pilou :) . But your input is greatly appreciated.

Check this video - I think it shows how much smoother the workflow is when you have stencil/drill operation. Less clicks, less juggling with geo and so on.

https://vimeo.com/349533300

So I'm not saying achieving similar looking object is not possible, I'm just suggesting what can be done to make the workflow nicer :) .

@Michael: yeah, I totally understand that with NURBS creating your geo with profile curves is usually better way to go. But one thing I've noticed while teaching Rhino is that most folks struggle at first when it comes to thinking about shapes in cross sections and so on.
With MoI you've lowered a barier of entry when it comes to NURBS modeling quite a bit - and it is one of the reasons I often recommend MoI as an alternative :) .
And also the reason I'm thinking about parts of MoI that could be streamlined even further :D (so yeah, expect more ideas - but I'm checking whether someone posted similar ones first :D) . In this case the geo is so simple that IMO there's no need to build profiles, do a multi step booleans etc.

I'll look in to js files - hopefully will be able to figure something out (not a programmer sadly, rather a code tinkerer :D ).
From: Michael Gibson
22 Jul 2019   [#11] In reply to [#7]
Hi Przemas, so for doing a script right now it's easiest to modify the current Trim command script to delete cutting objects and do a join at the end. I've attached a version that does this.

The delete part is from this added line:

code:
	moi.geometryDatabase.removeObjects( cutters );


and the join is from this added part:

code:
	var join_factory = moi.command.createFactory( 'join' );
	join_factory.setInput( 0, newobjs );
	join_factory.commit();



Does that then do the boolean stencil function you want?

- Michael

Attachments:
TrimStencil.zip


From: Frenchy Pilou (PILOU)
22 Jul 2019   [#12] In reply to [#11]
How to use it ? Pess Tab then write TrimStencil makes nothing?...

Must to edit the trim command also ? Or it's 2 different things ?
From: Michael Gibson
22 Jul 2019   [#13] In reply to [#12]
Hi Pilou, the one above is a separate command, I'll see about modifying the regular built in Trim command in a bit.

> Pess Tab then write TrimStencil makes nothing?...

Did you download it, unzip it, and copy it into a commands folder?

- Michael
From: Frenchy Pilou (PILOU)
22 Jul 2019   [#14] In reply to [#13]
< Did you download it, unzip it, and copy it into a commands folder?

Of course yes! :)

Edit : That works now for any reason!
That works as aspected but I don't see difference with my method above / final result...:)

Even it's perturbating if you select the cutting object and ask remove (after the mutual "OK" triming) you stay with just the intersection ! :)

So you must deplace it after the mutual triming!



TrimStencil here with 2 another volumes


It's not evident to have the remove of the cutting object!
We must make a Right Click and not Click on the "OK" button!
(here the extrude function after the TrimStencil)


From: Przemas
23 Jul 2019   [#15]
Thank you Michael, that's it! Is there a guide for scripting / macroing MoI? I'd like to modify it even further to automatically pick remove mode so I wouldn't have to do additional click.
Also when it comes to guides - is there a one that would show how do you add custom buttons? I've done mods for my Rhino and Modo installs and would like to see what can be done with MoI :) .

@Pilou: the result is identical in both cases , both manual and with trimstencil. The difference is in workflow - less clicks and that's what I'm looking for :) .

I'm liking what I see so far. Next time I'd probably try doing a sample project first in Rhino / Modo then in MoI so I could make more educated comparisons.
From: Frenchy Pilou (PILOU)
23 Jul 2019   [#16] In reply to [#15]
The manual method is 9 Clicks include Selection(s) of objects, call function(s), Parameter(s), final result! ;)
From: Michael Gibson
23 Jul 2019   [#17] In reply to [#15]
Hi Przemas,

re:
> Is there a guide for scripting / macroing MoI?

Not really, it unfortunately takes quite a bit of work to do a good job documenting and just generally supporting such things. That's why it hasn't been a big focus area so far.

There is some information here though:
http://moi3d.com/wiki/Scripting


> Also when it comes to guides - is there a one that would show how do you add custom buttons?

Not really, but if you're familiar at all with HTML it's pretty straightforward. You can see how the current UI is set up by opening up files like CommandBar.htm and SidePane.htm inside MoI's ui subfolder. You'll then see how buttons are set up as <moi:CommandButton> tags and you can add new ones in.

Is everything working ok under Wine now for you with __GL_MaxFramesAllowed=1 or are there still any problems when changing window size?

- Michael
From: Przemas
23 Jul 2019   [#18]
@Pilou: trimstencil is 5, so less -> that's a win :P . It get's even better in more complex situations (more objects for example). And note I'm not trying to force anyone to use a given method - quite the contrary, I fully understand often there are multiple ways to reach the solution. I simply tend to look for one that requires least amount of steps :) .

@Michael: thank you for the links. For sure will start tinkering in the weekend :) . Html should make it easy to do customization - glad to hear it works this way.

As for __GL_MaxFramesAllowed=1 - so far I haven't encountered any issues with the trial version. Tried in KDE and Gnome. No issues at all (fingers crossed) - really feels like a native app.
Atm I have some hope to try packaging the prepped version into Appimage. Should work a treat.
With MoI V4 and DXVK it should be even better :) (once it is released).
From: Frenchy Pilou (PILOU)
23 Jul 2019   [#19] In reply to [#18]
So you win... and we have won also a new command! ;) Thx to Michael for that!

And put it on my French site! ;) http://moiscript.weebly.com/trimstencil.html
(curiously i don't need to make a French translation...


From: TOM (SIRTOM)
29 Jul 2019   [#20]
Wow, thats a great new tool - thank you also from my side, Michael !

Show messages: All  1-7  8-20