sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Show volume on a DC

    Scheduled Pinned Locked Moved Dynamic Components
    sketchup
    2 Posts 2 Posters 6.2k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R Offline
      ReynaldoECG
      last edited by

      Hi. I want to show the Volume of the geometry in a DC, to later calculate quantities and costs.
      I used this code:

      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?

      1 Reply Last reply Reply Quote 0
      • P Offline
        pcmoor
        last edited by

        look at

        https://sketchucation.com/forums/viewtopic.php?f=289&t=51443

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Buy SketchPlus
        Buy SUbD
        Buy WrapR
        Buy eBook
        Buy Modelur
        Buy Vertex Tools
        Buy SketchCuisine
        Buy FormFonts

        Advertisement