sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    "Export selected" always crash

    Scheduled Pinned Locked Moved Plugins
    1 Posts 1 Posters 2.8k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • icepenguinI Offline
      icepenguin
      last edited by

      Hi everybody. I made a tool to "copy" in SketchUp and "paste" it in 3dsMax (with the origin and texture preserved). It is a set of 2 plugins / scripts: "Copy to 3dsMax" and "Paste from SketchUp" (I set the shortcut buttons to Ctrl + Shift + C and Ctrl + Shift + V for the best "copy-paste" feel). How it works:

      • When using the “Copy to 3dsMax” function in SketchUp, it will “export” what you are selecting to a new temporary SKP file (version 8 to ensure compatibility with everything) at the path “C:\Temp\”. Big thanks to TIG (https://sketchucation.com/forums/viewtopic.php?f=180&t=32569) for the “export” method.

      • When using the “Paste from SketchUp” function in 3dsMax, it will import 3dsmax_temp.skp silently into 3dsMax with the last skp import setting.

      But the "export" part has a huge problem: if I'm in a component/group, using "Copy to 3dsMax" will cause my SketchUp (version 2020) to crash instantly, no matter how big or small the file.

      Here is the code after I edited from TIG's version:

      require 'sketchup.rb'
      require 'extensions.rb'
      
      module D95_MAXTOOL
      
      def self.copytomax
      d95_file_path = Sketchup.active_model.path
      model = Sketchup.active_model
      entities = model.entities
      d95_definitions = model.definitions
      d95_select = model.selection
      d95_model_title = (Sketchup.active_model).title
      
      if d95_model_title == ""
        UI.messagebox("Please save file first!")
      elsif not d95_select[0]
        UI.messagebox ("Please select something!")
      else
      
      model.start_operation("D95 Export")
      d95_select_array = d95_select.to_a
      edges=[]
      d95_select_array.each{|face|face.edges.each{|e|edges<<e if not d95_select_array.include?(e)}if face.class==Sketchup;;Face}
      d95_select_array = d95_select_array + edges
      d95_group = entities.add_group(d95_select_array)
      d95_entities = entities.to_a - [d95_group]
      d95_entities.each{|e|e.erase! if e.valid?}
      d95_definitions.each{|defn|defn.entities.each{|e|e.erase! if e.valid?}if not defn.instances}
      model.commit_operation
      
      model.save("C;/Temp/3dsmax_temp.skp", Sketchup;;Model;;VERSION_8)
      Sketchup.undo
      Sketchup.active_model.save(d95_file_path)
      end
      end
      
      menu = UI.menu('Extensions')
      menu.add_item("Copy to 3dsMax"){D95_MAXTOOL.copytomax}
      end
      

      "It simply erased everything that wasn't selected [and not needed]... and did an export as a 'skp'... and then 'undid' the erase back to where it had been [luckily an 'export' is not undoable]..." - TIG.

      Can you tell me where is the problem with the code?

      Besides, even though it works actually quite well with small files, but with heavy files "Copy to 3dsMax" becomes very laggy (and often crashes). I often have to do something very silly: open another temporary SketchUp instance, paste in it (with normal copy-paste function), and then use the “Copy to 3dsMax”. It still saves me a few seconds, but I feel it's too complicated. So I'm looking for a new, faster "export" method.

      Any help would be much appreciated.

      Wish you have a nice day.


      SketchUp "Copy to 3dsMax"

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post
      Buy SketchPlus
      Buy SUbD
      Buy WrapR
      Buy eBook
      Buy Modelur
      Buy Vertex Tools
      Buy SketchCuisine
      Buy FormFonts

      Advertisement