sketchucation logo sketchucation
    • Login
    1. Home
    2. jolran
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 37
    • Posts 1,027
    • Groups 2

    Posts

    Recent Best Controversial
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      @unknownuser said:

      test the edge's midpoint for being 'on the face' or on a face's edge if it is then it's NOT in a hole so we keep it [i.e. it's a perimeter edge or a line spanning from one edge to another across the face itself rather than across a hole], but if NOT then it's to be erased as it is spanning over a hole...

      Yes, this code, no? if face.classify_point(edge.start.position.offset(edge.line[1, edge.length/2))==Sketchup::Face::PointOutside]

      I'm working on the face thing now.. If I get that working there should be some serious testing, and then come back and fix things if needed.

      And yeah! There are speed increases. I will time it later when doing som more complex geometry.

      Thanks for this TIG.

      If this will get OK, Hatchfaces would use this intersection as well. Am doing some JS, html tutorials at the same time as coding πŸ˜‰

      posted in Plugins
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      Well I think we are back to par with this method!

      And it seams a whole lot faster. Haven't tried on heavy geometry. But It really feels faster.

      It seams to erase edges as it should be. And on the + side edges inside holes get's erased, which is really good.

      Actually point outside is all you need. I don't think there is any need to test on every scenario?

      I've set up the iterator like this. Where gp2edge is edge.array and comparefaces are the face to be used in classify point.
      Names will get shorter later on. I think it's good when workin on the code to have explaining names..

       gp2edge.to_a.each{|edge| 
                    comparefaces.to_a.each{|face| 
      	   
      	                    if face.classify_point(edge.start)==Sketchup;;Face;;PointOutside and              
                                 face.classify_point(edge.end)==Sketchup;;Face;;PointOutside
      					       
      						   gp2ptogo << edge
      				       
      					   end
      	                    
      						if face.classify_point(edge.start.position.offset(edge.line[1], edge.length/2))==Sketchup;;Face;;PointOutside
      				           
      						   gp2ptogo << edge
      				      
      					  end
      				
      				} 
                  }
      

      Now if we could just get rid of the faces in the holes. I'm gonna try pt=tface.bounds.center.project_to_plane(face.plane) and see what happends....

      posted in Plugins
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      @unknownuser said:

      I'm trying to suggest a streamlined approach

      I will try to do my best. I think I know now what you mean. If I do it right, I think we will see some speed improvements as well.

      Finally time to do some coding, been preoccupied with bunch of boring things today.

      Off to work πŸ˜„

      posted in Plugins
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      @unknownuser said:

      NO, NO, NO!

      πŸ˜„ I think I explained the question poorly. SWEnglish at it's worst. Haven't you seen the Swedish chef in the Muppet show?

      I know about http://code.google.com/apis/sketchup/do%20...%20sify_point Im already using it in the code πŸ˜‰

      The question was. Only 1 iteration?

      If you have looked at my code you see that I first collect edge.start, edge.end and edges. THEN I collect the points outside the face. After that I collect edges that are connected to those vertices. So all in all 3 iterators for just 1 purpose.

      What I meant about point3d on_line, was that WHEN I was looking at that method in the API I realized I should use 1 iterator, NOT that I should use point 3d on_line. That's a whole different matter πŸ˜„

      Earthmover wrote:

      @unknownuser said:

      Seriously, though your patience and constant help is much appreciated.

      You bet! I'm deeply greatful.

      Therefore Here Ya go!


      dry-martini2.jpg

      posted in Plugins
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      Wait. I think I got it backwards, TIG..

      I was looking in the API, and the closest thing to compare an point on edge was, point3d on_line.
      What I could see.

      Then realized, maybe you meant that there should be only 1 iteration, in edge.array?

      Iterate through edge.array, do the tests. If true or false(depending on the test) then edges2go << edge ?

      After that, erase arrays entitiesedges2go?

      Is it something like that what you had in mind, TIG?

      posted in Plugins
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      Wow, TIG! Will be interesting to test your new approach.

      BTW:

      @unknownuser said:

      tr=Geom::Transformation.new()
      group.entities.intersect_with(true,tr,group.entities,tr,true,(face.edges+[face]))
      You then then collect all of the edges in the group.
      Make an array - edges2go=[]
      Test each edge in turn.
      pts=edge.start.position
      then
      pte=edge.end.position
      against face.classify_point(pts) etc

      Isent this what I'm doing already? Except (face.edges+[face)] is a group(gp3) for me?
      Or did I misunderstand you? Anyway, that may not be of relevance for fixing the problem.

      I think the main problem is that, after the collection of points "outside" face I have been using if edge.used_by? point to select and erase the edges. Passing on the point as argument. (In reality point gets converted to vertices). That way I can never erase an edge if it's not used by "something".

      I guess your way is to tell Sketchup. If point is on edge? Put that edge in the "erase" array. Is that correct?

      This all have to be done in an iterator, right? With some conditionals inside the iterator. I spent all day yesterday to find suitable API methods to fit the need, but really need some IF, NOT and OR statements? Or am I wrong here in my assumption?
      I guess the iterator will be faster if the statements are made outside..

      I will try those things and pt=tface.bounds.center.project_to_plane(face.plane) and the edge.midpoint test as well.

      Again, thanks a lot!

      posted in Plugins
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      I have to call it a day. Been at it since morning without any results. Your new approach here give me hope. πŸ‘

      I will sleep on it and try this tomorrow.

      Thanks for helping me out TIG. πŸ˜„

      posted in Plugins
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      @unknownuser said:

      NO !

      Clear enough πŸ˜„

      Ok, I will continue with this method. You showed me some new moves there I haven't tried.

      posted in Plugins
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      Another question TIG, about start point offset to mid. I put you formula iterating through edges. And yes, I see the additional midpoints being counted(using puts).

      Question is. Can points be used for erasing edges that way? Must not there be a vertice on the edge at that position to be able to delete the edge? I'm using If edge used by?
      But the edge is not using that offset point, it's just a dot in space. Am I getting it wrong?

      I suppose I could use edge.split at that mid.point. But that would DOUBLE the vertices and have splits in the middle of every edge in the component! Could kill Sketchup, having patterns like Earthmover was showing?

      @unknownuser said:

      I think you need to take a step back on this face with holes issue...

      Yeah, getting crazy about it...

      posted in Plugins
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      @unknownuser said:

      If the originally selected face has holes then your cloned face can too...

      I hope the picture from last post did not make it look like I was having problem with the face.clone? It's the colored face(cutting comp) that is not getting holes, when totaly covering the holes. I provide another (more illustrating) picture.

      @unknownuser said:

      offset the start point towards the end point to find the midpoint of the edge mid=edge.start.position.offset(edge.line[1],edge.length/2) - now test that 'mid' point and if theta point returns 'true' for 'on face and not in hole' or 'on edge' then we know that that edge passes as its either a perimeter edge OR spanning a convex corner so it's 'on-face', but if it fails it's across a concave corner and it's listed for erasing later...

      That is pretty clever πŸ˜„ That will help to get rid of edges in holes.

      @unknownuser said:

      the unwanted faces will go with them...

      Probably not every time? Look at the picture, the big hole has no edges in it. Faces without edges in them will not get erased.

      Thank you for the help, TIG. I will try to get this working.


      separated result.jpg

      posted in Plugins
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      I'm wondering if the "hole" issue can be solved at all using face.classify method. πŸ˜•

      Watching Eartmover movie one can see he using a lot of detail in his meshes. Doing that, you will probably get faces and edges erased from holes, of the face it's glued to. Wich is the desired result!

      But if you are using less geometry for intersecting! For ex just a 2d square covering some holes. The face covering the hole will not be deleted cause there arent any vertices in the hole. The same if you have an edge crossing over the hole it will be assumed to be outside the hole, and therefore not deleted.

      Now, I have come so far to create a new group inside the colored group, that is a face_clone of the "holes".
      Don't know yet how I am going to use it as a reference for what to delete, since the faces are inside an individual group.
      Tried exploding it but the reference to the faces gets deleted.

      This could take a while to fix...


      dilemma.jpg

      posted in Plugins
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      Earthmover! β˜€

      That's quite a demonstration. Really! I can see here experienced modelers can find new workflows. Nice use of styles too.

      I know it's a bit slow when having a lot of geometry. It will be faster in Hatchfaces (tiled patterns without faces).

      Anyway, thank you for a nice video.

      posted in Plugins
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      Sorry my post was unclear and made in a hurry 😳

      Yes it's an array of face.vertices. The one from face.clone, faces to go.

      I suppose there are multiple ways of achieving what I want. But I have failed so far.
      Will try some combination of @verts[0.loops.include?(e.outer.loop)] as you suggest, see what happends.
      There could be scenarios where the faces has multiple "holes", so e.outer.loop==@verts[0.loops[0]] might not work.

      Thank you TIG.
      Off to try!

      posted in Plugins
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      I think I am close fixing this hole problem.

      So I have made a collection of verticies(from face.clone) That binds the innerloops in faceclone(faces to go)

      I want to use that collection to erase the faces in the boolean group.
      This does not work 😞

      (@verts=vertex collection) need to be instance variable or it will get deleted..

      cents.to_a.each{|e| 
      		       if e.class==Sketchup;;Face and e.outer.loop==@verts.loops
      		          gp2faces2 << e
      			  end
      			}           
      			
      			cents.erase_entities(gp2faces2)
      
      posted in Plugins
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      I think I know why faces in holes don't get erased.

      Face.classify point only deals with points/vertices. So if there is a face in a hole inside the face(inner edge loop). Erasing the vertices from face.classify point outside(holes included) does not erase the face in the hole at all times πŸ˜•

      Don't know how to solve that one yet.. But at least I know what's wrong.

      I reckon the plugin is kinda useless, unless I fix this. So it's got high priority now.

      posted in Plugins
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      Small update. Now If you have a component that have gluing behavior you don't have to select a face to run the plugin. I noticed you run into situations quite often where that is needed. Like when the face is covered and you can not select it. πŸ˜„

      This will not work with groups.

      posted in Plugins
      jolranJ
      jolran
    • RE: DC instance make unique

      That's all very interesting, and probably quite important for us new to Sketchup Ruby to understand how groups and components works.

      @unknownuser said:

      If you compare the method lists, between Group and ComponentInstance, you'll see they have nearly the same methods.
      The difference? A Group cannot be saved out to a file (directly) for use in other models, and it's easier to get at a ComponentInstance's definition, because there's an API method for it.

      I was wondering about behaviors? I noticed that if you have a face, draw a square on it and 3pl click to select. Then make a group out of that, it will behave like a cutting component onto that face. You can even unglue it if you rightclick.
      However there is no "glue_to" method for groups in the API.

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: DC instance make unique

      @unknownuser said:

      I do not see a dedicated boolean API method to test a Group or ComponentInstance for uniqueness.

      Interesting reading.

      That confuses me how groups work in SU. It feels like they are Component "light", where they logically(in my head) should only be a group of geometry, and not more than that.

      I guess uniqueness has an importance when working with nested DC's. Sometimes find them hard to explode.

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      Cool. So you can erase the group by erasing it's entities while inside a start/commit block? That could be useful, thanks.

      posted in Plugins
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      I did not know that. Good info. Garbage collection? Well in this case all the groups and defs are made within the block, so all good? Of course the group or definition would have to empty..

      posted in Plugins
      jolranJ
      jolran
    • 1 / 1