sketchucation logo sketchucation
    • Login
    1. Home
    2. marksup
    ℹ️ 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 3
    • Posts 23
    • Groups 1

    marksup

    @marksup

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

    marksup Unfollow Follow
    registered-users

    Latest posts made by marksup

    • RE: Upgrading plugins to Ruby 2.0 for SketchUp 2014

      Hi, thanks, but you may be missing the point...

      I would wish to read a simple text (not binary) file, (typically in CSV format).

      I do not know what encoding a user may use to create the text file - and most likely neither will the user!

      Thus the file may be UTF-8 already, or it may be something else, I just wish to reliably and simply process it whatever the encoding, as was apparently possible with earlier releases.

      I have no attachment to force_encoding - merely that it was suggested and it does appear to work, and will happily comply with any preferred alternative.

      So, what extra logic is required for anyone and everyone to reliably process any text file, (which might include £ or m[sup:1cfz4sft]2[/sup:1cfz4sft], for example) regardless of how it might be encoded?

      posted in Developers' Forum
      M
      marksup
    • RE: Upgrading plugins to Ruby 2.0 for SketchUp 2014

      Thanks ThomThom,

      I noticed (during a shared Skype screen session) that the user was launching SketchUp via the .skp file - so your explanation is very promising.

      Regarding the use of force_encoding and File.open, I am using the following (on the advice of another SketchUcation expert!)...

      File.foreach(file_path) do |file_data|
      file_data.force_encoding('ISO-8859-1').encode("UTF-8") if defined?(Encoding)

      Please can you provide a similar File.open example of what you would prefer/recommend.

      Would it be possible for SketchUp to provide a function to reenable foolproof reading of text files? (i.e. to reinstate the automatic encoding recognition functionality that Ruby 2 is missing compared to Ruby 1.8)

      posted in Developers' Forum
      M
      marksup
    • RE: Upgrading plugins to Ruby 2.0 for SketchUp 2014

      Further (on my PC, which has no encoding issue)...
      Encoding.default_external = UTF-8

      But..
      puts file_data.encoding
      file_data.force_encoding('ISO-8859-1').encode("UTF-8") if defined?(Encoding)
      puts file_data.encoding

      Generates...
      UTF-8
      ISO-8859-1

      I would have thought that the second encoding would always be UTF-8? I am trying to understand the insidious world of Encoding (thanks to Ruby 2)! Any advice or explanation would be appreciated.

      Context: A major plugin which simply wishes to reliably read a CSV file is currently useless due to the Encoding ISO-8859-1 issue.

      posted in Developers' Forum
      M
      marksup
    • RE: Upgrading plugins to Ruby 2.0 for SketchUp 2014

      Update - I have sent a user an .rbz, and he gets the error:

      Error: #<ArgumentError: unknown encoding name - ISO-8859-1>

      resulting from...
      file_data.force_encoding('ISO-8859-1').encode("UTF-8") if defined?(Encoding)

      He is using Windows 8, SketchUp 14, on a PC. How can this be??! - and what advice can I pass on?

      posted in Developers' Forum
      M
      marksup
    • RE: Scene (Page) animation of Section Cuts

      Correction! (a Scene is only interested in active Section Planes)...

      temporary_plane = current_model.entities.add_section_plane([0, 0, 9999], [0, 0, -1]).activate

      posted in Developers' Forum
      M
      marksup
    • RE: Scene (Page) animation of Section Cuts

      I have figured out how to create a 'Reset' Scene - which will always display without any active Section Cuts...

      scene = Sketchup.active_model.pages["Reset"]
      if not scene
      temporary_plane = Sketchup.active_model.entities.add_section_plane([0, 0, 0], [0, 0, -1]) # Not activated
      scene = current_model.pages.add("Reset")
      #scene.use_section_planes = true # Unnecessary since defaults to true
      Sketchup.active_model.entities.erase_entities(temporary_plane)
      else
      scene.update(63) # Update All except for Section Planes
      end

      Regarding 'Include in Animation' - the requirement would be to SET the value (for use by the standard View + Animation + Play function)

      posted in Developers' Forum
      M
      marksup
    • RE: Scene (Page) animation of Section Cuts

      Thanks again for your response, sadly I have in fact been perusing the API guide daily for over 5 years! - thus this query regarding basic but apparently missing function.

      My understanding is that .use_section_planes does NOT intrinsically decide if a Section Cut is active or not, it merely decides to remember, or not, any active Section Cut at the time the Scene was saved or last updated. Thus my queries (e.g. how to switch on Section Cut display, and how to create a Scene with .use_section_planes = true referencing no active Section Plane) remain.

      I guess any existing Cutting Planes could be stored, deleted, the 'Reset Scene' created, and then the Cutting Planes recreated, but this would not exactly be elegant - and might upset any existing Scenes which referenced the Cutting Planes.

      I'm still hoping that some obscure API methodology will offer a solution to some extent!

      posted in Developers' Forum
      M
      marksup
    • RE: Scene (Page) animation of Section Cuts

      PS - I'm also struggling to create a 'Reset' Scene which deactivates an active Section Cut Plane if one exists. It can be done interactively, but is it possible in Ruby?!

      posted in Developers' Forum
      M
      marksup
    • RE: Scene (Page) animation of Section Cuts

      Hi TIG,

      Thanks - hidden in rendering_options is indeed the simple answer to displaying (or not) Section Planes.

      But critically Display of Section Cuts is missing, and if not active, any Section Plane animation is invisible!

      Also, still no API method of activating Scene Animation, i.e. any way of sequentially displaying multiple Scenes.

      And incidentally, there appears to be no option to decide Scene/Page 'Include in animation'

      posted in Developers' Forum
      M
      marksup
    • Scene (Page) animation of Section Cuts

      I wish to automate the generation and presentation of Section Cut animation via Scenes.
      Creating the Scenes, each with its own active Section Plane, was straightforward.

      However, I am not sure if it then possible to automatically animate these Scenes.
      I have tried to employ a PagesObserver, and searched the Sketchup.send_action options, each to no avail...

      1. Is it possible to determine and/or set the Display Section Cuts option?

      2. Is it possible to determine and/or deactivate Display Section Planes?

      3. How can a set of Scenes then be automatically sequentially displayed (including the transition animation), or alternatively how can the Scene + Play Animation (or View + Animation + Play) function be invoked?

      Any ideas, anyone?!

      posted in Developers' Forum
      M
      marksup