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

    A MACRO RUBY (Someone please!!!)

    Scheduled Pinned Locked Moved SketchUp Discussions
    sketchup
    9 Posts 4 Posters 787 Views 4 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.
    • jgbJ Offline
      jgb
      last edited by

      I know there was a request for a MACRO function in the Wishlist topic, but I'm raising this as a separate topic.

      Is there a MACRO function plugin (I suspect not), or can some wizard please write one? πŸŽ‰

      I have to do a multi-step operation to correct an error, and I have several hundred of them to do, all the same set of operations.

      My present problem is bolt holes in my parts, drawn as open through-holes with ringed "threading" on the hole surface. Yes, I do get carried away with detail sometimes. That shot my lines count to way over 700,000 😲 and SU now crawls along. So, as I only have 6 bolt type components, I modified the bolts to a single surface instead of the ringed "threaded" surface, and that alone dropped my line count to under 600,000.

      There are 162 bolts in the model (so far), and each bolt goes through 2 or 3 other parts, with an entity count of between 48 and 186 for each hole in each part, depending on whether it is just a hole, or is a "threaded" hole. I want to convert all these "holes" to just black circles on the surface, resulting in only 26 entities per hole (12 sided circles).

      The operation for each hole, or in the case where several holes are close to each other, is to select the hole and all its bits, deselect the 2 faces of the parts surface, delete the hole bits, join 2 vertices on each opening to form a face (face does not work here), delete the those 2 lines, and finally paint the 2 (hole) faces black.
      I've done about a dozen and I am freaking out. 🀒

      Now if I had a Macro that could "learn" those steps, I'd be done sooner than typing this topic. β˜€

      A cupola parameters to the Macro.

      It has to "learn" the steps, by recording the operations. I'm not talking writing a set of macro instructions, as that get real hairy real fast.

      There has to be a "do once" and "Repeat X times" function.

      Forget about SU Undo. SU Undo is only 100 steps (I counted) and a multi-step Macro done a bunch will overrun the undo stack anyway. Well maybe keep the SU Undo for "do once" operations only. Instead, do an implicit filesave before the Macro steps execute, so if it blows up, the model is safe.

      And if you want to get really functional, have an external Macro saved library that can be called up later and in other models doing the same thing.

      And now back to my mods in progress... 🀒 🀒 🀒


      jgb

      1 Reply Last reply Reply Quote 0
      • Dave RD Offline
        Dave R
        last edited by

        Sorry. I can't help you with a plugin to do what you're asking. I'd think that if it could be done, someone would have done something like it before now. Could I use your plight (in the most polite way possible and I wouldn't identify you) as an illustration to students I have who seem hell bent on drawing every last detail? One guy even asked me how to draw in the glue for a furniture project.

        Etaoin Shrdlu

        %

        (THERE'S NO PLACE LIKE)

        G28 X0.0 Y0.0 Z0.0

        M30

        %

        1 Reply Last reply Reply Quote 0
        • pbacotP Offline
          pbacot
          last edited by

          I guess these holes are loose geometry? If many are identical. Group. then use Selection toys to make the identical ones components. Then act on the components. You still have to go to each hole and group it. Then select the identical ones.

          MacOSX MojaveSketchUp Pro v19 Twilight v2 Thea v3 PowerCADD

          1 Reply Last reply Reply Quote 0
          • jgbJ Offline
            jgb
            last edited by

            Dave, yes, without reservation. If you want, I can even supply you some examples of how I reduced the line count yet maintained the look of detail. If glue lines were a problem, a long while back I wanted to add weld ripples and bolts with real spiral threads, till SU gagged. Now I just use a different colour or texture to differentiate strictly visual detail. ie: dark gray for threaded bolts, and a different metal texture for weld lines.

            I keep a ruler nearby with the words "You're NOT making shop drawings" printed on it to rap my knuckles when necessary. 🀣

            Pbacot, Good idea, but with one major snag, besides grouping each one. Selection tools will only work on copies of a group, not on separate, even if identical, groups.


            jgb

            1 Reply Last reply Reply Quote 0
            • Dave RD Offline
              Dave R
              last edited by

              Thank you for the permission. πŸ˜‰

              Although I tend to advise my students to resist the urge to over-model, there are times I have to include things like screws. It can be done without going crazy on file size and without making SketchUp roll over on its back and play dead. These screws, for example are very light and add little to the file size. It's also dead easy to edit them and change their length.


              http://farm6.staticflickr.com/5141/5662968502_1dc00d333b.jpg

              This workbench has four Acme-threaded clamp screws and a lot of other detail but the entire model comes in at around 650Kb.


              http://farm6.staticflickr.com/5223/5872670878_91518583d2.jpg

              It's all iin the way you handle it.

              Etaoin Shrdlu

              %

              (THERE'S NO PLACE LIKE)

              G28 X0.0 Y0.0 Z0.0

              M30

              %

              1 Reply Last reply Reply Quote 0
              • jgbJ Offline
                jgb
                last edited by

                Now you got my attention 😲

                I wouldn't mind knowing how to make threads with minimal line count. In my current model of the cargo floor in my big air freighter, I needed to see bolts and holes to make sure I had proper attachment, clearances and adequate access. I'm up to 350 bolts so far, and only 15% of the floor drawn. Mind you, the floor is sectional, needing 43 sets of beams, braces and floor panels, plus a complex set of stuff at each end to hold the ramps. My lines count is around 557,000.

                I also will have a few big components where I will have to show threads.


                jgb

                1 Reply Last reply Reply Quote 0
                • Dave RD Offline
                  Dave R
                  last edited by

                  Here's a quick example.


                  http://farm8.staticflickr.com/7162/6733484733_d29d75f500.jpg

                  This clamp model saves out at 179 Kb. Pretty light by today's standards.


                  http://farm8.staticflickr.com/7007/6733484345_c0c99635e2.jpg

                  In the foreground, you can see the parts that make up the Acme-threaded screw.

                  In the lower right is the basic component for making the threads. Behind it is a single turn of the thread. The center of the shaft is normally a simple cylinder. In this case, however, I put the flats on the sides so the handle would fit onto it. I split the shaft in half for that. I could have done that part a little differently and perhaps saved a couple of Kb but I was much less experienced with SketchUp when I made this.

                  So, changing the length of the threaded shaft is trivial. Edit the length of the central shaft with Push/Pull or Move and copy the thread ring as many times as needed.

                  The wood and machine screws are similarly constructed. the head is separate from the body of the screw so if when I need a screw with a different head, I can easily draw the new head and exchange the old one for the new one. The body of the woodscrew is a stepped cylinder so there's a shank and the minor diameter. It's also got a point on the end of it. I can change the length of the shank independent of the length of the rest of the screw and I can make the screw longer or shorter in the same way I can edit the Acme screw.

                  No one is going to use these models to actually make the screws so they don't have to be absolutely perfect. I think they do communicate what they represent rather well, though.

                  FWIW, 100 of these clamps saves out at 217 Kb. There are a lot of faces there so it does slow SketchUp down a little bit but it's not bad and the file size is still practically nothing.


                  http://farm8.staticflickr.com/7157/6733627965_e8501d4d6e_z.jpg

                  Etaoin Shrdlu

                  %

                  (THERE'S NO PLACE LIKE)

                  G28 X0.0 Y0.0 Z0.0

                  M30

                  %

                  1 Reply Last reply Reply Quote 0
                  • irwanwrI Offline
                    irwanwr
                    last edited by

                    Hi Dave,

                    Would you mind if I'd like to ask you to give us a tutorial on how to make those screw models with low level poly and file size?

                    thank you.

                    1 Reply Last reply Reply Quote 0
                    • jgbJ Offline
                      jgb
                      last edited by

                      Dave, the way you do detailed threads is pretty much how I do them. You probably use Dynamic Comps, but I only use SU-Free so mine are a far less flexible.

                      However filesize is not my concern. Entity count is. I hate the way SU slows down when my total model lines count gets near a million. I use judicious layer visibility but even that sometimes does not help much. Small bolt holes are drawn 12 sided, large holes are standard 24 sides.

                      In an airplane structure, sections of parts that are low stressed, like "I" beam webs, typically have large holes in them simply to reduce the weight of material. Hole size, placement and spacing is calculated not to impair strength or stiffness. In my models they are there more-so for a realistic look, as I do not calculate their existence. Like I said, I am not making shop drawings.

                      I've attached an extract of my big airplanes cargo floor support structure to demo how I can reduce the entity count of (2) components that are used repeatedly in the model. Normally I do not show most bolts in my structural drawings, but here I had too, as I needed to present a higher level of realism for this model.

                      For the majority of holes, large or small, I do not push through the hole to the opposite face. For a 24 sided hole that creates 96 entities per hole, 24 faces and 72 lines. I just draw 2 circles, and paint the "hole" with transparent white, for a total of 50 entities, 48 lines and 2 faces. 1/2 the detailed way. And it maintains solidity, although I have to calculate for the "extra volume" of the fake hole. I also paint both side of any face the same, so looking in a hole doesn't look weird. That also eliminates backside shine through at the edges.

                      For holes that are threaded, I used to draw extra circles down the hole to look like threads, and that alone kicked the entity count way way up. So now, instead of transparent color, I use a dark gray. No extra entities. Same for bolts.How to reduce entity count, yet look the same.


                      jgb

                      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