Loading a ruby
-
Hi all,
I copied & pasted this ruby of TIG into a text editor & renamed it areatext.rb, but got a 'syntax error' when copied into Plugins folder & started SU. Did I do it the right way?
@unknownuser said:
@tig said:
I have a proto-script
[list]
#-----------------------------------------------------------------------
Copyright 2010 TIG
Permission to use, copy, modify, and distribute this software for
any purpose and without fee is hereby granted, provided something the
above copyright notice appear in all copies.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#-----------------------------------------------------------------------
Name:
AreaText.rbDescription:
Adds a submenu to the Plugins menu containing:'Add Area Text'
This lets you add a piece of Text to a Face by Picking it, the text
has a short leader and is placed at the picked point.
The Text is associated with the Face and moves with it, relative to
the Face's bounding-box minimum.
If the Area Text is relocated manually it will 'remember' its new
location relative to its Face's bounding-box minimum.
The area in the Text is formatted in 'sqm' for metric Models and in
'sqft' otherwise. The 'sqm' value is to rounded to 2 dp [1.23], and
the 'sqft' value is rounded to 1 dp [13.2].
By default the Area is named "Area 1:" - with the numerical part
incrementing, so for example it might be "Area 5: 12.34 sqm"
The tool lets you place pieces of Area Text until you press <Esc> or
choose another Tool.
If a Face already has a piece of Area Text associated with it you are
warned and nothing is done.
Later on, if desired you can edit a piece of Area Text as if it were
plain-text - e.g. to give it an associated room name, but if the
associated Face tis changed then the Area Text will automatically
change its text to suit its new area: if you edit the area be sure to
leave a semi-colon [:] in the text as this separates the numerical
area from the Face's 'tag'; do not change the numerical part or its
units suffix: so the correctly formatted 'Office: 12.34 sqm' updates
to 'Office: 12.98 sqm', and even the 'Office 12.34 sqm' will update to
'Office: 12.98 sqm' [because in the absence of a ':' the last space
between the numerical part and the 'tag' will be used as an
alternative delimiter], BUT 'Office-12.34 sqm' will update to
': 12.98 sqm' with NO tag name. You can use ':' inside the face tag
because only the last one is used for the delimiter, BUT this is best
avoided.
The displayed numerical area is always up to date - changing if the
associated Face [or it's parent] is altered in any way.
Chaging the Models units from Metric will update all areas in 'sqft'.
If a Face is erased and it had a piece if Area Text associated with
it then that Area Text is also erased.
Area Text referring to a Face within a Group etc that has been Scaled
will report the area as displayed - i.e. not the original unscaled
face's area.'Add Area Text to Selected'
This is similar to 'Add Area Text' but you first Select some Faces
[other types of Entities in the Selection are ignored], then run this
Tool and pieces if Area Text will be added to any eligible Faces
[i.e. those that do not already have Area Text associated with them].
The Area Text is added to the center of each Face's bounding-box and
moves with the Face.
The Area Text is otherwise exactly as that made with 'Add Area Text''Area Text to CSV'
All Area Texts in the Model are audited to ensure they
are currently up to date.
It then makes a report of them in CSV format, listing them as:
Layer,AreaTag,Area,Perimeter.
Reporting the 'Layer' helps divide the text up so putting your
Area Text onto Layers named 'Level 0', 'Level 1', Roof etc helps you
use the report more easily.
The reported units are sqm/m for metric Models or
sqft/ft otherwise.
Commas [,] in reported Area Text 'tags' are changed into
colons [;] to avoid formatting errors.
If the Model name is XXXX the report is written into
XXXX-AreaTextReport.csv.
The CSV report is made in the Model's folder.
If that report is already open [=error] you are told.
A CSV file is readable by Excel and similar programs.
It can be linked into a XLS file that has 'formatting'
so then if the CSV updates the pre-formatted XLS file
will change to suit.Version:
1.0 201001xx First Issue. -
@chucky said:
Did I do it the right way?
i think you did it ok except..
..that's not ruby language.. it's englishmore of an outline for what needs to happen if a ruby were written to accomplish the task.
-
I have see this before - related to another thread - please can you give a link to this 'script'.
Those are just the 'instructions'...........
It's described a 'proto' so it's probably pretty half-baked ! I can't even remember typing any of it !!But then I am 'senile'...........
-
Gaieus,
It's from 'Dynamic Area Calculations' started by Dennis N; http://forums.sketchucation.com/viewtopic.php?f=79&t=31021.
And as Jeff said, it's not a ruby as I thought. Have you(or anyone else) developed this further?
Advertisement