sketchucation logo sketchucation
    • Login
    1. Home
    2. pcmoor
    3. Posts
    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
    P
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 378
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Dynamic Component Value Reference Model Attribute Value

      To update references on change of a global, one needs to do a "redraw" as per the context menu for each component, rather than do this manually, a simple ruby script can be attached to a button as per

      https://forums.sketchup.com/t/redraw-all-dynamic-components/77512

      https://sketchucation.com/pluginstore?pln=ae_ToolbarEditor

      where else a component instance will update to the current global on insert.

      Can you share the main focus of your use of DCs? as its quite likely other scripts will be useful.

      posted in Dynamic Components
      P
      pcmoor
    • RE: Dynamic Component Value Reference Model Attribute Value

      You can reference any component or group by name if they are on the same level of nesting. So objects in the same file can reference attributes via the DC dialog; however you need to do a redraw for this to take effect. Redraw can be done via the DC, right click menu or a ruby script.
      You can reference the parent by name or by by the generic term parent as in parent!attribute rather than just myDC!attribute, this makes generic referencing possible for inserted DCs.
      Parent attributes of a file are not available on opening, so to create an environment that can have global attributes the file would retain a DC which would be opened to insert components that can update to the global data.

      posted in Dynamic Components
      P
      pcmoor
    • RE: Rescaling

      using the scale tool, as per your .jpg, select a corner then move towards the opposite then type 0.1 as per Box.
      Otherwise use the measure tool and measure a part and type the correct measure including units you want and except the new scale as per dialogue activated by this action

      posted in Newbie Forum
      P
      pcmoor
    • RE: Rescaling

      use the tape measure, measure a part and instead of the shown measure, say if 1.2m, type .12m, enter then except the re-scale dialog

      posted in Newbie Forum
      P
      pcmoor
    • RE: Dynamic Component and material

      Hi
      you can make each face a group, then paint them directly or with formula
      Have the parent reference them with a custom attribute which you can add to your report, so all in same context

      posted in Dynamic Components
      P
      pcmoor
    • RE: New to DC: topic for my simple questions to the pros

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

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

      posted in Dynamic Components
      P
      pcmoor
    • RE: Dynamic component issue

      So you are swapping the 'mesh' components?
      For the swapped 'skin', to work, it would have the same scale factors (axis?), by using the generic 'parent' term the size will update without the specific parent name.
      It appears you have an axis change as well that further complicates things.

      Capture.PNG

      posted in Dynamic Components
      P
      pcmoor
    • RE: Dynamic component issue

      With your architrave example in the problem door, the child is overriding the parent, you need to pass the information to the "mesh" or raw geometry.

      posted in Dynamic Components
      P
      pcmoor
    • RE: Rotations in a TV monitor Arm

      Create attributes for each rotation and pass them down. You need to reconsider the axis of rotation for the vertical arm
      As is with some attributes connected, note the interference of parts as it rotates, the axis should be at the top with the lower arm allowed to move (separate component)


      rotate arm.skp

      posted in Dynamic Components
      P
      pcmoor
    • RE: How to automatically set the attribute?

      =_name returns the original component definition name, there is no instance name, I believe its part of a different definition set, you can see it when inspecting "drawing elements"

      Capture.jpg
      there is no DC way of getting the instance name, only viewing it in both the option dialog title and the attribute dialog header provided the name attribute is not used.
      Capture 2.JPG
      however you could use a script

        sel = Sketchup.active_model.selection 
          
          sel.grep(Sketchup;;ComponentInstance).each do |s|
              s.set_attribute "dynamic_attributes","aname",s.name 
              $dc_observers.get_latest_class.redraw_with_undo(s)
          end
      
      

      I use toolbar editor to store and run such scripts. In that you can create a button and assign the script.

      You then include "aname" or an attribute of your choosing an create other formula / relationships for your data, reports....

      posted in Dynamic Components
      P
      pcmoor
    • RE: Performancies issue

      Not quite sure what is the problem, you could private message some examples; however some points

      Breaking a bond is done by making the copied components unique. for groups, sometimes make unique (right click menu) is available.
      If groups are the problem then running this script should help

      http://ruby.sketchup.com/Sketchup/Group.html#make_unique-instance_method

      Capture.jpg

      If the copied groups or components have the same parent, same header then double click the title box to change its name before changing the attributes

      posted in Dynamic Components
      P
      pcmoor
    • RE: New to DC: topic for my simple questions to the pros

      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

      posted in Dynamic Components
      P
      pcmoor
    • RE: New to DC: topic for my simple questions to the pros

      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

      posted in Dynamic Components
      P
      pcmoor
    • RE: New to DC: topic for my simple questions to the pros

      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

      posted in Dynamic Components
      P
      pcmoor
    • RE: New to DC: topic for my simple questions to the pros

      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

      posted in Dynamic Components
      P
      pcmoor
    • RE: Indexing Shelf Copies

      For the 10 shelf positions you could have used 10 text boxes, this is the simplest method.

      The use of a comma delimited string within a single text box saves space on the option dialog. This requires the use of the find formula, you will note that the FIND formula produces an error if it cannot find what its searching for.

      Coding is done bit by bit. Errors must be circumnavigated as there are no error trapping methods in DCs, (like if error do this.. does not exist)

      The work around is to add what you are looking for to the end of the string you are searching,
      https://sketchucation.com/forums/viewtopic.php?f=289&t=67899

      In the shelf example, I added ten commas, so that if one just put one value in the string, each FIND needs to return a value other than the -1 (error).... Attributes: p1 to p_10

      So, each FIND returns the position of the comma in the string, the MID function isolates bits of text based on the count of each symbol. MID( string, position of comma +1, length which is the next comma, minus the previous -1 ) however if length equals zero then another error, so changed the added ten commas to β€œ0,0,0,0,0,0,0,0,0,0,” .... Attributes: s1 to s_10

      Now need a further check to see if the string has a comma (or delimiter of your choice) at the end, otherwise we would get another zero length in the MID formula We use the difference between the length of string and position of the last comma of the string with a comma attached. Which return 0 (false) if there is a comma in the original string or 1 (true) if not..... Attributes: check

      This is certainly a bit of a mind game, but hopefully after a few or more reads it makes sense

      Another clever trick is to the use of the CURRENT formula to match the copies with the positions, this saves a lot of either nested IF statements or writing out a CHOOSE statement
      Z =current("pos" & copy+1)

      The summation in pos (position of shelf) has a thickness of 20mm, you could have this as an attribute if required

      Copies is based on whether the S values are not zero, true if so. (a return of zero is evaluated as false, whereas any other value is true)

      posted in Dynamic Components
      P
      pcmoor
    • RE: New to DC: topic for my simple questions to the pros

      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

      posted in Dynamic Components
      P
      pcmoor
    • RE: New to DC: topic for my simple questions to the pros

      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

      posted in Dynamic Components
      P
      pcmoor
    • RE: New to DC: topic for my simple questions to the pros

      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)

      Attention Required! | Cloudflare

      favicon

      (help.sketchup.com)

      Capture.JPG

      posted in Dynamic Components
      P
      pcmoor
    • RE: Indexing Shelf Copies

      update to allow up to 10 shelves, copies calculated by numbers in comma separated string of shelf spacing


      adstustable shelves 2.skp

      posted in Dynamic Components
      P
      pcmoor
    • 1 / 1