[scripting] Remove that hole!

Next
 From:  9krausec
9671.1 
Hey gang! I'm in need of some scripting help on how to remove a split through hole shown below. The real roadblock here is that edge cutting straight down the hole that has me stumped. With that edge down the middle of the hole, I cannot simply split all surfaces and delete internal edges because the two edges comprised of the hole are actually naked edges of their respective patch.

Any help here would be greatly appreciated. Thank you. - Clayton


Current situation:



Desired situation:


  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Phiro
9671.2 
Could you post your file ?

Easier to test and give you a method.

Not to give you a script but to study where is your problem.
I think a script could not work in all cases. A reconstruct process is perhaps better.


For you example, I think the easier way is to rebuild the surface with its edges.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  9krausec
9671.3 
Sure thing! Please see attached. Thank you for the reply.

I've been cranking on this all day with varied results. In this scene there are two types of holes, one without the split (easy to get rid of) and one with the split (not so easy). Let me know what you come up with, I'll keep trying over here. Thank you!

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  9krausec
9671.4 
The ultimate goal output is this image below showing all holes capped -


  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
9671.5 In reply to 9671.4 
Hi 9krausec, you can use untrim and then retrim to do that. There is a tutorial here on this kind of object repair work:
http://moi3d.com/forum/index.php?webtag=MOI&msg=446.17

For your case here it would go like this:

Select these faces:


Then use Delete, which will give you this result:



Select the 2 edges that make up this hole:



Then use Delete which will remove that trimming boundary and give you this result:



Now select the 2 edges for the top hole:



And use Delete which removes that trimming boundary and gives this result:




Now for the last hole, it's a little trickier because the hole isn't made from one single trimming boundary, there are 2 trimming boundaries that make up that hole because it is between 2 different faces.

So you'll need to select this face and use Edit > Separate to break it off from the main object:



Then select this edge:



Now use Ctrl+A to select all the face's edges and you will have the entire outer trimming boundary of the face selected like this:



Now when you do Delete you'll see that since this is the outer trimming boundary of the face instead of an inner trimming boundary, the entire "underlying surface" of the face will be recovered and it happened to be a ways larger than the initial visible area:



So now you'll need to use Edit > Trim to cut that face back to the smaller size, or actually in this case a shortcut is to use the ShrinkTrimmedSrf command (http://moi3d.com/3.0/docs/moi_command_reference10.htm#shrinktrimmedsrf) - type Tab then ShrinkTrimmedSrf and then Enter, before you do the untrim and then you you won't have to retrim it.

Do that on the other side too (or mirror the piece) and then use Edit > Join to glue it back together into a solid.

Hope that helps!

- Michael

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  9krausec
9671.6 
Thank you Michael for the reply! I'm however trying to do this 100% through your Javascript library which is where I'm scratching my head. If I were to go about this manually, it would be cake. Trying to build up a reusable tool for hole removal. Here are my steps so far that I'm able to get all through Javascript. Maybe you have an idea of a different approach? Below each photo represents a step in my target process. So far, I figured out how to script up to step four.. If you have a better approach or how to proceed past step four, I'm super interested! Thank you.










---------------------------------------------- Successful above this line -----------------------------------------------------








EDITED: 1 Feb 2020 by 9KRAUSEC


  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
9671.7 In reply to 9671.6 
Hi Clayton, so you mean you want to do the entire process without any user interaction at all, not even selecting an outline of the hole to remove?

That will probably be very difficult, there is no "recognize what is a hole and what is not a hole" function in MoI, and I don't know how you would approach that in a script.

I guess you might start looking at research papers? You could try "feature recognition" as a search term.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Cemortan_Tudor
9671.8 
moi doesn't have stacking history - so u'll have to repair
better keep all construction lines under a hidden layer & rebuild geometry after
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  9krausec
9671.9 
"Hi Clayton, so you mean you want to do the entire process without any user interaction at all, not even selecting an outline of the hole to remove?"

^ Yep! I was hoping I could get away with it. So far I've gotten internal holes to work the way I want them to, but these split holes made up of two faces have got me stumped. I'll look into some research papers about feature detection to see if I can decipher and apply their secrets.

After reading up on the topic here on the forum, it seems like their isn't a way to filter edge selection based in surface continuity to be able to target all "hard" edges. Would you please confirm this as the case?

Thank you for all your replies! I'm no where close to a genius, but I'll do some research on white papers as you have suggested.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
9671.10 In reply to 9671.9 
Hi Clayton,

re:
> After reading up on the topic here on the forum, it seems like their isn't a way to filter
> edge selection based in surface continuity to be able to target all "hard" edges. Would
> you please confirm this as the case?

There isn't any pre-packaged way to do that but I think there is now enough surface evaluation stuff exposed to script that your script could determine this.

That would be something like test several points between edge.domainMin and edge.domainMax , call edge.evaluatePoint( t ) to get a 3d point along the edge, for each face call face.dropPoint( pt ); to get the face's uv parameter space value of the 3D point, call face.evaluateNormal( uv ) to get the normal vector and compare the normals of each face.

I'll see about adding in a more convenient way though.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  nameless
9671.11 In reply to 9671.10 
This is so interesting to me. Following this thread! :)
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All