[Plugin] Manifold v2.2

[Plugin] Manifold v2.2

Postby TIG » Sun Jan 24, 2010 7:55 pm

Copyright 2010 (c), TIG
All Rights Reserved.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES,INCLUDING,WITHOUT LIMITATION,THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
###
manifold.rb
###
It looks at the contents of a selected group and tries to fix it so it
is 'manifold' for 3D-printing etc.
The group needs to be a 3D shape which is fully surfaced without
internal divisions or intraneous/extraneous geometry/entities...
When run...
It removes 'non-face/non-edge' entities.
It removes 'disconnected geometry'.
It removes 'unfaced-edges'.
It runs an initial 'health-check' and reports.
It removes face 'flaps'.
It heals 'holes'.
It removes 'internal faces'.
It orients all faces consistently to face 'outwards'.
It erases 'coplanar edges' [optional].
It 'triangulates' all of the faces [optional].
It highlights major errors.
###
Usage:
Select a group that is at least a bit 'manifold' [ give us a break ! ]
Select the tool from the Plugins Menu > 'Manifold'
OR type 'manifold' in the Ruby Console
OR activate the 'Manifold' toolbar from View > Toolbars and click on
its button.
It then processes the group, making a modified copy of it set off to
one side.
If it has errors then a nested group is overlaid that has these
errors highlighted - red for removals, green for healing.
This error-group has a 'text-handle' so you can easily select it to
move it away or erase it later...
There is a closing dialog which either tells there were no major
errors [although it might have removed non-face/edge entities or
oriented faces and done some triangulation] or it reports the number
of errors.
If X-ray mode is off it asks you if you want to change to X-ray Mode
to look inside the group to see what has been affected.
On Yes/No the tool closes, with the new 'manifold' group now selected.
Otherwise OK to end, with the new 'manifold' group now selected.

Donations:
Are welcome [by PayPal], please use 'TIGdonations.htm' in the
../Plugins/TIGtools/ folder.
OR

Version:
1.0 20100124 First release.
1.1 20100124 Menu typo glitch fixed.
1.2 20100125 Ticker added. Better processing for inner faces.
Three-faced-edged external-faces now usually kept.
FR lingvo updated by Pilou
1.3 20100126 Trapped near colinear/planar points healing crashes.
Very small edges now 'erased' by combining vertices.
Orienting faces is now 'foolproof'.
Unhealed or Failed Fixes now reported - with failed
edges shown as . or -.- clines in Error Group.
Now only asks Y/N change to Xray mode if not on already.
1.4 20100127 Minor zero length vector glitches trapped.
Better inner 'flap' removal algorithm.
1.5 20100129 Mesh is now intersected with self before processing.
The flattenUVQ glitch addressed.
Small line healing length now 0.5mm.
New group's edges NOT hidden/smoothed/softened/layer0...
Ticker made verbose. Test loops now break if 'ok'.
Cline 'errors' shown with cpoint ends for clarity.
ES lingvo updated by Defisto.
Updated all lingvo files for new strings.
1.6 20100130 Face making error fixed, 3-edge faces removal improved.
Sub-groups/Instances now within Group removed & reported.
Error reporting improved.
1.7 20100131 Inital quick 'Health-Check' introduced: Y/N to continue.
1.8 20100131 Final triangulation is now optional - Y/N.
1.9 20100031 Health-Check now traps for 'No Geometry' in group.
2.0 20100201 Very small face glitch fixed during health-check.
2.1 20100209 Optional 'erase coplanar edges'. Piou updated FR lingvo.
2.2 20100222 Tooltips and other Strings now deBabelized properly.
FR lingvo updated by Didier Bur.

TO DO: Get three-faced-edges external-faces to be retained in 'pretzels'.

Extract the files from the zip in their folders - manifold.rb and deBabelizer.rb go into the ../Plugins/ folder - overwrite anything already there. The other files are the lingvo translations, image files for the toolbar button and the donation html stuff - these must remain in the ../Plugins/TIGtools/ folder [just as they come zipped] - if you already have this folder these files are added into it...I attach a tester SKP but I'm sure you'll find much more complex challenges...
manifold tester.skp
Manifold_2.2.zip
0
Last edited by TIG on Tue Feb 09, 2010 1:23 pm, edited 14 times in total.
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Manifold

Postby thomthom » Sun Jan 24, 2010 7:58 pm

How do you determine what an internal face is?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Manifold

Postby TIG » Sun Jan 24, 2010 8:00 pm

thomthom wrote:How do you determine what an internal face is?

See the code remove_inner_faces() - it seems to work... probably break when pressed ??? This is my first beta release...

I had a complex method involving doing an MIR type scan slice in the Z and then the X [to catch flat internal faces] progressively through the group [though not needed at every 0.5mm since we can determine any 3-faced edges and just start a small amount into them to get the relevant faces] and then intersecting the slice with the group and finding any split surfaces made where an internal face intersected it etc and then finding a point on that split-line and testing it to see if it was on a face that's internal and then erasing it etc etc... BUT dough-nut shaped groups really screwed this up so I reverted to the simpler version you see here... :roll:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Manifold

Postby thomthom » Sun Jan 24, 2010 8:17 pm

It sure seem to work at whatever I've thrown at it so far.
Mind if I sample the code logic for an implementation in Cleanup?


btw:
Code: Select all
Error: #<NoMethodError: undefined method `db' for #<Sketchup::Face:0xf54e668>>
C:/PROGRA~2/Google/GOOGLE~1/Plugins/manifold.rb:293:in `orient_manifold_faces'
C:/PROGRA~2/Google/GOOGLE~1/Plugins/manifold.rb:332:in `orient_faces'
C:/PROGRA~2/Google/GOOGLE~1/Plugins/manifold.rb:330:in `each'
C:/PROGRA~2/Google/GOOGLE~1/Plugins/manifold.rb:330:in `orient_faces'
C:/PROGRA~2/Google/GOOGLE~1/Plugins/manifold.rb:95:in `activate'
C:/PROGRA~2/Google/GOOGLE~1/Plugins/manifold.rb:454:in `select_tool'
C:/PROGRA~2/Google/GOOGLE~1/Plugins/manifold.rb:454:in `manifold'
C:/PROGRA~2/Google/GOOGLE~1/Plugins/manifold.rb:470
C:/PROGRA~2/Google/GOOGLE~1/Plugins/manifold.rb:470:in `call'

though the script appear to complete...


And why did you comment out the disable_ui argument? (line 85) @model.start_operation((db("Manifold")))#,true) ### ?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Manifold

Postby thomthom » Sun Jan 24, 2010 8:33 pm

On a sidenote: you can save some lines in your remove_inner_faces method by using more of Ruby's Enumerator and Array methods:

Code: Select all
def remove_inner_faces()
   faces = @gents.select { |e| e.class==Sketchup::Face }
   faces_to_go = faces.select { |face| face.outer_loop.edges.any? { |e| e.faces.length > 2  } }
   faces_to_go.each{|e|
      if e.valid?
         clone_removed_into_error_group([e]+e.edges)
         e.erase! if e.valid?
      end#if
   }
end

I just noticed them not too long ago while having another look at the Ruby docs, I realised I could cut down a number of lines in most my scripts.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Manifold

Postby thomthom » Sun Jan 24, 2010 8:36 pm

Just noticed, when I reload your script, load 'manifold.rb' it keeps adding more menu items.

Think it's because of the last line: file_loaded(__FILE__)
Should it not be: file_loaded(File.basename(__FILE__)) ?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Manifold

Postby thomthom » Sun Jan 24, 2010 8:40 pm

Just realised the cause of the error I reported earlier:

You're calling msg=(db("Manifold: Orienting Faces")) from within the class Sketchup::Face scope, while db() is defined within the Manifold class.

Making db() into a Class method instead of Instance method def self.db(string) and changing

msg=(db("Manifold: Orienting Faces")) to msg=(Manifold.db("Manifold: Orienting Faces")) (line 304)
and
puts(db("Manifold: orient faces aborted.")) to puts(Manifold.db("Manifold: orient faces aborted.")) (line 318)
makes it work.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Manifold

Postby TIG » Sun Jan 24, 2010 8:41 pm

thomthom wrote:Just noticed, when I reload your script, load 'manifold.rb' it keeps adding more menu items.

Think it's because of the last line: file_loaded(__FILE__)
Should it not be: file_loaded(File.basename(__FILE__)) ?

whopops ! update in the pipeline... :oops:
I'll also fix the db() error...
0
Last edited by TIG on Sun Jan 24, 2010 8:48 pm, edited 1 time in total.
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Manifold

Postby thomthom » Sun Jan 24, 2010 8:46 pm

The groups that it creates, is it suppose to be offset from the original group?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Manifold

Postby thomthom » Sun Jan 24, 2010 8:55 pm

thomthom wrote:On a sidenote: you can save some lines in your remove_inner_faces method by using more of Ruby's Enumerator and Array methods:

Code: Select all
def remove_inner_faces()
   faces = @gents.select { |e| e.class==Sketchup::Face }
   faces_to_go = faces.select { |face| face.outer_loop.edges.any? { |e| e.faces.length > 2  } }
   faces_to_go.each{|e|
      if e.valid?
         clone_removed_into_error_group([e]+e.edges)
         e.erase! if e.valid?
      end#if
   }
end

I just noticed them not too long ago while having another look at the Ruby docs, I realised I could cut down a number of lines in most my scripts.


Never mind this code. Seems to have a bug in it.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Manifold

Postby thomthom » Sun Jan 24, 2010 8:56 pm

Got a case where the internal faces is removing too much. See attached file. Run the script on the large cube.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Manifold v1.1

Postby TIG » Sun Jan 24, 2010 8:57 pm

Here's v1.1 with some glitch fixes viewtopic.php?p=218691#p218691
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Manifold

Postby TIG » Sun Jan 24, 2010 8:57 pm

thomthom wrote:Got a case where the internal faces is removing too much. See attached file. Run the script on the large cube.

I'll look into it...
EDIT: removes innermost groups of outer-faces [?] AND leaves internal-faces edges behind [that's an easy fix] :?:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Manifold v1.1

Postby driven » Sun Jan 24, 2010 9:49 pm

fantastic,

go out on a family errand and come back to a whole new playing field, anything I can do to help?
a 'test' skp, if you need something more taxing,
or I'll try repairing it myself when you've got the next one up...
or need a tester... whatever you need...

TIG_WATERTIGHT-MESSAGE.jpg

Question_4_TIG.skp


john
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Manifold v1.1

Postby TIG » Sun Jan 24, 2010 11:10 pm

driven

I'll look at your problem - TT has already come up with one set of problems to fix !
With yours I get a non-planar points error - since there's only 3 of them it seems a bit strange... :?
We're really at 'beta' testing now - I only outlined the ideas some hours ago and issued this as my first go - it WILL get better ;)
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Manifold v1.1

Postby pilou » Sun Jan 24, 2010 11:15 pm

Very useful for boats builders ;)
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] Manifold v1.1

Postby driven » Sun Jan 24, 2010 11:50 pm

Pilou wrote:Very useful for boats builders ;)

and don't forget the humble Air Bed makers of the world...

TIG,
I did this simply to save you having to draw-up or look for something relevant to test on

the last 3 letters in watertight might contain none planer points, one had to be over-drawn with a poly-line and two unsoftened with eraser on the bottoms, before I could JPP them, oh the bottom of that A I made a real hash of.. missed it out and went back... I was in a rush...

I made the ring quite well, two joints (triangulated) near you name, I chose a ragged font in an attempt to create tiny voids and was surprised how well it came out. Fredo's Joint PushPull is remarkably clean, I have another test piece on file that is pilfered with bad seams if that's more useful.

john

I'll give anything a spin, it's great that your on the case...
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Manifold v1.2

Postby TIG » Mon Jan 25, 2010 2:07 am

Here's v1.2 viewtopic.php?p=218691#p218691
Basic Ticker added. Better processing for inner faces.
Three-faced-edged external-faces now usually kept. [fixed TT's ball-breaker boxy mess :D ]
FR lingvo updated by Pilou. ;)

Still struggling with driven's monster...

More feedback and ideas please... :ugeek:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Manifold v1.2

Postby driven » Mon Jan 25, 2010 2:20 am

TIG wrote:Here's v1.2 viewtopic.php?p=218691#p218691
Still struggling with driven's monster...

More feedback and ideas please... :ugeek:


that's the simple version, so far it's taken 2hrs 14 min and 49seconds just to explode all the groups so I can then re-group to test the plug on it (and it's only 600,000+ poly's)

I just fired up the other computer so I'll do some simple tests on it, while I wait
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Manifold v1.2

Postby TIG » Mon Jan 25, 2010 2:24 am

driven wrote:
TIG wrote:Here's v1.2 viewtopic.php?p=218691#p218691
Still struggling with driven's monster...
More feedback and ideas please... :ugeek:

that's the simple version, so far it's taken 2hrs 14 min and 49seconds just to explode all the groups so I can then re-group to test the plug on it (and it's only 600,000+ poly's)
I just fired up the other computer so I'll do some simple tests on it, while I wait


I've added some more error reporting in the console to my own version so I can at least see what these errors are - seems related almost exclusively now to healing very tiny holes ?
I'm thinking perhaps to move these vertices to heal these tiny gaps rather than fail making edges that are too small inside a 'rescue' ? It would change the model's form, but so slightly you'd never notice...

Watch this space :ugeek:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Manifold v1.2

Postby driven » Mon Jan 25, 2010 2:38 am

Did you scale it up even more?
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Manifold v1.2

Postby TIG » Mon Jan 25, 2010 2:51 am

driven wrote:Did you scale it up even more?

Scaling it up x100 or so might make the tiny gaps 'face' - but I looking at pinching the nearly closed verices together so that the gap goes... without much success it has to be said ! :(
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Manifold v1.2

Postby driven » Mon Jan 25, 2010 3:53 am

manifold_test02.jpg


works on Mac

no Jade highlighting on second test, this model was coloured, 1st wasn't

hole repair goes from every other vert on torus?

messages

2 then
manifold, orienting faces then
6
no option dialogs, etc...(should there be?)

CadSpan Style shows up no reversed faces after, GOOD

I'll try more
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Manifold v1.2

Postby driven » Mon Jan 25, 2010 3:58 am

Sorry. shows up when I click on that repair, the first was there from the top, I'm sure....
manifold_test03.jpg
EDIT: and it ungrouped separate geometry?
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Manifold v1.2

Postby driven » Mon Jan 25, 2010 5:05 am

OK, am I following this a bit better now.

I got a Manifold dialog-box on the comp_fish when no repairs were needed and the new group is moved to one-side, [url]/viewtopic.php?f=10&t=25473&p=218811#p218811[/url]

on the other, after the repairs were done, all 3 two manifold bits stayed in place so I get the 6 meaning six manifold selection? and the box points just stay to one-side.
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Manifold v1.2

Postby driven » Mon Jan 25, 2010 5:13 am

EDIT: CRASHED OUT SU 20 seconds no crash report, and SU restarted on a new drawing, now that has [b]never happened before, and I mean everever SU doesn't restart....[/b]
ready for a more advanced test.jpg


how odd, so I think I'll play some more
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Manifold v1.2

Postby TIG » Mon Jan 25, 2010 10:36 am

Run with the Ruby Console open for error reports - a new version will be available soon that I hope will be more robust...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Manifold v1.2

Postby thomthom » Mon Jan 25, 2010 10:56 am

TIG wrote:Three-faced-edged external-faces now usually kept. [fixed TT's ball-breaker boxy mess :D ]

Very interesting. I was stomped on this when I some time ago tried to make a remove_inner_faces script. Will have to snoop around the code. I'll probably dig up some more fun geometry - thing I got a batch of trouble-samples... :D
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Manifold v1.2

Postby thomthom » Mon Jan 25, 2010 10:58 am

TIG wrote:I'm thinking perhaps to move these vertices to heal these tiny gaps rather than fail making edges that are too small inside a 'rescue' ?

You need to rescue? Doesn't add_face return nil if it fails?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Manifold v1.2

Postby TIG » Mon Jan 25, 2010 11:43 am

thomthom wrote:
TIG wrote:I'm thinking perhaps to move these vertices to heal these tiny gaps rather than fail making edges that are too small inside a 'rescue' ?

You need to rescue? Doesn't add_face return nil if it fails?

Yes BUT then I do things with the face that fail if it's nil - if the points are non-planar - which I can't see how but it rarely says they are - perhaps co-linear there's an error - therefore a rescue seems appropriate - I need to look at how I get these points.
At the moment to 'heal' a gap we find an edge with only one face and if it has a shared vertex with another edge then we try to use three points from their vertices' points to make a face - however it's possible for the points to be co-linear or virtually so and no face gets made... I'm looking at a more robust algorithm that ensure such edges are 'faceable' before trying it... :roll:
0
TIG
User avatar
TIG 
Global Moderator
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: daaniisan and 5 guests

Visit our sponsors: