sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ«› Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    Sub-component creation, decoration, etc?

    Scheduled Pinned Locked Moved Developers' Forum
    19 Posts 5 Posters 1.0k Views 5 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.
    • thomthomT Offline
      thomthom
      last edited by

      @martinrinehart said:

      @thomthom said:

      using add_group with entities as arguments has a sad tendency to crash SU.

      I've read this in the doc, but haven't experienced it. Is this a fixed bug?

      I'm not sure. I've not had to do anything like this recently. Though I think Chris recently ranted about this. Try to give him a nudge.

      Thomas Thomassen β€” SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        It will splat if you try to move entities into the entities of a definition and they are cross-threaded to another entity set.
        So model.active_entities.add_group(face) will crash because the face's edges are still in the model !!!
        face=[face]+[face.all_connected]
        model.active_entities.add_group(face_connected) shouldn't fail as nothing will be left behind...
        However, you probably don't want all of the connected bits AND the safe way is to 'clone' it.

        pts=[];face.vertices.each{|v|pts<<v.position}
        mat=face.material
        bac=face.back_material
        lay=face.layer
        attrdicts=face.attribute_dictionaries
        ###
        grp.model.active_entities.add_group()
        face_clone=grp.entities.add_face(pts) ### OK if know it's first and so it's the one and only face ?
        ### if there might be more that one face made by this first make an array of the grp's faces
        ### and after adding face_clone repeat array and the difference is the faces - then loop through each as set out below...
        face_clone.material=mat
        face_clone.back_material=bac
        face_clone.layer=lay
        attrdicts.each{|attrdict|
          name=attrdict.name
          attrdict.each_pair{|key,value|face_clone.set_attribute(name,key,value)}
        }if attrdicts
        ### etc - this doesn't copy the face's edges' attributes/layers/materials, but you get the idea...
        face.erase!
        ### 'face' has been cloned into the group, leaving its edges behind.  It looks like it's 'moved'.  If you had any variables pointing at face that are still used then add
        face=face_clone
        ###
        
        

        TIG

        1 Reply Last reply Reply Quote 0
        • Chris FullmerC Offline
          Chris Fullmer
          last edited by

          The one that caught me for a while is if you add an edge, but it is part of a curve, and you are not adding the rest of the edges in the curve - that will splat.

          So exploding curves is necessary too.

          Chris

          Lately you've been tan, suspicious for the winter.
          All my Plugins I've written

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            @chris fullmer said:

            The one that caught me for a while is if you add an edge, but it is part of a curve, and you are not adding the rest of the edges in the curve - that will splat.

            So exploding curves is necessary too.

            Chris

            From what I understood of TIG, even exploding the curve and adding one segment will crash, as the edge is still connected to other edges on either side.
            Or did I misunderstand?

            Thomas Thomassen β€” SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • TIGT Offline
              TIG Moderator
              last edited by

              @thomthom said:

              @chris fullmer said:

              The one that caught me for a while is if you add an edge, but it is part of a curve, and you are not adding the rest of the edges in the curve - that will splat.
              So exploding curves is necessary too.
              Chris

              From what I understood of TIG, even exploding the curve and adding one segment will crash, as the edge is still connected to other edges on either side.
              Or did I misunderstand?

              No - moving a loose Edge [that is neither part of a Curve or defining a Face] into a Group shouldn't splat... It's the splitting of thing that rely on each other that splats - an Edge might be connected to another Edge at it's end, BUT it shouldn't splat as each can survive without the other - A Curve or a Face need other things [Edges] to define them so moving them 'trans-entities' could be fatal ! πŸ˜›

              TIG

              1 Reply Last reply Reply Quote 0
              • thomthomT Offline
                thomthom
                last edited by

                Gotcha!

                Thomas Thomassen β€” SketchUp Monkey & Coding addict
                List of my plugins and link to the CookieWare fund

                1 Reply Last reply Reply Quote 0
                • Chris FullmerC Offline
                  Chris Fullmer
                  last edited by

                  And there is a feautre request submitted and I heard they are seriously thinking about trying to fix all of this for us.

                  I often find it would be nice to move existing entities into existing groups.

                  Chris

                  Lately you've been tan, suspicious for the winter.
                  All my Plugins I've written

                  1 Reply Last reply Reply Quote 0
                  • thomthomT Offline
                    thomthom
                    last edited by

                    @chris fullmer said:

                    And there is a feautre request submitted and I heard they are seriously thinking about trying to fix all of this for us.

                    I often find it would be nice to move existing entities into existing groups.

                    Chris

                    Feature request? Surely it's a bug report? They already added the API for it, with the arguments for add_group, but it's bugged.

                    Thomas Thomassen β€” SketchUp Monkey & Coding addict
                    List of my plugins and link to the CookieWare fund

                    1 Reply Last reply Reply Quote 0
                    • Chris FullmerC Offline
                      Chris Fullmer
                      last edited by

                      heh! you're right. I filed it as a bug report (with an ill-advised threat to to do bodily harm to whoever did not get it implemented).

                      Hopefully they fix it. It would be nice.

                      Chris

                      Lately you've been tan, suspicious for the winter.
                      All my Plugins I've written

                      1 Reply Last reply Reply Quote 0
                      • Chris FullmerC Offline
                        Chris Fullmer
                        last edited by

                        Also, I think it is not as bad as you are pointing to TIG. If I add a face without its edges, it works just fine.

                        ---tested more and came back---

                        hmm, just adding a face that is bound by an edge that is part of a curve ALSO does not necessarily cause a splat like I had thought.

                        But I do know that in my faces to components script, I ran into problems and when I first exploded all curves in the model, I was able to overcome the splats.

                        But now I'm confused again as to what causes it. 😑

                        Chris

                        Lately you've been tan, suspicious for the winter.
                        All my Plugins I've written

                        1 Reply Last reply Reply Quote 0
                        • thomthomT Offline
                          thomthom
                          last edited by

                          Sounds like it's one of them fun SmartBugs. Genetically manipulated to be invisible when you look directly at it.

                          Thomas Thomassen β€” SketchUp Monkey & Coding addict
                          List of my plugins and link to the CookieWare fund

                          1 Reply Last reply Reply Quote 0
                          • TIGT Offline
                            TIG Moderator
                            last edited by

                            Chris

                            I have also tried it afresh - hadn't tried it recently as who needs bugsplats! I can't get it to splat either ❗ has something been fixed in v7.1[M1] and they're just not telling us ?

                            It didn't always splat before, BUT trans-entities selections seem to be a major contributor.
                            One thing it does do, which I sure it didn't used to, is if you draw a cube and select just the one face [no edges] and run the code below it groups the face and replicates its edges leaving the original edges behind but the face has been cut from the model: BUT if you erase one of the cube's faces and then select an adjacent face [again no edges] and run the code the face is cut from the model and so is its edge that had no other attachments, however, the common edges with the other faces are just replicated in the group and remain intact so their other faces are kept... I'm sure it never did that before !

                            group=Sketchup.active_model.active_entities.add_group(Sketchup.active_model.selection.to_a)

                            ❓

                            In passing I also noticed that running a group intensive script with the Outliner open doesn't seem to splat now ? Again I avoid it but did do it accidentally yesterday a couple of times and no splats... mysterious... πŸ˜•

                            TIG

                            1 Reply Last reply Reply Quote 0
                            • thomthomT Offline
                              thomthom
                              last edited by

                              Yea - I miss a bug-fix list in the release notes.

                              Gotto test this with older SU versions though.

                              Thomas Thomassen β€” SketchUp Monkey & Coding addict
                              List of my plugins and link to the CookieWare fund

                              1 Reply Last reply Reply Quote 0
                              • 1 / 1
                              • First post
                                Last post
                              Buy SketchPlus
                              Buy SUbD
                              Buy WrapR
                              Buy eBook
                              Buy Modelur
                              Buy Vertex Tools
                              Buy SketchCuisine
                              Buy FormFonts

                              Advertisement