sketchucation logo sketchucation
    • Login
    โ„น๏ธ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    New to DC: topic for my simple questions to the pros

    Scheduled Pinned Locked Moved Dynamic Components
    sketchup
    74 Posts 3 Posters 56.4k Views 3 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.
    • P Offline
      pibuz
      last edited by

      Hi guys, I'm sorry to bother but i recently started fiddling around with DC and I really find very difficult to learn, the documentation is in my opinion very poor, and it's odd for the potentiality this tool hase...

      I'm sad to bother but I have to ask you some very basic questions about them..

      First thing would be...the NEAREST function.

      I have followed the very simple self-paced tutorial found on the warehouse, but the function doesn't work at all, even if I replicate exactly the tutorial. I don't know why but when I scale along the X axis my cubicle the results are unpredictable. Sometimes it works, sometimes it does not. It's starting to be very frustrating... Can anybody please point me what I am doing wrong?

      My aim here is to force the scaling on the X axis to given lengths (what i understand is that the NEAREST function returns the closest valued between the ones specified in the formula)

      Thank you in advance! and SORRY again!


      cubetto.skp

      WEB (ita) - https://filipposcarso.wixsite.com/ordinentropico

      1 Reply Last reply Reply Quote 0
      • P Offline
        pibuz
        last edited by

        Thank you a ton!

        WEB (ita) - https://filipposcarso.wixsite.com/ordinentropico

        1 Reply Last reply Reply Quote 0
        • P Offline
          pcmoor
          last edited by

          the problem is current returns inches for size and position, so one has to convert for centimeters
          a known bug

          =NEAREST(CURRENT("LENX")*2.54,100 ,500)

          this is the same for facearea, you have to convert with 2.54*2.54, (/10000 for meters)

          Just a moment...

          favicon

          (help.sketchup.com)

          Capture.JPG

          1 Reply Last reply Reply Quote 0
          • P Offline
            pibuz
            last edited by

            Ok guys another question: I'm trying to use the optionindex parameter but it returns -1.

            I'm trying to assign a specific itemcode given the length of the bar, which I can choose among a list. So I thought to unite CHOOSE and OPTIONINDEX to make it work, but OPTIONINDEX returns "-1" for LenX, and I can't figure out why.

            Thanks in advance again!


            barra_4x12_v2.skp

            WEB (ita) - https://filipposcarso.wixsite.com/ordinentropico

            1 Reply Last reply Reply Quote 0
            • P Offline
              pcmoor
              last edited by

              optionindex works in the same level, You can not pass it using parent! OR CU_barra_4x12!

              In theory using a list and "lenx" should work, but it does not. This may be due it being an unaccustomed attribute. You have found an inconsistency or bug, however, will have to do a workaround, nominate a attribute "Lunghezza" and use that for the list and optionindex works. Then assign lenx to this Lunghezza attribute


              added extra attribute and placed within same level, then reference as needed

              1 Reply Last reply Reply Quote 0
              • P Offline
                pibuz
                last edited by

                Pcmoor, thank you a lot for the time you're spending to explain me how it works!

                ...however, in the model you uploaded the stretching along the X axis is locked to the value you select from the list. Instead, I'd like to be able to stretch the component locking some known measures (see the embedded NEAREST function), and ALSO have the possibility to choose a lenght from a list.

                In both cases, I get a defined length; in the end, I'd like to link that known lengths to codes (possibly with the CHOOSE/OPTIONINDEX functions which I find to be more direct or with an IF function, if needed)

                WEB (ita) - https://filipposcarso.wixsite.com/ordinentropico

                1 Reply Last reply Reply Quote 0
                • P Offline
                  pcmoor
                  last edited by

                  place an option to use scale in the dropdown list, as you suggested, use a conditional statement in the lenX formula to reflect the choice, say if index=1, then current and nearest, else the fixed length selection.


                  added option to list

                  1 Reply Last reply Reply Quote 0
                  • P Offline
                    pibuz
                    last edited by

                    Wonderful, pcmoor! I'm learning a lot! Thank you so much!

                    I fear I will bother you again and again ๐Ÿ˜ sorry!

                    WEB (ita) - https://filipposcarso.wixsite.com/ordinentropico

                    1 Reply Last reply Reply Quote 0
                    • P Offline
                      pibuz
                      last edited by

                      Hi again! And sorry to bother.. I'm here with a little more complex topic, I'm going to explain..

                      I'm building a new DC which is a wooden panel, which can be coloured with any color on both front and back face. Colours on the two faces may be the same or differ.

                      I'm looking for a way to colour separately the two faces, and also to have an attribute reporting the name of the materials used. The aim here is to get a report which can tell me how many square meters I'm using of whatever material I applied.....

                      Is there a way to do this? or any kind of workaround?

                      MANY THANKS IN ADVANCE!


                      parete_TAMB_v1.skp

                      WEB (ita) - https://filipposcarso.wixsite.com/ordinentropico

                      1 Reply Last reply Reply Quote 0
                      • P Offline
                        pcmoor
                        last edited by

                        There a few things you need to consider

                        Scaling a material / face does not automatically update FACEAREA, here are some ways to get produce the result you may require.

                        1. Calculate the area from the input, works for simple shapes, like with the door face, height * width
                        2. Use FACEAREA, then after any operation, (you may need to make the component unique if their are others) scale definition then redraw.
                        3. Incorporate a small "scaler" DC, a technique introduced by TIG, that is say a xy 10mmx10mm sample of any material, set x=1,y=1 and hidden. This then resets the material to scale and any FACEAREA calculation. This however conflicts with the internal DC copies sizes, so provided you do not need the use of copies that have different sizes from each other, then it is the best method
                          https://sketchucation.com/forums/viewtopic.php?f=289&t=66642

                        Texture materials need to be added to a DC as swatches, as Sketchup does not automatically load them even if correctly named in the DC.
                        https://help.sketchup.com/en/sketchup/dynamic-component-predefined-attributes

                        You can use named colors directly without swatches as per chart at http://ruby.sketchup.com/Sketchup/Color.html

                        You need to consider how the user will interact with the pallet, for large number, it seems impractical to load all to the DC, so an exposed sample point maybe the solution: say, use generic swatches named doorfront, doorback, dooredge, benchtop, benchedge......this would be in a global DC, that the other DCs would reference in a template. The user would select by dropping the appropriate colors/material to the global DC. Ideal to switch and compare paint selections.

                        So it depends on the scope of the project, simple DCs loaded to the warehouse would have color codes and/or material textures added with swatches. Whereas a room design/kitchen could be based on the template with global options, as such, it will need some simple ruby scripting to update all the parts (redraw).

                        Material selection in a DC is to a group or component, not a face. So coloring different faces with attributes is not possible. You could pre-color a back face for calculation purposes though. But you need the "scaler" to automate the area calculation. Then with the material selection the rest would change. For edges of different materials, you would have to make then separate groups or components as you see fit. (note: groups are automatically cleaned from the file and components are required if you need to swap)

                        example attached
                        can paint any material
                        has swatches of some edge alternatives, some color, and option to match top (note use of equals in the value part of the dropdown, plus quotes around the material
                        the component surfaces have hidden "scalers" embedded.
                        the area calculated from a red painted surface


                        bench top material example.skp

                        1 Reply Last reply Reply Quote 0
                        • P Offline
                          pcmoor
                          last edited by

                          I add some attributes to your example, the door FACEAREA is done on the front rectangle, divided by 2 as to remove the backface from the calculation, Because its not the parent, it requires a redraw after the change in size for the parent to update its value.
                          There are two external group DCs to which the door references to change its material, change these and after a redraw the door changes
                          You can set a short cut to the redraw to make life a bit easier, but a small script would be best, so all components are up to date after the changes


                          parete_TAMB_v1.skp

                          1 Reply Last reply Reply Quote 0
                          • P Offline
                            pcmoor
                            last edited by

                            Some ideas for the carpet in your warehouse page,
                            added facearea("")/2
                            standard colors
                            you need to match then closer, maybe use the RGB values


                            carpet example.skp

                            1 Reply Last reply Reply Quote 0
                            • P Offline
                              pibuz
                              last edited by

                              Pcmoor, you're very kind...Thank you so much!!

                              I unfortunately have been derailed to other urgent matters, so I'm now back with another question on materials. I almost got the panel work the way I'd like it to work.

                              Basically, I set fixed values for length and height for the user to change from a list, and this is perfect. Now, the two faces may be painted with whatever colour we want, so I thought to make two different inner components with inner faces painted with defaul material. This way, if I get INTO the main component and apply whatever material to my 2 faces (even separately) I get the applied material name being showed up in the "Material" attribute.

                              I have now two attributes related to the applied material name (CODICE, and FIN_PARETE), and it's crucial for me to have these two attributes updated after I apply a new material. At the moment, I get the material attribute to be updated, but I need to manually change the dimension of the panel to have the linked attributes updated.

                              Is there a way to automatically update the related attributes?

                              Many many thanks in advance!


                              panel_TAMB_smart_v1.skp

                              WEB (ita) - https://filipposcarso.wixsite.com/ordinentropico

                              1 Reply Last reply Reply Quote 0
                              • P Offline
                                pibuz
                                last edited by

                                Hi again! I have discovered the "redraw" command (which I did not know at all), and it seems to be intuitive enough for my colleagues to use ๐Ÿ˜›

                                Another question for the pros: in the attached component I set an onclick function on the two coloured faces: when you click on a face it is set to HIDDEN. That works perfectly, but when I copy that same component the onclick action operates on the original component, and I don't understand why...

                                Can you please point me to the solution?

                                Thanks in advance!


                                pannello_tessuto_smart_v3.skp

                                WEB (ita) - https://filipposcarso.wixsite.com/ordinentropico

                                1 Reply Last reply Reply Quote 0
                                • P Offline
                                  pcmoor
                                  last edited by

                                  copying does not make the item unique, so a connection exists until its broken usually by changing a size. So right click an make unique before the interaction

                                  1 Reply Last reply Reply Quote 0
                                  • P Offline
                                    pibuz
                                    last edited by

                                    hi again! Is there a way to insert a formula depending on the fact the result of an operation is an integer number? something like: IF LENX/LENY IS AN INTEGER NUMBER THEN WRITE 1,0.

                                    I know how to use the If function, but i don't know if there's a way to check an integer number...

                                    Thanks a lot!

                                    WEB (ita) - https://filipposcarso.wixsite.com/ordinentropico

                                    1 Reply Last reply Reply Quote 0
                                    • P Offline
                                      pcmoor
                                      last edited by

                                      you can check for the remainder and if none then must be an integer

                                      =if(lenx/leny - int(lenx/leny),0,1)

                                      1 Reply Last reply Reply Quote 0
                                      • P Offline
                                        pibuz
                                        last edited by

                                        Thank you sir! Gonna test asap!!!

                                        WEB (ita) - https://filipposcarso.wixsite.com/ordinentropico

                                        1 Reply Last reply Reply Quote 0
                                        • P Offline
                                          pibuz
                                          last edited by

                                          Hi again! i have a new small issue: I have a basic Dynamic Component which can be edited in its inner parts. I just want the dynamic component to report the size of its bounding box, depending of the things I put inside. In the component attributes, window the LenX LenY LenZ parameters correctly update when I add/move things inside the DC, but if I link to those values three different addributes ("length"=LenX, "width"=LenY, "height"=LenZ) I have to REDRAW the components if I want the values to update. Is there a way to update automatically?

                                          THANK YOU IN ADVANCE AS SUSUAL!

                                          WEB (ita) - https://filipposcarso.wixsite.com/ordinentropico

                                          1 Reply Last reply Reply Quote 0
                                          • P Offline
                                            pcmoor
                                            last edited by

                                            Most likely you need to do a redraw, you can set a short cut key to it provided you have a component selected.
                                            Another method is to set a ruby script to a button
                                            https://forums.sketchup.com/t/redraw-all-dynamic-components/77512

                                            You probably need to use some ruby to overcome the shortcomings of DCs

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

                                            Advertisement