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

    [REQ] workflow tool -make groups of components (nested)

    Scheduled Pinned Locked Moved Plugins
    3 Posts 1 Posters 224 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.
    • TIGT Offline
      TIG Moderator
      last edited by

      You haven't explained yourself very clearly.

      If I understand you correctly your CAD programs exports directly into SKP.
      It uses SUp components [which were presumably CAD-blocks] rather than SUp groups.
      I assume it also includes 'loose-geometry' too...

      This is to be expected... 😕
      If you were to Import the CAD [DWG/DXF] file into a SKP the very same thing will happen.
      However, in that case all of the imported objects should be inside a single new component named after the imported file and therefore that'd perhaps be more readily editable.
      Using the Outliner you can select whatever component[s] you want and use Explode [Edit/context-menu or recommended, use a Shortcut-key], exploded objects' geometry remains highlighted so you can immediately make that into a new group, again using Edit/context-menu or recommended, use a Shortcut-key - Entity Info can be used to rename the group after the component.

      To tidy up the Components Browser you can purge unused from either its pop-out menu OR from Model Info > Statistics - which also removes unused materials, layers etc that might otherwise get left behind after the components are removed from the SKP...

      This one-liner can be copy+pasted into the Ruby Console and it will convert all selected [other things are simply ignored so you don't need to be too careful!] component-instances into groups, using the the same names/layer/materials etc...

      m=Sketchup.active_model;as=m.active_entities;m.start_operation('Co>>Gp');m.selection.to_a.each{|e|next unless e.is_a?(Sketchup;;ComponentInstance);n=e.definition.name;o=e.name;l=e.layer;t=e.material;x=e.explode;es=[];x.each{|f|es<<f if f.is_a?Sketchup;;Drawingelement};g=as.add_group(es);g.name=n+"#"+o;g.layer=l;g.material=t};m.commit_operation;
      

      It is one step undo-able...
      It doesn't deal with nested instances BUT repeated a few times on a selection it will 'group-ify' them all...

      TIG

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

        I replied in your parallel posting... I have merged them into this one... to avoid confusion...

        TIG

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

          @unknownuser said:

          hi there again.

          where would i find help or a compendium that helps me selfteach how 2 generate a working script?!

          i thind your could be a great base for what i want!
          Find the free PDF on the www called Automatic-SketchUp...
          Also get simple a few scripts [there are hundreds!] and read them in Notepad/Notepad++ to see/learn what they do.
          Also the learn the API = https://developers.google.com/sketchup/docs/
          There are also several excellent resources in the Developers' section of SCF...
          Learn to use the Search tools...

          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