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!
    🚨 Skimp | 25% Off until March 30 Buy Now

    Components colors/materials retrieval

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 2 Posters 847 Views 2 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.
    • Didier BurD Offline
      Didier Bur
      last edited by

      Hi all,
      I can't figure out to do this:

      • Suppose you have component instances in your model, each of them made of several various sub-components. These sub-components have also been painted by the user with various colors.

      • I can easily iterate through the top-level instances list, but once there I cannot retrieve the individual color or material of each sub_component, because there is no method "ComponentInstance.entities", these entities can only be accessed through the parent definition.

      Pleeeaaase help ! πŸŽ‰

      DB

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

        @didier bur said:

        Hi all,
        I can't figure out to do this:

        • Suppose you have component instances in your model, each of them made of several various sub-components. These sub-components have also been painted by the user with various colors.

        • I can easily iterate through the top-level instances list, but once there I cannot retrieve the individual color or material of each sub_component, because there is no method "ComponentInstance.entities", these entities can only be accessed through the parent definition.

        Pleeeaaase help ! πŸŽ‰

        If you can get the component_instance [of a nested component_definition] that is itself inside another component_definition (get that parent's component_instance.definition.entities and mine down into it for any component_instances... to use) - then you can then get any nested component_instance.material... = nil if it's <default> or 'a_material' if it's been painted. Within any component_definition.entities you can check any face/edge for e.g. face.material (again nil=<default>)...

        Hope this helps...

        TIG

        1 Reply Last reply Reply Quote 0
        • Didier BurD Offline
          Didier Bur
          last edited by

          @unknownuser said:

          Hope this helps...

          Sure, sort of. Thanks TIG.
          Guess what ? I must dig into 3 levels deep components to get their colors (for a client). This is more tricky than it first sounded. 😲

          DB

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

            My ComponentReporter+.rb has some component/group mining techniques in it that might help...

            Good luck (bon chance!).

            TIG

            1 Reply Last reply Reply Quote 0
            • Didier BurD Offline
              Didier Bur
              last edited by

              Yes, I've studied it extensively... But what I didn't noticed before is that when you have a component within another component and when you paint this sub-component globally (by default) you thus modify its definition. That's to say you can't have this sub-component colored with 2 different colors in to separate "parents". I hope that I'm clear, anyway this makes my job a lot easier
              I must extract an Excel sheet with a global list of top-level furniture components (kitchen cabinets, shelves...), and a detailed list of the components of level 1 whith their colors/materials, themselves made of various pieces of level 2 of various colors/materials.
              Pfff, furniture manufacturers are complicated people sometimes...

              P.S. Typo: Bonne chance (thanks)

              DB

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better πŸ’—

              Register Login
              • 1 / 1
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement