Area class messing up .volume
-
We have a plugin which uses .volume on entities but for one user is returning a value of the class Area rather than a number.
Is anyone aware of a plugin which defines Area or which overrides Entity.volume?
-
Does anyone know how to determine which .rb file defined a class, or a good way to search all .rb files in Plugins folder, or in all of windows to see which ones contain 'Class Area' or 'Area' (starting with a capital letter)?
Then I could narrow things down.
-
@al hart said:
Does anyone know how to determine which .rb file defined a class, or a good way to search all .rb files in Plugins folder, or in all of windows to see which ones contain 'Class Area' or 'Area' (starting with a capital letter)?
Then I could narrow things down.
If it's in an RBS we're screwed, but assuming it's in an RB I would use BareGrep*** - to search the Plugins folder and subfolders for file type*.rb
files and a string - say "class Area
"*** http://www.baremetalsoft.com/baregrep/
Baregrep is very useful tool for finding matching text strings in all file types with a folder and nested subfolders... -
By disabling extensions one at a time, it looks like the problem is caused by DesignPH.
Almost all the rubies ae .RBS
I'll contact them and see if they can help.
-
ThomThom has an experimental script that defines
Area
andVolume
classes.It is on his GitHub site.
https://github.com/thomthom/SketchUp-Units-and-Locale-Helper -
It turns out the the other developer had defined a override to Length which returned a value of class Area when 2 lengths were multiplied.
We were multiplying the bounding box extrema to try to calculate an approximate volume if volume was not defined.
if (entity.respond_to?(:volume)) rval = entity.volume else rval = bwidth * bdepth * bheight end#if
They plan to fix it, but I think I can coerce each "length" to a float before multiplying them:
if (entity.respond_to?(:volume)) rval = entity.volume else rval = bwidth.to_f * bdepthto_f * bheightto_f end#if
Actually I will do this earlier when I get width from the bounding box
Advertisement