FREDO SCALE Plugin for Sketchup - · PDF fileFredo6 – FredoScale Page 1 / 14 v2.0...

14
Fredo6 – FredoScale Page 1 / 14 v2.0 –28 Mar 2009 FREDOSCALE - Plugin for Sketchup Free Scaling and Taper Scaling VERSION 2.0 28 MAR 09 1. Overview FredoScale 2.0 applies geometric transformations to a selection. For many of them, the selection will be enclosed in an adjustable deformation box. Moving the handles or pads of the box will determine the amount and parameters of the deformation (‘Box mode’). It is also possible to specify the deformation by matching an origin and a target point. This is called the ‘Target mode’. Finally, some deformations support a third mode, without any box, based on a Protractor. This is the ‘Free mode’. FredoScale 2.0 supports the following transformations: Scaling (box, target) Taper (box, target) Plane Shear (box, target, free) Stretch (box, target) Twist (box) Radial Bend (free) Rotate (box, free) Note: The original version of FredoScale (v1.0) only supported Scaling and Tapering in a box, hence the name “FredoScale”. 2. Installation The FredoScale plugin works for Sketchup versions 5 1 , 6 and 7 (Free and Pro). To install the FredoScale plugin, you should unzip 2 the file you downloaded (FredoScale_20.zip in principle) into the Sketchup Plugins folder. This operation should: Copy one script file ZLoader_FredoScale.rb to the Sketchup Plugins folder: Create a sub-folder FREDOSCALE_Dir_20, containing the main script files, the icons and cursor files (FSC_....png), the language files (FredoScale_xx.lang) as well as the documentation in PDF format. IMPORTANT : the FredoScale 2.0 plugin requires the Shared Library LibFredo6 version 3.1 or higher. This library is itself installed as a file LibFredo6.rb and subfolder LIBFREDO6_Dir_31 in the Sketchup Plugins folder. Below is the footprint for a Windows PC: 1 Version 5 must be 5.160 and higher 2 In Winzip, make sure you do a Select All, and then Extract in the Plugins folder, so that you create or properly copy the folder hierarchy.

Transcript of FREDO SCALE Plugin for Sketchup - · PDF fileFredo6 – FredoScale Page 1 / 14 v2.0...

Page 1: FREDO SCALE Plugin for Sketchup - · PDF fileFredo6 – FredoScale Page 1 / 14 v2.0 –28 Mar 2009 FREDO SCALE - Plugin for Sketchup Free Scaling and Taper Scaling VERSION 2.0 –

Fredo6 – FredoScale Page 1 / 14 v2.0 –28 Mar 2009

FREDOSCALE - Plugin for Sketchup

Free Scaling and Taper Scaling

VERSION 2.0 – 28 MAR 09

1. Overview

FredoScale 2.0 applies geometric transformations to a selection. For many of them, the

selection will be enclosed in an adjustable deformation box. Moving the handles or pads

of the box will determine the amount and parameters of the deformation (‘Box mode’). It

is also possible to specify the deformation by matching an origin and a target point. This is

called the ‘Target mode’. Finally, some deformations support a third mode, without any

box, based on a Protractor. This is the ‘Free mode’.

FredoScale 2.0 supports the following transformations:

• Scaling (box, target)

• Taper (box, target)

• Plane Shear (box, target, free)

• Stretch (box, target)

• Twist (box)

• Radial Bend (free)

• Rotate (box, free)

Note: The original version of FredoScale (v1.0) only supported Scaling and Tapering in a

box, hence the name “FredoScale”.

2. Installation

The FredoScale plugin works for Sketchup versions 51, 6 and 7 (Free and Pro).

To install the FredoScale plugin, you should unzip2 the file you downloaded

(FredoScale_20.zip in principle) into the Sketchup Plugins folder. This operation should:

• Copy one script file ZLoader_FredoScale.rb to the Sketchup Plugins folder:

• Create a sub-folder FREDOSCALE_Dir_20, containing the main script files,

the icons and cursor files (FSC_....png), the language files (FredoScale_xx.lang)

as well as the documentation in PDF format.

IMPORTANT: the FredoScale 2.0 plugin requires the Shared Library LibFredo6

version 3.1 or higher. This library is itself installed as a file LibFredo6.rb and subfolder

LIBFREDO6_Dir_31 in the Sketchup Plugins folder. Below is the footprint for a

Windows PC:

1 Version 5 must be 5.160 and higher

2 In Winzip, make sure you do a Select All, and then Extract in the Plugins folder, so that you create or

properly copy the folder hierarchy.

Page 2: FREDO SCALE Plugin for Sketchup - · PDF fileFredo6 – FredoScale Page 1 / 14 v2.0 –28 Mar 2009 FREDO SCALE - Plugin for Sketchup Free Scaling and Taper Scaling VERSION 2.0 –

Fredo6 – FredoScale Page 2 / 14 v2.0 –28 Mar 2009

3. Menus, Toolbar and Configuration

The icons are shown in a toolbar, named “FredoScale” 3

. By default not all icons are

displayed, but you can configure the toolbar to add or remove those you find useful or

useless. The Plugin menu entries are located in the Sketchup “Tools” menu, under the

submenu “Fredo6 Collection”:

Since the tools act on a selection, there is a menu entry “FredoScale” in the Selection

Contextual menu too.

At time of publishing the version 2.0, FredoScale is available in International English

and French. Kind contributors provided translations of version 1.0 for German (Tom2),

Italian (Marco Cosedi) and Spanish (Pichuneke), and may update it for version 2.0.

Finally, you can decide to use alternate icons and cursors, if someone publishes any.

Image files should be packaged in a folder named “IMAGES_xxx” to be dropped into the

subfolder FREDOSCALE_Dir_20.

3 I will use Fredo6 Collection for grouping small scripts, in order not to pollute too much the menu structure

Page 3: FREDO SCALE Plugin for Sketchup - · PDF fileFredo6 – FredoScale Page 1 / 14 v2.0 –28 Mar 2009 FREDO SCALE - Plugin for Sketchup Free Scaling and Taper Scaling VERSION 2.0 –

Fredo6 – FredoScale Page 3 / 14 v2.0 –28 Mar 2009

You can modify the default setup for menus and toolbar by configuring the Default

Parameters:

You will also find several other settings which you can change. The parameters are

preserved from one session to the next one (the parameter file is stored in the

DEFPARAM_Dir folder of the Sketchup plugin directory).

Page 4: FREDO SCALE Plugin for Sketchup - · PDF fileFredo6 – FredoScale Page 1 / 14 v2.0 –28 Mar 2009 FREDO SCALE - Plugin for Sketchup Free Scaling and Taper Scaling VERSION 2.0 –

Fredo6 – FredoScale Page 4 / 14 v2.0 –28 Mar 2009

4. Basic Principles

The FredoScale plugin works for Sketchup versions 54, 6 and 7 (Free and Pro).

1) Free Scaling

FredoScale is a variant of the native Sketchup Scale tool, allowing free orientation of

the scaling box, instead of using a box always matching the red, green and blue axes of

the model. By default, the script will try to find the best fitting box, but you can modify

it interactively.

Native Sketchup Scale Free Scale

Likewise, it is easier to scale a 2D drawing on a face, regardless of its orientation:

Native Sketchup Scale Free Scale box Free Scale deformation

Like the Sketchup native Scale tool, FredoScale works on any selection of objects, made

of simple geometry, groups and components. It supports scaling from corners, middle of

segments and centers of faces, about the opposite corner or about the scaling box center.

Scaling can be uniform or non-uniform. Scales can be entered and modified via the

VCB, while scaling the box or right after. The deformation can be shown live, while

dragging (although live feedback can also be shown in wireframe only).

There are however a few additional features:

- you can scale single edges. This may be useful to do simple tapering,

- you can directly specify the scaling by setting the target dimensions of the

scaling box,

- you can also scale the selection by pairing an origin point with a target point

(“Scale to Target”). This may help the aficionados of the Push-Pull-Scale method.

2) Taper Scaling

The principle is to taper the selection by scaling a face (or an edge) of the scaling box.

For instance, with a 3D selection:

4 Version 5 must be 5.160 and higher

Page 5: FREDO SCALE Plugin for Sketchup - · PDF fileFredo6 – FredoScale Page 1 / 14 v2.0 –28 Mar 2009 FREDO SCALE - Plugin for Sketchup Free Scaling and Taper Scaling VERSION 2.0 –

Fredo6 – FredoScale Page 5 / 14 v2.0 –28 Mar 2009

Selection box Selecting face for tapering Tapering from center Sphere ���� Egg

The same approach works on a 2D selection:

Remember that you can do these tapering transformations (and much more!) with the

very powerful plugin SketchyFFD by Chris Phillips.

Page 6: FREDO SCALE Plugin for Sketchup - · PDF fileFredo6 – FredoScale Page 1 / 14 v2.0 –28 Mar 2009 FREDO SCALE - Plugin for Sketchup Free Scaling and Taper Scaling VERSION 2.0 –

Fredo6 – FredoScale Page 6 / 14 v2.0 –28 Mar 2009

5. Using FredoScale

All Tools functions in 4 steps, noting that Steps 1 and 2 are common to all of them:

1) Selection of the elements to scale or taper (explicit or implicit)

2) Orientation of the Scaling Box (if the one computed by default is not

satisfactory)

3) Selection of a handle (or pads)

4) Interactive deformation, via manipulating the box handles, typing scales in the

VCB, entering dimensions or using the “to Target” mode.

1) Selection

Selection is considered valid if it contains at least 1 edge or 1 face, whether at model

level or embedded in components or groups.

Like for many Sketchup tools, it supports 2 modes of selection: Explicit and Implicit

- EXPLICIT: First do the selection, then start the tool.

The FredoScale or Tapering mode will starts directly when you click on the

toolbar icon (or select the submenu) if the selection is valid. By pressing ESCAPE,

you can clear the active selection and go to the IMPLICIT selection mode.

- IMPLICIT: Start the tool with NO active selection, and then select entities by

Mouseover; Click when finished.

The selection is done by Mouse over, like in Sketchup native tools. In addition:

� Keeping CTRL depressed, will add / remove to the current selection

� Toggling SHIFT, to either select individual faces and edges, or select all

their connected elements.

Individual selection mode ‘All-connected’ selection mode

Note on Face selection: whether the ‘View ‘hidden’ option is active or not, the

selection of one face extends to all neighbor faces that have edge hidden or

softened (so you actually select “surfaces”).

Page 7: FREDO SCALE Plugin for Sketchup - · PDF fileFredo6 – FredoScale Page 1 / 14 v2.0 –28 Mar 2009 FREDO SCALE - Plugin for Sketchup Free Scaling and Taper Scaling VERSION 2.0 –

Fredo6 – FredoScale Page 7 / 14 v2.0 –28 Mar 2009

2) Orientation of the Scaling box

The initial Scaling box computed tries to reflect the best fit, at least for a given plane:

• Dimension 1: single edge or collinear edges (whether contiguous or not). The

box is actually a single line.

• Dimension 2: when all entities are located in the same plane, the scaling box is

the best-fitting rectangle. The exact solution is adjusted to reflect symmetries

when manageable (issues are for circles and regular polygons).

Symmetry in all directions Symmetry in only 2 directions

• Dimension 3: the initial scaling box is oriented along the Horizontal Plane (most

common case). If your selection is not, then you’ll have to adjust this plane.

Selection aligned on Horizontal Plane Selection not aligned

Once you have a Scaling Box, you can change its orientation by several means:

• Arrow Keys: Up for model axes, Left and Right to cycle through the axes of

the top-level components, and Down restores the initial box.

• Mouse over edge: when you move the mouse over edges anywhere in the

model, you will notice that they highlight in orange. If you click, the box will re-

align along the selected edge.

Page 8: FREDO SCALE Plugin for Sketchup - · PDF fileFredo6 – FredoScale Page 1 / 14 v2.0 –28 Mar 2009 FREDO SCALE - Plugin for Sketchup Free Scaling and Taper Scaling VERSION 2.0 –

Fredo6 – FredoScale Page 8 / 14 v2.0 –28 Mar 2009

• Mouse over face: when you move the mouse over faces anywhere in the model,

you will notice that the cursor becomes a Red arrow. If you click on the face,

then the box will align with the face plane as one of its plane.

����

For random 3D orientation, you may have to apply Face and Edge alignments

successively.

3) Interactive Free Scale

Once you have the scaling box correctly oriented, you can use it pretty much as the

native Sketchup Scale tool. Gently mouse over a handle. It will highlight in White, and

the fixed point (pivot) in Red. Local axes are defined for the scaling box and shown at

the dragging handle.

The modifiers works in Toggle mode5:

- CTRL: select the pivot as the Center or the opposite handle

- SHIFT: Uniform / non Uniform deformation for the corner and middle handles

After you selected the dragging handle you can:

- Drag the handle. The plugin supports both ‘Click down – Drag – Release’ and

‘Click – Release – Drag – Click – Release’ modes.

- Type scale(s) in the VCB, as float numbers, positive or negative. Note that the

plugin supports both ‘,’ and ‘.’ as the decimal separator, regardless of your

system settings.

- Call the Box dimension dialog box, by pressing TAB. This allows you to set

the dimensions, and therefore the scales, in the directions allowed by the type of

handle you selected.

5 Unlike native Sketchup Scale tool, where Ctrl and Shift keys are active only when depressed

Page 9: FREDO SCALE Plugin for Sketchup - · PDF fileFredo6 – FredoScale Page 1 / 14 v2.0 –28 Mar 2009 FREDO SCALE - Plugin for Sketchup Free Scaling and Taper Scaling VERSION 2.0 –

Fredo6 – FredoScale Page 9 / 14 v2.0 –28 Mar 2009

By default, the scaling deformation is done interactively on the selection. However, you

may want to disable this feature in order to better use inferences when moving the

selected handle:

- F2: toggle ‘live’ deformation when dragging.

- F3: toggle ‘wireframe’ on or off, when there is no live deformation.

After you have done a deformation, by whatever method, you can still modify the scales

by the same methods (dragging, VCB, dimension dialog box). Note however that the

scale is kept to its last value for the handle pair you last used (otherwise it is reset to

1.0).

Finally, all commands and short cuts are available via the contextual menu.

4) Target Mode

This is another way to specify the scaling factor(s). The idea is that you visually specify

the deformation as the transformation that would bring an Origin point to a

Target point.

There are two main ways to invoke the Target mode.

1) You invoke it via the menu or the icon6

2) You double-click on a scaling handle. This works in toggle between Scale to

Target and Free Scale.

The deformation box is displayed in a different color.

The first action is to select the Origin, by moving the Green Cross and click. Then, you

move it to the target, shown as a Red Cross. The Origin and Target can be located

anywhere in the model.

6 if you have added it to the toolbar

Page 10: FREDO SCALE Plugin for Sketchup - · PDF fileFredo6 – FredoScale Page 1 / 14 v2.0 –28 Mar 2009 FREDO SCALE - Plugin for Sketchup Free Scaling and Taper Scaling VERSION 2.0 –

Fredo6 – FredoScale Page 10 / 14 v2.0 –28 Mar 2009

Note however that there are regions where the Origin is forbidden, usually close or

‘behind’ the pivot handle (as these regions are never deformed in the scaling).

The placement of the target supports inference from the origin:

- Arrows for locking on axes of the scaling box

- Shift to lock in current direction (toggle key)

- Stickiness to axes, collinear and perpendicular to edges

In addition, you can type the distance in the VCB.

5) Taper Scale

While the selection and box orientation are similar to Free Scale, there are differences in

specifying the deformation. Remember that the tapering is done by scaling one face of

the box, and apply it to the selection.

First, the scaling box does not show cubic handles but small pads on each face.

The principle is that you carefully mouse over the pads to select the face to scale and the

dragging pad (since the same handle corresponds to 2 or 3 faces).

From there, you use the handle to scale the selected face. You can use CTRL to specify

deformation about the center or opposite pad, and SHIFT to enable uniform or non-

uniform scaling. You can also set the scale by the box dimension (using TAB)

Tapering deformation Validation stage Refresh box after validation

Page 11: FREDO SCALE Plugin for Sketchup - · PDF fileFredo6 – FredoScale Page 1 / 14 v2.0 –28 Mar 2009 FREDO SCALE - Plugin for Sketchup Free Scaling and Taper Scaling VERSION 2.0 –

Fredo6 – FredoScale Page 11 / 14 v2.0 –28 Mar 2009

While dragging the pad, only the box is deformed live. The model deformation is shown

optionally in wireframe, but the model will be deformed only when you finish dragging.

When the deformation is done, the cursor is shown as a green Check mark. In this stage,

you can either continue dragging, or specify the scale(s) in the VCB. If you simply click,

then, the new scaling box will be computed.

In 2 dimensions, you have to select edges of the rectangle. The pads have a different

shape, but the principle remains the same.

Note finally that in dimension 1, Taper Scale is equivalent to Free Scale.

6) Taper to Target

Like for Scale to Target, Taper Scale has a mode that allows specify the deformation by

matching an origin and a target point.

You can call it via the menu or icon, if enabled, or by double-clicking on a pad.

The behavior is the same as for Scale to Target, as Taper Scale is finally just equivalent

to scaling a face (or an edge) of the box, using the Free Scale method.

Page 12: FREDO SCALE Plugin for Sketchup - · PDF fileFredo6 – FredoScale Page 1 / 14 v2.0 –28 Mar 2009 FREDO SCALE - Plugin for Sketchup Free Scaling and Taper Scaling VERSION 2.0 –

Fredo6 – FredoScale Page 12 / 14 v2.0 –28 Mar 2009

6. Additional Features

A few features worth noticing:

1) Exiting the tool: at any stage, if you move the cursor outside any element of the model,

it will display a Green Arrow. If you click, you will exit the tool.

2) Escape: this key is used contextually to go to the previous state, like in the native

Sketchup tools.

3) Undo: it is supported during the scaling operations. The scaling box is recomputed on

the fly. It may appear asynchronously.

4) Formulas in dimensions dialog box: you can type mathematical formulas and specify

units. For convenience, the decimal separator can be the comma or dot indifferently. If

you do not specify a unit, then the current model unit is assumed. However, the

convention is that multiplying and dividing factors are always placed AFTER the

length. For instance “2’ ½ * 2.5” is valid, whereas “2 * 3cm” is not.

For instance, the following will result in 405 cm.

Architectural units are supported.

5) Specifying several scales in the VCB: for non uniform scaling you may have to enter

up to 3 numbers (like in the native Sketchup Scale tool). The valid separator is either a

space or a semi-column (‘;’). The decimal separator can be the comma or dot

indifferently. You can use a formula too, but you must NOT use spaces within your

formula.

Page 13: FREDO SCALE Plugin for Sketchup - · PDF fileFredo6 – FredoScale Page 1 / 14 v2.0 –28 Mar 2009 FREDO SCALE - Plugin for Sketchup Free Scaling and Taper Scaling VERSION 2.0 –

Fredo6 – FredoScale Page 13 / 14 v2.0 –28 Mar 2009

7. Plugin Configuration

1) Default Parameters

Via the menu “Default Parameter…”, you can specify a few settings. I hope the dialog

box is self-explanatory:

1) Visual parameters, mainly colors and selection mode

2) Plugin settings, about the menu and tool bar configuration, as well as the

alternate icons (if any provided).

IMPORTANT: Default parameters are stored in a file (FredoScale.def) which is

located in a special subfolder DEFPARAM_Dir of the Sketchup Plugin folder (and thus

not in FREDOSCALE_Dir_10). This allows your default parameters to survive when

you upgrade to newer versions.

2) Documentation and Support

There are menu entries that will open the PDF documentation, and the web site where

the Plugin is discussed.

3) Language Translation

As a feature provided by the shared Library LibFredo6, it is now possible to translate the

plugins in most languages via external files. The translation MUST be done from within

the tool, but the result is stored in individual files per language (here

FredoScale_xx.lang, where xx is the language code). The whole translation process is

documented separately in the manual related to LibFredo6.

Page 14: FREDO SCALE Plugin for Sketchup - · PDF fileFredo6 – FredoScale Page 1 / 14 v2.0 –28 Mar 2009 FREDO SCALE - Plugin for Sketchup Free Scaling and Taper Scaling VERSION 2.0 –

Fredo6 – FredoScale Page 14 / 14 v2.0 –28 Mar 2009

8. Known Limitations – Caveats - Performance

1) Bugs

• In some situation, the initial best fitting box is not correct (so you need to

manually adjust the direction). This may be due to problems with rounding and

Sketchup approximation when testing parallel vectors. I’ll try to fix it in a next

version.

2) Caveats and Limitations

• You must NOT modify the selection during the scaling operations (via Ctrl-A

or Ctrl-T for instance). Unexpected result if you do.

• The FredoScale tool does NOT do ‘Smart Scaling’ with Dynamic components.

This is because the scaling method available in the Sketchup API does not support

it, and there is no other API yet.

• Taper Scale is slightly ‘destructive’, in the sense that:

- It makes ‘unique’ all components and groups selected

- It explodes all curves present in the selection

Note however that the plugin just applies transformation to the model, meaning

that all materials, attributes and element hierarchy are preserved (i.e. the plugin

does not ‘reconstruct’ the model).

In all cases, it is highly recommended that you save your model prior to perform

this transformation on complex models. In some occasions, the Undo can generate

a bug splat.

• On edges or faces, FredoScale always forces a line or rectangle scaling box. In

native Sketchup Scale tool, when the lines or face are not aligned with the axes,

you get a 3D box which allows making more transformation in 3D space.

• In interactive deformation mode via dragging handles, you cannot scale down the model below a factor of 0.1. I noticed strange behaviors when doing it.

Instead, use the VCB or the Dimension dialog box for setting smaller scales.

3) Performance consideration

• The time to load the plugin is indicated in the “About…” dialog box. It should

be fast, less than 100 ms. Please check it and report if you find an abnormal time.

• Free Scale is sensitive to the complexity of the model to compute the initial

Scaling box. However, once computed, the change of orientation should be fast,

and the interactive scaling behaves more or less at the same speed as the native

Sketchup Scale tool.

• Taper Scale requires more computations for the transformation. This is why I did

not make it interactive visually, except in wireframe. In practice, however, you

would not taper a very complex model in one shot.