sketchucation logo sketchucation
    • Login
    ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

    Down to Top traversal

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 2 Posters 280 Views
    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.
    • D Offline
      dany67300
      last edited by

      Hello everybody,

      I've got a little problem in sketchup.
      I'm parsing all the elements from my Model, using the entities method, to go from the model, to the group, to the face, to the position....It's for me a top-down traversal so I can get all the transformations of my elements. This works great.

      But now, I need to do the reverse, I've got an entity, and I want to get all his parent's group transformation, but when I use the parent method on a Face for example, it takes me to a DefinitionList, which is directly in the model, I can't get the parent group and his transformation. Sometimes, it works using the instances method on the DefinitionList to get the group that uses this definition, but if many groups shares the same definition, I don't know which one is the selected one.

      If somebody can help me, it would be great

      thanks in advance and sorry for my bad english :s

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

        The problem is that given an entity inside a group or component, you have no idea of which instance it belongs to.
        Though, if you assume, or make a requirement, that there is only one instance, then it is possible.

        But can I first ask why and what you are trying to do?
        And how are you getting this entity to begin with?

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

        1 Reply Last reply Reply Quote 0
        • D Offline
          dany67300
          last edited by

          In fact, I'd like to add a physical engine created by our society to sketchup, like sketchy physics does.
          So each entity in sketchup is linked to a body in my engine. I have the list of the linked entity in my own array so I can access them through this array.

          When I make my simulation, to initialize value, I have to get the whole transformation of my entities to set their position in the physical world, and then at each step I get the transformation in my engine and have to set it to sketchup entity, but if they are in a group (for example a group bike, we'd like to turn the wheels) I have to extract the wheel transformation of the bike transformation, as the wheel's transformation depends on the bike's transformation.

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

            So in your array of entities, yo might have edges/faces? How did you get that entity in the first place?

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

            1 Reply Last reply Reply Quote 0
            • D Offline
              dany67300
              last edited by

              In my array I have groups, that I get from a top to down traversal. I think the best solution will be to store my own couple (transformation,group) in my own tree structure to do the thing I need.

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

                Yea - you'd need to keep store the path to where you found the group in the first place.

                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