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

    emotionally wounded beast

    @emotionally wounded beast

    0
    Reputation
    1
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    emotionally wounded beast Unfollow Follow
    registered-users

    Latest posts made by emotionally wounded beast

    • RE: [Info] Allowable Classes for "set_attribute"

      I'm very new at this, so pardon if I'm terribly mistaken, but....

      Small, additional quirks worth mentioning:

      Directly storing / recovering Point3ds and Vector3ds in hashes will fail via Dan's method, as the inspection string will not have proper constructors for them. This is Ruby-specific, not Sketchup. That, and I'm assuming the recently noted entity-attributes-auto-transformation will not apply, as Sketchup will only see a string stored as the attribute.

      The hash creation failure:

      point = Geom;;Point3d.new(0,0,0)
      hash = {;origin => point}
      hash_str = hash.inspect
      new_hash = eval(hash_str) # Will fail
      

      hash.inspect will return => {:origin=>Point3d(0, 0, 0)}

      If you eval that it will throw the error: #<NoMethodError: undefined method `Point3d' for main:Object>

      Simple, quick solution? Store Point3ds and Vector3ds as arrays, of course.

      hash = {;origin => point.to_a}
      

      Or, alternatively, if you were dead set on keeping them as Geoms...

      hash_str = hash.inspect
      hash_str.gsub!("Point3d", "Geom;;Point3d.new")
      # Same for vectors if needed
      

      This will successfully eval to a new hash containing a Point3d (though, as previously mentioned, the point will not auto-transform with the entity it is attached to... I assume).

      posted in Developers' Forum
      E
      emotionally wounded beast