MoI discussion forum
MoI discussion forum

Full Version: can we do this at some point?

Show messages:  1-20  21-26

From: BurrMan
1 Apr 2020   [#1]
Hi Michael,
Here is a link to a competitors video: https://youtu.be/2NzhMzZg00w

At 7 minutes an "Extend surface" is shown. Is this functionality something we can get out of current libraries?

Also at 9.20 he uses a "Merge Surfaces"...

Is this stuff something you would like to have in the future, or is it too granular for your liking?

When I get models that need to be "Fixed", the extend surface tool could be really handy. The merge is a good cleanup operation too.

Was even looking for an equivalent in Rhino, but didn't find one on extend. Might have to explore the matchsrf command more over there? (Your input greatly appreciated)

Thanks

(Title edit *CAN)
From: Michael Gibson
1 Apr 2020   [#2] In reply to [#1]
Hi Burr, yup those are things I want to work on. Extend surface is available in the current geometry library it's just something I haven't had a chance to get to yet. It is actually possible to use the Flow command to accomplish it right now though, see here:
http://moi3d.com/forum/index.php?webtag=MOI&msg=9732.4

Basically you make 2 planes, one for the base surface and one for the object to deform and you make the one to deform larger so it spills over outside the base surface. Then when you do the flow it will similarly spill over outside the target surface.

Merge surfaces is waiting for a larger plan on overhauling Join. I want to try and include joining and merging operations in one single command if that's possible. I have some ideas but it will need some experimentation.

re: Extend surfaces in Rhino - there is an ExtendSrf command in Rhino for that.

re: MatchSrf - that's something that is not handled by MoI's current geometry library and is pretty difficult. I would like to have it in MoI too but that one will probably take longer.

- Michael
From: BurrMan
1 Apr 2020   [#3] In reply to [#2]
Thanks Michael,
All of those answers are sufficient and good news. I can just wait and look forward to when more advanced tools get attention. Powerful blend controls will be part of this for sure and will go long ways!

Thanks again!
From: Anthony (PROP_DESIGN)
2 Apr 2020   [#4] In reply to [#3]
Hi Michael,

Speaking of geometry kernels. From previous posts, you seemed to be experimenting with two other products. Have they been helpful? Do you think that you would be implementing either of them, in the future?

Anthony
From: Michael Gibson
2 Apr 2020   [#5] In reply to [#4]
Hi Anthony, I've experimented with 3 other ones. The first one was one of the most well established ones. I found that ultimately it was too finicky handling surfaces with very slight errors in them. Like if a closed surface was more than 1/2 a degree off from being smooth it would refuse to construct it. It's also geared more for "enterprise" type higher cost software with high licensing fees. The second does not have those problems but instead it basically has the same problem as my current one where it isn't on track to get the approx 50 or so man years of focused effort needed to do filleting and shelling very well.

The third one is a little different, it's made by a single developer. It has been very helpful, it is the reason why MoI v4 has a new "best in class" sub-d to NURBS conversion function. It's going to help implementing some various interesting new functions in MoI in the future but I don't really see it as a replacement for the current kernel it's more for adding on some interesting new functions.

There is another one that seems promising and that I would like to experiment with in the future too.

- Michael
From: Anthony (PROP_DESIGN)
2 Apr 2020   [#6] In reply to [#5]
Thanks Michael,

That's great to hear. Sounds like fun work. I look forward to v4 coming out.
From: Michael Gibson
3 Apr 2020   [#7] In reply to [#1]
Hi Burr, here's a plug-in that automates the extend-by-using-flow method:





- Michael

Attachments:
FlowExtendSrf.zip

Image Attachments:
flow_extend_srf_screenshot1.jpg  flow_extend_srf_screenshot2.jpg 


From: bemfarmer
3 Apr 2020   [#8] In reply to [#7]
FlowExtendSrf worked well on a clothoid surface, and a plane.

I was wondering what is accomplished by the code:
while ( factories.length != 0 )
factories.pop().cancel();

A way to clear out the factories array?

- Brian
From: Frenchy Pilou (PILOU)
3 Apr 2020   [#9]
So can be considered as an parametric Offset Surface ?


From: Michael Gibson
3 Apr 2020   [#10] In reply to [#8]
Hi Brian, yes that code will both clear out the factories array while also calling .cancel() on each factory. There's a separate factory for each selected surface and when a UI control has changed that is clearing out any previously displayed result before making new ones.

The JavaScript array object has a .pop() method on it which removes the last element in the array but also passes it back as the return value from pop() so it can be used in this way. This type of construct is called "function chaining" or "method chaining": https://en.wikipedia.org/wiki/Method_chaining .

Another way to write it would be:

while ( factories.length != 0 )
{
    var factory = factories.pop();
    factory.cancel();
}

or something like:

for ( var i = 0; i < factories.length; ++i )
{
    var factory = factories[i];
    factory.cancel();
}

factory.length = 0;


All of those would do the same thing, the pop method with chaining is just kind of nice since it's so compact.

- Michael
From: Frenchy Pilou (PILOU)
3 Apr 2020   [#11]
Extend Surf : French Version somewhere on the page! ;)

http://moiscript.weebly.com/trucs-astuces.html
From: Michael Gibson
3 Apr 2020   [#12] In reply to [#9]
Hi Pilou,

re:
> So can be considered as an parametric Offset Surface ?

Yes, sort of - but usually in CAD that name "Offset Surface" means making a result that is displaced by traveling along the surface normal.

This one instead goes in the UV directions of the surface. You can also put in negative values.

- Michael
From: Frenchy Pilou (PILOU)
3 Apr 2020   [#13] In reply to [#12]
"negative values" : never thougth of that! Very Cool!
From: BurrMan
4 Apr 2020   [#14] In reply to [#7]
yup, that'll do it!!!

Thanks Michael. No need to wait....

Really appreciate the work....
From: Frenchy Pilou (PILOU)
5 Apr 2020   [#15]
Seems this automatic extend don't works for the V3 !
Does this normal ?
From: Michael Gibson
5 Apr 2020   [#16] In reply to [#15]
Hi Pilou, it is possible to modify it to work with v3 - v3 needs to have temporary objects like the planes that are created to be added to the geometry database for async factories (like Flow) to be able to use them. V4 does not require that anymore, in v4 async factories can use "loose" objects (objects not in the geometry database) for input into async factories.

If you replace the Update() function with this below code then it should work on v3 too:

code:
function Update( objects, factories )
{
	while ( factories.length != 0 )
		factories.pop().cancel();

	var base_plane = CreatePlane( 0, 0, 1, 1 ).item(0).getFaces().item(0);

	for ( var i = 0; i < objects.length; ++i )
	{
		var obj = objects.item(i);

		var umin = moi.ui.commandUI.umin.value;
		var umax = moi.ui.commandUI.umax.value;
		var vmin = moi.ui.commandUI.vmin.value;
		var vmax = moi.ui.commandUI.vmax.value;

		var extended_plane = CreatePlane( -umin, -vmin, 1 + umin + umax, 1 + vmin + vmax );

		moi.geometryDatabase.addObject( base_plane.getParentBRep() );
		moi.geometryDatabase.addObjects( extended_plane );

		var factory = moi.command.createFactory( 'flow' );
		factory.setInput( 0, extended_plane ); // objects to deform
		factory.setInput( 1, base_plane );     // base object
		factory.setInput( 2, obj );			   // target object
		factory.setInput( 3, false );           // delete inputs
		factory.setInput( 7, false );          // swap uv
		factory.setInput( 8, false );          // Flip U
		factory.setInput( 9, false );          // Flip V
		factory.setInput( 10, false );         // Flip normal
		factory.setInput( 11, false );         // Projective
		factory.setInput( 12, false );         // Straight for projective

		factory.update();
		factories.push( factory );
		
		moi.geometryDatabase.removeObject( base_plane.getParentBRep() );
		moi.geometryDatabase.removeObjects( extended_plane );
	}
}



- Michael
From: Frenchy Pilou (PILOU)
5 Apr 2020   [#17] In reply to [#16]
Cool! But in what path file is this UpDate function? (for be sure)
From: bemfarmer
5 Apr 2020   [#18] In reply to [#17]
I replaced the UpDate function in the FlowExtendSrf.js file. (or thought I did...)

Edit: Deleted this faulty post.

- Brian
From: Frenchy Pilou (PILOU)
5 Apr 2020   [#19] In reply to [#18]
<< BUT, running the modified script in MoI3 resulted in (endless?) calculating process.

That was the same with the original for the V 3!

And the same with this update, (infinite calculus) there is surely a little bug somewhere...
From: Michael Gibson
5 Apr 2020   [#20] In reply to [#17]
Hi Pilou,

> Cool! But in what path file is this UpDate function? (for be sure)

Well the plugin only has 2 files for it, FlowExtendSrf.js and FlowExtendSrf.htm, and only one of those has an Update() function - FlowExtendSrf.js . That's the one that needs the new code.

- Michael

Show messages:  1-20  21-26