• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

[REQ] Scale Definition

Scheduled Pinned Locked Moved Plugins
6 Posts 3 Posters 2.1k Views
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.
  • P Offline
    Pixero
    last edited by 27 Apr 2011, 12:20

    Is there a plugin that iterates through the selection and makes each group a component and then scales it's definition?
    (I have some imported Revit geometry that causes problems.)

    Edit: If it's a component already it would just scale the definition.

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 27 Apr 2011, 12:40

      tr=Geom;;Transformation.scaling(ORIGIN,10,10,10);Sketchup.active_model.selection.to_a.each{|e|next if e.class!=Sketchup;;Group;n=e.name;n='G'if n=='';i=e.to_component;i.name=n;d=i.definition;d.name=n;d.entities.transform_entities(tr,d.entities.to_a)}
      

      This makes every selected group into a component [named after the group, or G/G#1/etc if it's unnamed], with the same name, and scales the definition x10 about it's insertion point [ORIGIN] - change those values to suit yourself...

      EDIT: for a component use this

      tr=Geom;;Transformation.scaling(ORIGIN,10,10,10);Sketchup.active_model.selection.to_a.each{|e|next if e.class!=Sketchup;;ComponentInstance;d=e.definition;d.entities.transform_entities(tr,d.entities.to_a)}
      

      TIG

      1 Reply Last reply Reply Quote 0
      • P Offline
        Pixero
        last edited by 27 Apr 2011, 13:00

        @tig said:

        tr=Geom;;Transformation.scaling(ORIGIN,10,10,10);Sketchup.active_model.selection.to_a.each{|e|next if e.class!=Sketchup;;Group;n=e.name;n='G'if n=='';i=e.to_component;i.name=n;d=i.definition;d.name=n;d.entities.transform_entities(tr,d.entities.to_a)}
        

        This makes every selected group into a component [named after the group, or G/G#1/etc if it's unnamed], with the same name, and scales the definition x10 about it's insertion point [ORIGIN] - change those values to suit yourself...

        EDIT: for a component use this

        tr=Geom;;Transformation.scaling(ORIGIN,10,10,10);Sketchup.active_model.selection.to_a.each{|e|next if e.class!=Sketchup;;ComponentInstance;d=e.definition;d.entities.transform_entities(tr,d.entities.to_a)}
        

        I meant "Scale Definition" as in right clicking a component and selecting it from the pop up menu. No idea what scale number to use. One?

        1 Reply Last reply Reply Quote 0
        • T Offline
          TIG Moderator
          last edited by 27 Apr 2011, 13:26

          Aha...
          You mean scale the definition to match the current instance's scale ?
          In that case it's a bit more complicated and simpler at the same time! ...
          If it's a scaled group it will convert to a component instance at its current scaling - but the definition will be the original size. The quick fix is to clone the group inside a new group of the same name, and erase the original group, then explode the clone within the new group so its scaling gets 'frozen', THEN make that group into a component that is no longer scaled and the current size instead

          m=Sketchup.active_model;m.start_operation('X');m.selection.to_a.each{|e|next if e.class!=Sketchup;;Group;n=e.name;n='G'if n=='';g=m.active_entities.add_group;t=g.entities.add_instance(e.entities.parent,e.transformation);e.erase!;t.explode;i=g.to_component;i.name=n;d=i.definition;d.name=n};m.commit_operation
          

          If it's already an instance we can use

          m=Sketchup.active_model;m.start_operation('X');m.selection.to_a.each{|e|next if e.class!=Sketchup;;ComponentInstance;d=e.definition;n=e.name;g=m.active_entities.add_group;t=g.entities.add_instance(d,e.transformation);e.erase!;t.explode;i=g.to_component;dd=i.definition;d.instances.each{|ii|ii.definition=dd};d.name=n+rand.to_s;dd.name=n;d.entities.erase_entities(d.entities.to_a)};m.commit_operation
          

          This makes all instances of a definition the same ? Do you only get one of each from Revit ??

          TIG

          1 Reply Last reply Reply Quote 0
          • P Offline
            Pixero
            last edited by 27 Apr 2011, 13:34

            Thanks, this seemed to work. 👍

            The problem was that the groups was in some huge scale so "opening" a group would cause clipping to go haywire and also textures had to be enormous in scale.

            1 Reply Last reply Reply Quote 0
            • D Offline
              DOD3R
              last edited by 5 Jun 2018, 06:21

              I would appreciate an option to scale all components definition to their current scale.
              Is there some plugin for that or any other way of doing it component by component ?

              I have problems with large dwg imports after I scale the to desired size. Formal dwg block imported to sketchup as components are all scaled and I need to manually scale their definitions witch can by labor-some.

              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