sketchucation logo sketchucation
    • Login
    1. Home
    2. DevinLange
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    D
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 4
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Associating data structures with save

      @dan rathbun said:

      @slbaumgartner said:

      Your Array of references to Faces can not be saved per-se because Ruby objects are not persistent.

      Yes.. the persistent collection of faces (and edges,) that are saved in the model, are Sketchup::Entities collections. The model has one, which is the toplevel collection of entities. Sketchup::Group and Sketchup::ComponentDefinition also have entities collections.

      In addition, since SketchUp 2014, instances of these later two classes can have unique persistent IDs assigned to them. See:

      Group.guid

      • ComponentInstance.guid

      So consider grouping your path faces if possible.

      I see very interesting, thank you for all the information. One question about the groups; do they have to be mutually exclusive? That is it would be nice if one face could be used for two separate paths.

      posted in Developers' Forum
      D
      DevinLange
    • RE: Associating data structures with save

      @tt_su said:

      Can you describe some more the overall concept of what you are doing?

      Right now I'm working on the first step of a project involving Sketchup. At the end of this step I would like Sketchup to output lists of faces. (I intend to use these lists for path-planning like in games). Right now I am trying to make an interface so the user can create these lists of faces.

      So far the way I've been doing this is let the user create face geometry like they normally would. Then when they select my path creator tool as they click on subsequent faces they get added to a Ruby array.

      What I need is for the user to be able to create these paths, save, then be able to access them when they reopen. This is my most immediate issue, however I foresee other problems that I don't know how to solve, which may affect your answer. I would like to be able to modify the paths after they are created (insert, delete, append). At the very least if the user modifies the faces I don't want anything to fail.

      Thank you for your interest, let me know if you have any ideas even if it requires me to restructure everything I've done so far 😄

      posted in Developers' Forum
      D
      DevinLange
    • RE: Associating data structures with save

      @slbaumgartner said:

      @devinlange said:

      . I would like to be able to associate these arrays with a particular save.

      Please expand on this. I don't understand what you mean to accomplish.

      Basically I would like the user to be able to create a list of faces. More specifically I want them to functionally be a list of pointers to faces in the scene. When the user saves, closes sketchup, and reopens this save I want them to be able to access and manipulate these lists of faces they generated in the past.

      posted in Developers' Forum
      D
      DevinLange
    • Associating data structures with save

      I am working on developing a plugin for Sketchup. In the plugin I am working with Arrays of Faces. I would like to be able to associate these arrays with a particular save.

      Things I have tried:

        • Just using a global Ruby Array of these faces.
      • This doesn't work because the Array is shared between windows of sketchup. Furthermore the Array is destroyed when sketchup closes.
        • I also tried using an empty group entity and using the attribute dictionary to save these Arrays.
      • This doesn't seem to work because the attribute dictionary doesn't seem to work with Arrays or the Face objects.
        • The only idea I have left (but haven't tried to implement) is for each of the Faces in the scene use its attribute dictionary to store its array id and position.
      • However this seems extremely cumbersome to me because what I would really like is to have three different arrays that contain arrays of faces.
        Any pointers or ideas would be greatly appreciated, I am fairly new to the Sketchup API as well as Ruby.

      Thank you.

      posted in Developers' Forum
      D
      DevinLange
    • 1 / 1