• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

[Plugin] Hatchfaces (v1.8 beta) UPDATED 15-Dec-2012

Scheduled Pinned Locked Moved Plugins
360 Posts 41 Posters 228.5k Views 41 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    jolran
    last edited by 8 Aug 2011, 15:31

    OR do a face_clone of the DC with material and all. Then erase everything outside the original selected face!!!

    Wonder if that's possible.. Would be the safest method, I believe..

    There is a problem exploding nested components. And it's needed to get whole model edge, face, vertice collection?

    Edited: No, no, no... Not face_clone. Will have the material problem then again if moving over stuff to a new entitiy..

    1 Reply Last reply Reply Quote 0
    • J Offline
      jolran
      last edited by 9 Aug 2011, 08:54

      OK a little more rabbeling. Maybe it can help someone in similar situation.
      Although I must warn! It's not about booze and women πŸ˜„

      Have experienced plenty of crashes. Did put the DC in a new group and exploded the entities therein.
      It's difficult to get to entities and iterate a collection in nested components, if the components are not exploded?

      Probably the user want's to keep the DC for further editing anyway? So to explode the DC would not be very polite.

      So new aproach is to make an instance of the DC. Explode the shit out of it, and extract edges and faces and materials if possible and get rid of it. THEN recreate the dc from that information on to the faceclone or vice versa. Probably have enough information to know what to erase, and then do erasing.
      That IS probably the way to play safe.

      I get the feeling it's risky doing things with entities of current Sketchup selection? Grouping, exploding etc.
      If you clone them, or copy. You can do what the heck you want with the copies?
      That IS probably the way to play safe. And I sence that is what TIG is doing in his scripts.

      I noticed that faces and edges created in code doesent behave like they do in normal Sketchup modeling. In code if you split a face with an edge you don't get 2 faces! The edge lie on top of the face. Therefore one must use intersect with.
      Although I have also noticed some inconsistency in this!
      But if it's true, orders of drawing things won't matter that much, wich is a good thing.

      1 Reply Last reply Reply Quote 0
      • J Offline
        jolran
        last edited by 10 Aug 2011, 16:18

        Things are not going so well. Doing a pattern like on the picture will be difficult.
        Unless black and white. That's no problem to do.

        TIG recommended to clone current selection to avoid bugsplats. I'm fine with that as long as doing faces only.

        But that won't give much flexibility if doing a pattern like on the picture.
        How to clone the edges from an array? And what if you have an edgeloop where you DON'T want a face?
        And materials are still a big problems. If it where only 1 material, things would be relatively easy.
        I guess faces can have attributes like materials, but how to store them and transfer to the face_clone is the question.

        I'm thinking doing an intersection with face, then recreate the facecolor pattern and erase vertices outside the face.
        ATM I get splats when using lot of patterns or nested components with intersection. Things are a lot more stable, since
        being able to explode all the components and add entities to group AFTER the group was created.
        Using few components with plenty geometry is OK. Many components are bad. Even if they contain few entities..

        Could need a push with the materials.. Otherwise I probably will have to restrict the plugin features.


        wierd_pattern.jpg

        1 Reply Last reply Reply Quote 0
        • T Offline
          TIG Moderator
          last edited by 10 Aug 2011, 17:21

          I'm still not entirely sure what you are are trying to do πŸ˜’
          If you want add colored shapes onto a face as a hatch pattern try this...
          Make the cloned face inside the group.
          Add the instances to the group.entities, placed where you will.
          Apply materials to these instances.
          Explode the instances and the default materials in them become their face materials and they merge with the background face.
          Now you need to erase the bits outside of the face bounds.
          Test all of the edges in the group.
          Test their start.position and end.position, on the original face with classify_point to see if that point is 'on the face' [you need also to cover on edge, on vertex and not in hole etc] if both point test OK it's inside the original face. If one or both of them are not the you want to erase them - push into an edges2go array. The erase all of those edges and the faces go with them. Finally erase any faces with 'nil' material [in the gaps from the cloned face], and then any unfaced edges if you don't want a perimeter. You should now be left with the colored shapes trimmed to the original face's edges.

          TIG

          1 Reply Last reply Reply Quote 0
          • J Offline
            jolran
            last edited by 10 Aug 2011, 17:27

            Thank's TIG, I will try.

            1 Reply Last reply Reply Quote 0
            • J Offline
              jolran
              last edited by 10 Aug 2011, 18:46

              Actually when I reread you post TIG. It is probably the way to go.

              I had the idea to make a huge face. Same size as entities.bounds. Add the edgeloops from original selected face.
              And then delete the original face. (Sort of oposite of the face). Then do an intersection with the components.
              The result of intersection could be deleted, and all what's desired would then remain..
              It is all theoretical..

              1 Reply Last reply Reply Quote 0
              • J Offline
                jolran
                last edited by 10 Aug 2011, 19:07

                I will test TIG' solution tomorrow, if time gives. I have another test to do.

                If someone please tell me how I can get the pt's from a boundingbox object. It will only be 4 pt's, boundingbox from 2d hatches.. Will create a face from those points later. Had a look at Thomthoms edges from boundingbox, but it's for a whole "cube" boundingbox. Don't need that much information his script gives.

                I've tried something like this. But it doesent work.

                	centbox=gp2.bounds  #boundingbox object
                			 centpoints=[]; range=(0..7); centbox.corner.range.each{|e| 
                			  if e.valid? and e.class==Geom;;Point3d
                			 
                			      centpoints << e
                			   end
                			 }
                			 
                

                Edited. It probably should be centbox.corner.range. I changed the original. Still doesent work..

                1 Reply Last reply Reply Quote 0
                • T Offline
                  TIG Moderator
                  last edited by 10 Aug 2011, 19:08

                  You don't want the limits of a bounding-box - it's a rectangle, the face might be a circle ! Use my selected_face.classify_points(pt) tests for all edges after the explode/intersect etc...

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    jolran
                    last edited by 10 Aug 2011, 19:16

                    Really? 😲 Bounds=boundingbox, no?

                    So boundingbox will not be like on the picture? darn... Typical.


                    circle.jpg

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      TIG Moderator
                      last edited by 10 Aug 2011, 19:19

                      entity.bounds== a bounding-box rectangular cube - even if the object is the shape of a banana 🀣

                      Use selected_face.classify_point() tests πŸ˜’

                      TIG

                      1 Reply Last reply Reply Quote 0
                      • J Offline
                        jolran
                        last edited by 10 Aug 2011, 19:26

                        Yes. That's what I want πŸ˜„

                        It's for the exterior bounds of ALL entities, not the face. Then from that huge face do a boolean with the selected face.
                        If you intersect with the result from that you have everything intersected in a group wich can be deleted?
                        But ok, I will try what you say.

                        BTW. An exploded comp. don't always transfer the materials to the face lying underneath? It's risky.

                        1 Reply Last reply Reply Quote 0
                        • J Offline
                          jolran
                          last edited by 10 Aug 2011, 19:42

                          No. Exploded instances do not merge materials to the face lying underneath. Is it supposed to happend?

                          1 Reply Last reply Reply Quote 0
                          • T Offline
                            TIG Moderator
                            last edited by 10 Aug 2011, 19:44

                            On an explode it should [untested].
                            Alternative 'intersect' after the explode ??

                            TIG

                            1 Reply Last reply Reply Quote 0
                            • J Offline
                              jolran
                              last edited by 10 Aug 2011, 20:18

                              Well lately I have done quite a few intersects. And the results vary. But no. Materials get lost=white default material.
                              However I will try intersection after exploding things.

                              Thanks.

                              Edited. Not very good results. Things are very negative at the moment. Exploding geometry connected to a face has very destructive behavior. On top of that materials don't get transfered properly, and that was the whole idea of this process.

                              There is more problems. Let's say I can recreate the face-clone first. No problem!
                              On top of the face-clone, recreate the whole component instance. Faces, edges without faces, and materials, in code.
                              Problem here is that I would probably have to do an intersect_with the face_clone, so the edges get connected and form new vertices at the edge crossings. And there the face materials would get lost...In the intersect_with method.

                              There is an theoretical alternative! I woulden't mind the opinions from TIG on this one:
                              If doing an component intersect_with face.edgeloops without face? That would at least give new vertices so the unwanted edges theoretical could be removed. Without affecting materials and destructive behavior (tested). But like the method TIG recommended, selected_face.classify_point(). One would need a face to compare against.
                              Could the face be in a different group? And deleted after comparison? What say you Massa TIG?

                              1 Reply Last reply Reply Quote 0
                              • J Offline
                                jolran
                                last edited by 11 Aug 2011, 06:33

                                Yes. Something positive!

                                An intersect between component(hatch-pattern) and face-clone's edge loops(no face). Gives you new vertices. Without affecting materials and destroying faces! so now it's possible to erase all edges and vertices outside the face.

                                Will see if it's possible to make a comparison against a face in a group. Can't explode it! Destroys everything.

                                1 Reply Last reply Reply Quote 0
                                • T Offline
                                  TIG Moderator
                                  last edited by 11 Aug 2011, 09:09

                                  You can test if a point on a preselected-face in another entities context - BUT you might need to transform! the point by its container[s] transformation back to align with the preselected-face ?

                                  TIG

                                  1 Reply Last reply Reply Quote 0
                                  • J Offline
                                    jolran
                                    last edited by 11 Aug 2011, 11:55

                                    Ah, sounds great, thanks. I will will try that now. Been busy with some other stuff..

                                    1 Reply Last reply Reply Quote 0
                                    • J Offline
                                      jolran
                                      last edited by 11 Aug 2011, 17:08

                                      I think I have a collection of points outside the face now. Plenty of iteration...
                                      There is no way to see the real result until it starts deleting edges. Anyway, see some collection when
                                      using puts.array of points to go

                                      Simple question how do I convert those pt to vertices? Is there a simple way or another comparison?
                                      I guess if getting the collection of vertices it's just a matter of deleting edges connected to that vertice. Edge.used_by?(collection of vertices) ?

                                      1 Reply Last reply Reply Quote 0
                                      • J Offline
                                        jolran
                                        last edited by 11 Aug 2011, 17:37

                                        Hang on! Edge.end and edge.start is vertex objects. I can't use them as point when using face.classify_point()???
                                        In the API face.classify_points needs points as arguments.

                                        How come I get a result from array.length? Strange... Or is there some equallity between points and vertices I'm not aware of? πŸ˜•

                                        Edited apparently πŸ˜„ I get some edge deleted. Almost there I think! Only did comparison against face. Maybe need against
                                        other entities as well.

                                        1 Reply Last reply Reply Quote 0
                                        • J Offline
                                          jolran
                                          last edited by 11 Aug 2011, 19:33

                                          YEEEEEESSSSSSSS!!! ATM I am VERY happY!!

                                          I'm sure there are things tome come that will put me off. BUT at least it's going forward!

                                          I made the misstake of putting the collection of edges BEFORE the intersection. Had some problems with classify points to
                                          edge removals. Anyway look at the picture! It has curves and circles to, with materials.
                                          Now. Must convert it to component, so faces will cut underlying face and materials will get cleaner.
                                          That's for tomorrow!


                                          smiley.jpg

                                          1 Reply Last reply Reply Quote 0
                                          • 1
                                          • 2
                                          • 7
                                          • 8
                                          • 9
                                          • 10
                                          • 11
                                          • 17
                                          • 18
                                          • 9 / 18
                                          9 / 18
                                          • First post
                                            171/360
                                            Last post
                                          Buy SketchPlus
                                          Buy SUbD
                                          Buy WrapR
                                          Buy eBook
                                          Buy Modelur
                                          Buy Vertex Tools
                                          Buy SketchCuisine
                                          Buy FormFonts

                                          Advertisement