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

    [Plugin] export_selection.rb

    Scheduled Pinned Locked Moved Plugins
    15 Posts 5 Posters 10.4k Views 5 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.
    • TIGT Offline
      TIG Moderator
      last edited by TIG

      export_selection.rb

      Usage: export_selection(type)
      Exports everything in the selection, the argument 'type' sets the file type...
      Faces with unselected Edges take those Edges with them...
      e.g. export_selection('obj')

      export_selection.rbPayPalButton

      TIG

      1 Reply Last reply Reply Quote 0
      • A Offline
        aboagdoed
        last edited by

        Thanks for this wonderful plugin............ 👍

        1 Reply Last reply Reply Quote 0
        • M Offline
          mwinkelstein
          last edited by

          Hi - can anyone help me understand how to use this tool? I really need to be able to export an skp selection to dwg.
          Thanks.

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

            As the download page says [with a little expansion]...
            Usage: export_selection(type)
            Exports everything in the selection, the argument 'type' sets the file type...
            Faces with unselected Edges take those Edges with them...

            You select what you want to export, then type in the Ruby Console:
            export_selection(type)
            or
            export_selection type
            [either will work]
            Where type is the 'file-extension-type' for the exported file,
            e.g. 'obj'
            The 'type' must be inside '' or "" - e.g. 'obj', 'dae' etc...
            It will then export the current selection as modelfolder+"/"+modeltitle+"_Part_."+type.
            The type of file-extension you give sets which exporter will be used.
            If an exported file-type can have 'Options' it will use the last used Options set for that file-type; so preset those beforehand - e.g. 'units'='meters', 'triangulation'='yes' etc.

            TIG

            1 Reply Last reply Reply Quote 0
            • F Offline
              fjsgruppe
              last edited by

              Hi,
              is it possible, that your tool does not work on layers consisting only of lines (no faces)?
              By the way, thanks a lot for your work!

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

                It depends what you are exporting. 😕
                It uses the current 3d exporter's Options.
                Set those from each 3d exporter's dialog.
                You must of course have these Edges selected [or at least their faces as they rely on their edges]...
                BUT if some element like Edges are set NOT to be included in the exported geometry, then they are not included... 😒

                TIG

                1 Reply Last reply Reply Quote 0
                • F Offline
                  fjsgruppe
                  last edited by

                  Thank's,
                  think I'll concentrate on these exportation options.

                  fjs

                  1 Reply Last reply Reply Quote 0
                  • F Offline
                    fjsgruppe
                    last edited by

                    Hi,
                    I did it and it works just fine! Thank you very much!
                    As I understand it, your tool sends the whole geometry with some layers off!?
                    I exported my selections to ... 'dwg' and the result was still 74 MB (original file ~ 81 MB). Is there a way to just send the actual selection, without having to delete all the rest (over and over again)?

                    1 Reply Last reply Reply Quote 0
                    • A Offline
                      anar
                      last edited by

                      Hi TIG,
                      I've tried the plugin but wasn't able to export to DXF neither DAE.
                      Do I need to have SU Pro to be able to export something with this plugin ?

                      And just another question...
                      Let's say I have N groups (or components) in my active selection.
                      Will the plugin export N files (of the type specified) ?
                      If not, do you know a plugin that could export all groups or components in a selection as separate DXF files ? The name of each DXF being the name of the group or component that it contains.

                      Anyway thanks for making plugins.
                      And I'm gonna try this one again (last try did generate a bug splat).

                      Cheers.

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

                        Some formats - like DXF - are limited to Pro users only...
                        Look at your File > Export > Filetypes options...

                        The common format 'Collada / DAE' should export OK...

                        Report back...

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • A Offline
                          anar
                          last edited by

                          "Some formats - like DXF - are limited to Pro users only..."

                          Sounds fair.

                          "The common format 'Collada / DAE' should export OK..."

                          Yes i was able to export with 'dae' type.
                          But it created a file with the 'skp' extension.

                          Thanks for your fast answer.
                          Regarding the second question, do you know any way I could export all my groups/components in separate files ?
                          I was thinking at trying "component2layer.rb" + "export_by_layer.rb" but ATM I don't see how to use the 1st one. Waiting for an answer from its author.

                          Thanks again TIG.

                          Edited :
                          Using "component2layer.rb" + "export_by_layer.rb" works fine.
                          But as I don't own a SU Pro licence, I can only export to DAE...
                          But for those who would like to export each component as a separate file, this is a workaround.

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

                            Did you give your export target a .dae filename - otherwise it'll probably make a .skp ???

                            TIG

                            1 Reply Last reply Reply Quote 0
                            • A Offline
                              anar
                              last edited by

                              Hi TIG,
                              I'm not sure I understand well.
                              Should the command be something like "export_selection ('dae') output.dae" ?
                              Because this doesn't work.

                              I'm typing "export_selection ('dae')" but the file it produces is a SKP (2014).
                              So even renaming it with a DAE extension afterward won't work.

                              One other remark :
                              everything except the selection is deleted. And the original SKP file seems to be saved that way.
                              So without working on a copy of the original SKP file, all that was outside of the selection is definitely lost. Hopefully I tested it on a test file and not on a file with important work in it.

                              Tested on SU Make 2015.

                              Cheers.

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

                                @anar

                                If you look at the date of the original post this script is 8 years old !
                                It is rather 'clunky' !!

                                However, I just tried it in v2017 and it works for me - exporting the selection as expected...

                                The command is export_selection('dae') to save the selection as a DAE file, using the last used DAE-export options...
                                If you put "" around the command etc it'll behave oddly.

                                It does temporarily delete unselected entities, so they are not included in the new file.
                                But that deletion is undone after the export.
                                So in your case for some reason it's failing before it completes !

                                There are several other newer exporters available in the PluginStore...

                                Of course if you use the SketchUp native exporter you can now set its options to include only the selection set anyway - making this old tool somewhat redundant.

                                TIG

                                1 Reply Last reply Reply Quote 0
                                • A Offline
                                  anar
                                  last edited by

                                  TIG,
                                  I didn't realized it was such an old plugin.
                                  So sorry if I revived this old post.

                                  I typed the command exactly like you did but as you said it probably fails before it completes.
                                  So I think it's important to tell people not to try it on an important scene that cost days of work at first.

                                  Anyway it's finally your export_by_layer plugin (probably another old one) that I'm more interested in, because it can export in separate files in just one go. And as far as I know the other export plugins don't have the option to export groups or components in separated files without exporting them one by one.
                                  I have a scene with 330 components that must become 330 DXFs.
                                  And I won't click on each of them, launch an exporter, give each file a name, etc. It would take me a all day!
                                  So I will keep on using export_by_layer (sorry to post that here but I'm not going to revive the other thread too...) until I find another way to perform this task.
                                  If it doesn't work as expected with SU2015, I will use it on an old SU2008 version.

                                  Thanks for your efforts, patience and explanations TIG.
                                  All the best.

                                  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