I used this code:
- Code: Select all
Sketchup.active_model.selection.grep(Sketchup::ComponentInstance).each do |s|
if s.volume>-1
s.set_attribute "dynamic_attributes","vol_inch", s.volume
s.set_attribute "dynamic_attributes","volumen_mm", "0"
s.set_attribute "dynamic_attributes", "_volumen_mm_access","VIEW"
s.set_attribute "dynamic_attributes","_volumen_mm_formlabel","Volume (cubic ft) "
s.set_attribute "dynamic_attributes","_volumen_mm_formula", "ROUND(vol_inch*16387.064,3)"
end
$dc_observers.get_latest_class.redraw_with_undo(s)
end
Works. But when I modify the geometry the volume does not change.
Is there a way to get the volume in a DC constantly and dynamically as the geometry changes?