SketchUcation Premium Membership

 

 

[Plugin] VolumeCalculator v1.8

[Plugin] VolumeCalculator v1.8

Postby TIG » Wed Nov 21, 2007 7:48 pm

Here's v1.8. For some reason it's just started to Bugsplat on my new PC (Vista). It didn't before ! This new version avoids a splat since it has a two step undo. The splat seems to come from after it's intersected the volume slicing disc group to make entities inside another vol group and then it is trying to erase that disc group within the same commit/undo as the rest. By making 2 undo steps it doesn't splat - go figure ?
Please, register (free) to access all the attachments on the forums.
TIG
User avatar
TIG
Global Moderator
 
Posts: 13929
Joined: Mon Nov 12, 2007 7:24 pm
Location: Northumbria UK
Name: TIG
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: VolumeCalculator v1.8

Postby Tobobo » Wed Nov 21, 2007 7:49 pm

Thanks
Toby

Philippians 4:13

I can do everything through him who gives me strength.

http://tobyjoyce.wix.com/home
User avatar
Tobobo
 
Posts: 828
Joined: Mon Nov 12, 2007 1:27 pm
Location: Birmingham, UK
Name: Toby Joyce
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: landscape architecture
Level of SketchUp: Advanced

Re: VolumeCalculator v1.8

Postby AdamB » Wed Dec 12, 2007 10:53 am

This all seems quite a complex way of getting the volume.. The following analytic approach works nicely.

Code: Select all
def calculateVolume(container)
   
   volume = 0
   for face in container
      next unless face.kind_of? Sketchup::Face

      volume += (2 * face.area * (face.vertices[0].position.dot face.normal)) / 6      
   end
   volume
end
Developer of LightUp http://www.light-up.co.uk
User avatar
AdamB
LightUp
 
Posts: 745
Joined: Wed Dec 12, 2007 10:49 am
Location: Brighton, UK
Name: AdamB

Re: VolumeCalculator v1.8

Postby AdamB » Wed Dec 12, 2007 1:38 pm

Doh. And you need to have Geom::Point3d#dot defined - (which is beyond me why it isn't as standard)

Code: Select all
class Geom::Point3d
   def dot(v)
      self.x * v.x + self.y * v.y + self.z * v.z
   end
end   
Developer of LightUp http://www.light-up.co.uk
User avatar
AdamB
LightUp
 
Posts: 745
Joined: Wed Dec 12, 2007 10:49 am
Location: Brighton, UK
Name: AdamB

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Keyframe Animation plugin - animate your SketchUp model by adding movement to any object.

Premium Members get 20% discount!

Ad Machine
Robot
 
Posts: 2012


Return to Plugins

Who is online

Users browsing this forum: Atex, kooops, mistereight and 13 guests