[REQ] Scale Definition
-
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.
-
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 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?
-
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 insteadm=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 ??
-
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.
-
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.
Advertisement