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

    Marc477

    @Marc477

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

    Marc477 Unfollow Follow
    registered-users

    Latest posts made by Marc477

    • RE: Entity ID and Materials!

      Also, I found that 2 materials CAN have the same name in a specific case: If you name one material Color_000 for example, it will be named like the Sketchup internal material of the same name: [Color_000]. (It seems that the SDK removes the brakets '[' and ']' when you get the name of an internal material with SUMaterialGetName()).

      posted in Developers' Forum
      M
      Marc477
    • RE: Entity ID and Materials!

      Ok thank you! I though 2 materials could have the same name.

      posted in Developers' Forum
      M
      Marc477
    • RE: Entity ID and Materials!

      I don't really understand how it is possible to have no persistent ID. In the skp file: how each face knows to which material it is bound? I supposed there is an ID saved with the face that tells which material is linked to the face.

      posted in Developers' Forum
      M
      Marc477
    • RE: Entity ID and Materials!

      Then how can I find: starting from a ruby API material: the corresponding SDK material ?

      posted in Developers' Forum
      M
      Marc477
    • Entity ID and Materials!

      I discovered that the entityID (for materials) is not the same when getting it from the Ruby API or the cpp SDK:

      Example (using the same material in both example)

      Ruby API

      
      //aMat is a material
      aMat.entityID
      //Returns 183 
      
      

      Cpp SDK

      
      //aMat is a SUMaterialRef
      int id;
      SUEntityRef entity = SUMaterialToEntity(aMat );
      SUEntityGetID(entity , &id);
      uint matID = (uint) id;
      //Returns 201
      
      

      I tested this using a custom attribute dict to make sure it is the same material in both cases, it seems that the material in the SDK has always an ID of +18, and if I don't cast it to a uint, its value is always negative.

      Why ? πŸ˜• πŸ˜’

      posted in Developers' Forum
      M
      Marc477
    • RE: SDK: Get Images data

      @tt_su said:

      Not that the API provides. You could extract to a temp file and read it.

      I'm not sure how I am supposed to extract the image to a file, if I cannot read its data.

      posted in Developers' Forum
      M
      Marc477
    • RE: SDK: Get Images data

      Any work around ?

      posted in Developers' Forum
      M
      Marc477
    • SDK: Get Images data

      In the Sketchup c++ SDK:

      What is the equivalent of SUTextureGetImageData for a SUImageRef? How can I access images pixel data?

      Thank you

      posted in Developers' Forum
      M
      Marc477
    • RE: Material is deleted when cloning

      Thank you, I fixed my problem by processing only materials used in the model:

      
      aMat = Sketchup.active_model.materials.current
      if aMat != nil and Sketchup.active_model.materials.include?(aMat)
         ...
      end
      
      
      
      posted in Developers' Forum
      M
      Marc477
    • Material is deleted when cloning

      Can someone explains why this happens ?

      
      test = Sketchup.active_model.materials.current
      #<Sketchup;;Material;0x8a19480>
      test2 = test.clone
      #<Deleted Entity;0x8a19278>
      
      

      I'd like to store a material in a class variable to use it later, if I do not clone, and the selection change, test will not contain the previous material I want, but the new one selected.

      Thank you πŸ˜„

      posted in Developers' Forum
      M
      Marc477