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

    Individually export all components to .dwg

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 2 Posters 5.1k 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.
    • J Offline
      janunes65
      last edited by

      I haven't managed I need help

      ` model = Sketchup.active_model
      modelpath=File.dirname(model.path)
      modeltitle=model.title

      clist = []
      for c in model.definitions
      if c.count_instances > 0 and c.group? != true
      clist = clist.push([c.name])
      Sketchup.active_model.selection.add( Sketchup.active_model.definitions[c.name].instances )
      sel = Sketchup.active_model.selection
      #export(modelpath + "/" + c.name + ".dwg",false)
      sel.export(modelpath + "/" + c.name + ".dwg",false)
      end
      end`

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

        Link Preview Image
        Class: Sketchup::Model

        This is the interface to a SketchUp model.

        favicon

        SketchUp Ruby API Documentation (ruby.sketchup.com)

        export(modelpath + "/" + c.name + ".dwg", options_hash )

        You need to construct the options hash to only export the selection etc...
        however I don't know what hash items will work with DWG and your SketchUp version...

        An alternative workaround would be to do the individual exports in a model.start_operation(...) block in which you need to get a reference to each component-definition in turn, erase all of the model with model.entities.clear!, then place an instance of chosen component at the origin, then purge unused definitions, layers and materials etc to tidy up, then do the export to DWG, finally immediately run mode.abort_operation which undoes all of the changes...
        The export of just that one definition as a DWG will survive... but the model itself will revert to how it was before that export operation.
        Process the next definition in the same way until all are done...

        TIG

        1 Reply Last reply Reply Quote 0
        • J Offline
          janunes65
          last edited by

          3D Autocad (DWG/DXF)
          :acad_version - Specifies the autocad_version to export.

          values: "acad_12", "acad_13", "acad_14", "acad_2000", "acad_2004", "acad_2007", "acad_2010", "acad_2013"

          :faces_flag - Boolean to indcate whether to export faces.

          :construction_geometry - Boolean to indicate whether to export construction geometry.

          :dimensions - Boolean to indicate whether to export dimensions.

          :text - Boolean to indicate whether to export text objects.

          :edges - Boolean to indicate whether to export edges.

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

            So if that is the extent of the options, then 'selection' is not there ?
            So look at my alternative idea of deleting 'everything' but the chosen component instance, then aborting...

            TIG

            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