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

    sketchorro

    @sketchorro

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

    sketchorro Unfollow Follow
    registered-users

    Latest posts made by sketchorro

    • RE: [Plugin] Import OBJ with Materials v2.1 20131118

      Hi,

      Let me start by saying thanks for this plugin, it's great.

      I've started using it to import models from Structure Sensor.

      I decided to do a little hacking to make my life easier; basically setting the units to default to metres and taking a look at how to bulk import mesh models (todo). I also discovered that when the models were loading in the background/covered by another window, they loaded much faster (I'm on OSX/'14 Make).

      The reason for this is because the UI is getting hammered with several tens/hundreds of thousands of repaints (1 per obj file line) to updated the status bar from this:

      	 Sketchup.set_status_text("Processing line #{line_cnt} of #{lines.length}")
      

      I took a crack at fixing this by making the status line update on a change in percentage. I obviously screwed it up not being a ruby coder, but in the process discovered my 40K+ line (991kb) models loaded in about 2 seconds.

      It still slows down when you get really big models; I have a 13.2MB file that starts to grind after about 90%, but I suspect this is a memory/swap bottleneck.

      Anyway, I fixed my update code and it looks like this:

      Initialize the percentage variables before the looping starts

      
       old_percentage=-1
       new_percentage=0
      
       ### trap in case of a missing 'g'
       lines=["g OBJ\n"]+lines
      
      

      Update the status and force sketchup to repaint once per percentage point.

      
       # Sketchup.set_status_text("Processing line #{line_cnt} of #{lines.length}")
       new_percentage = ((line_cnt * 100.0)/lines.length).round;
       if old_percentage != new_percentage
         Sketchup.set_status_text("Importing Model - #{new_percentage}% (#{line_cnt} of #{lines.length})")
       end#if
       old_percentage = new_percentage
      
      

      Probably something that would help others enjoy this plugin a little more.

      -G

      posted in Plugins
      S
      sketchorro