• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

How to retrieve the structure of instance up to model?

Scheduled Pinned Locked Moved Developers' Forum
3 Posts 2 Posters 5 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.
  • A Offline
    areal3d Newcomers
    last edited by 14 Dec 2023, 22:15

    hello,
    i just stuck at one point:

    wirh onmousemove i can get the instance/component - structure easily:

    pickhelper = view.pick_helper pickhelper.do_pick(x, y) pickhelper.count.times { |pick_path_index| pp=pickhelper.path_at(pick_path_index) }

    i can the iterate pp and get for example all transformations.

    now when i iterate thru entities of a certain instance and want to get the parent, i do not get the higher INSTANCE, but the DEFINITION LIST.

    how can i get the whole path as in the pickhelper from a selected instance?

    thanx a lot for helping .

    stan

    edit1 : found this interesting topic:

    Link Preview Image
    What is the way to get an instance path to the root given a Group/ComponentInstance?

    The only thing I found close is InputPoint#instance_path, but it works only based on x,y coords which I think may return wrong results if the point that is used is shared by several instances Using Make 2017

    favicon

    SketchUp Community (forums.sketchup.com)

    starting to check it out!

    edit 2:

    this works, but interesting:

    not the returned arry of elemnts holds the row, but the array[0]

    BUT IT WORKS FINE !!!!

    1 Reply Last reply Reply Quote 0
    • D Offline
      Dan Rathbun
      last edited by 24 Feb 2024, 23:36

      @areal3d said:

      hello,
      ... now when I iterate thru entities of a certain instance and want to get the parent, i do not get the higher INSTANCE, but the DEFINITION LIST.

      Instances do not have Entities collections. Only definitions and the top-level model have an Entities collection.

      I'm not here much anymore.

      1 Reply Last reply Reply Quote 0
      • D Offline
        Dan Rathbun
        last edited by 24 Feb 2024, 23:42

        @areal3d said:

        hello,
        how can i get the whole path as in the pickhelper from a selected instance?

        You will either need to build an InstancePath as you drill down or get the Model.active_path and add the selected instance to it.

        I'm not here much anymore.

        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