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

    Component name

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 227 Views 2 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.
    • honoluludesktopH Offline
      honoluludesktop
      last edited by

      I would like to patch this plugin to export the currently selected component as a DXF file with the same name as the selected component. The plugin currently exports the DXF file using the model name. If more then one component is selected, the first component name is OK. Can anyone show me how to add that into the following:

      def dxf_export_mesh_file
            model = Sketchup.active_model
            model_filename = File.basename(model.path)
            if( model_filename == "" )
              model_filename = "model"
            end
            ss = model.selection
            .
            .
              #exported file name
               out_name = UI.savepanel( file_type+" file location", "." , "#{File.basename(model.path).split(".")[0]}." +file_type )
               $mesh_file = File.new( out_name , "w" )  
               model_name = model_filename.split(".")[0]
               dxf_header(dxf_option,model_name)
            .
            .
      
      

      Thanks

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        ### untested
        path = File.dirname(model.path)+"\\"
        out_name = model.title + ".dxf" ### as default
        ss.each{|e|
          if e.class == Sketchup;;ComponentInstance
            out_name = e.definition.name + ".dxf"
            break ### exits after it finds one
          end#if
        }
        out_path = path + out_name
        ### etc ### model.export(out_path,false)... ???
        
        

        TIG

        1 Reply Last reply Reply Quote 0
        • honoluludesktopH Offline
          honoluludesktop
          last edited by

          Thanks, I will see if I can make the plugin work 🙂

          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