Replies

  • You can try the latest version, KA24,  at: Downloads
  • I will add a post here when the new version is uploaded.

     

    You can calculate "area", but you need to decide which dimensions to multiply to calculate the area, based on te original orientation of the component - before rotation. (Scaling is handled peoperly)

     

    We call the three edges %w%, %d%, and %h% (for width, depth and height. w, d, and h are set to the x, y, and z values of the bounding box of the component definition. Depending on how the component was draw you will need to select the proper ones so multiply.

     

    If you draw an angled wall in place, and then make it a component, the bounding box will not be correct. You would need to draw your wall square to a plane, and then rotate and scale it into place for this to work properly.

    You would need to have drawn all walls consistently to make this work.

     

    Here is an attribute set to calculate the area of a component, based on width and height:

     

    2506644108?profile=originalSince SketchUp likes to store all dimension in inches, I added " /144.0 " to the calculation to change it to square feet.

     

    Then I added these lines to the custom rows script:

     

    total_area = total_row["Total Area"] # replace "extended_cost" with the name of your extended_cost column
    total_area = total_area.to_f # make sure this has a value if nil
    trace("total_area : %s", total_area)

    #calculate tiles from total area
    tiles = total_area/4
    tiles = tiles.ceil # round up to next full tile
    trace("tiles: %s", tiles) # display on ruby console

     

    Note the "total_area/4" and the ".ceil" functions were to round the number of tiles up to the next full 4 SQFT tile. If you wanted to round up to the noxt whole tile per wall, you would add a similar, clever function to caluclate the number of tiles base on the width and height of the wall.

     

    e.g.

     

    tiles = (%w%/24).ceil * (%h%/24).ceil

     

    This would round the width up to the next 24 inches, and round the height up to the next 24" before calculating the number of tiles per wall.

     

    Here is the report I get:

    (I added three columns called W, D, and H just for testing. If you are getting the wrong areas for walls, these may help you determine why they are not calculating properly.

     

    2506644504?profile=original

     

  • Al,

     

    How will I be able to download the update? Also, can the report calculate areas of a component ie a flat wall of a given material and report on these which in turn can be given a value and shown as a total?

  • Take a look at the documentation for this: Custom Report Rows

     

    The ruby code is saved in the SketchUp model, and accessed with three buttons on the Report Setup Wizard. You save the ruby code to a text file, edit it and reload it.

     

    2506670055?profile=original

     

    I will be uploading a new version with this feature enabled later today.

     

    Al

     


    Scott Francis Allan said:

    Al,

     

    The example looks great, which ruby files requires altering with the code above?

  • Al,

     

    The example looks great, which ruby files requires altering with the code above?

  • This new feature "Custom Report Rows" will probably do what you need.

     

    Here is a sample report with VAT added:

    (Ignore the $ signs - the currency signs, and decimal point symbol are determined by your Windows settings)

     

    2506644355?profile=original

     

    The Total row was added by the report. The VAT and Total Cost rows were added by the ruby script, based on the calculated total cost.

    This will required that you make changes to a default ruby script, which is then saved in your model, so you can repeat the same results:

    (This looks confusing, but it won't be that hard to make a few changes)

     

    # ruby file to generate custom report data
        # copyright 2011 Render Plus Systems   
        # For use with SpaceDesign
        # for documentation see:
       
        # replace "extended_cost" with the name of your total cost column.
        # calculate new values and add to new rows.
       
        def add_custom_rows
            trace("ADD CUSTOM ROWS") # traces are displayed on the ruby console.
           
            #get total_cost
            total_cost = total_row["extended_cost"]  # replace "extended_cost" with the name of your extended_cost column
            total_cost = total_cost.to_f # make sure this has a value if nil
            trace("TOTAL COST: %s", total_cost)
           
            # calucalte VAT from total cost
            vat = total_cost * 0.175
           
            # add a divider line in extended_cost column
            # custom_row is a hash array. You can add values to if for any attributes included in the report
            # start a new custom row
            # ---------- will appear in the name or description column
            custom_row = start_custom_row("----------") # start a new custom row
            custom_row["extended_cost"] = "----------" # add a divider line in extended_cost column
            # add the custom row to report
            add_custom_row
           
            # display VAT calculation
            custom_row = start_custom_row("VAT") # start a new custom row
            svalue = sprintf("%.2f", vat) # format to two decimal places
            svalue2 = dll_call_format_currency(svalue) # add currency formating
            trace("VAT: %s", svalue2) # display on ruby console
            custom_row["extended_cost"] = svalue2 # this adds the currency value to the entended_cost column
            add_custom_row # add the custom row to report
           
            # add a divider line in extended_cost column
            custom_row = start_custom_row("===========") # start a new custom row
            custom_row["extended_cost"] = "===========" # add a divider line in extended_cost column
            add_custom_row # add the custom row to report
           
            # display new total cost
            custom_row = start_custom_row("Total Cost") # start a new custom row
            svalue = sprintf("%.2f", vat + total_cost) # format to two decimal places
            svalue2 = dll_call_format_currency(svalue) # add currency formating
            custom_row["extended_cost"] = svalue2
            add_custom_row # add the custom row to report
        end#def

     

  • You can send a .SKP file to al.hart@renderplus.com

     

    I presume that all of these items are calculated from totals of the components.

     

    Are the tiles calculated from total area - even though it is not quite correct. (Rather than doing a total for each wall and rounding up the dimensions)

     

    Have you done any ruby programming at all?

     

    The easiest way for us to do this might to call a ruby script. We could make the totals of each column available to it, and it could add the, (non hidden),  line items to the report.

     

    The ruby script would look like this

     

    def add_ons(totals)

     

    advertising = 1800.00

    plumbing = 1400.00

    electrics = 800.00

    joiner = 1200.00

    tiles = total['Area'] / 144.0

    tiles = tiles.ceil #rounds up to next integer

    tiler = tiles * 1.45

    products = total['extended cost']

     

    profit = products * (1.0/0.75)

     

    new_total = products + advertising + plumbing + electrics + joiner + tiler + profit

     

    commission = new_total * 1.111

     

    total_cost = new_total + commission

     

    vat = total_cost * 0.175

     

    contact_price = total_cost + vat

     

    # add rows to report

    sd_add_row("Total Cost", total_cost)

    sd_add_row("VAT", vat)

    sd_add_row("Contract Price", contrace_price

     

    end#def

    You would have to create a ruby file like this for each project.

  • Al,

     

    This is the list I am currently working with;

     

    Advertising = £(hidden value)

    Plumbing = £(hidden value)

    Electrics =£(hidden value)

    Joiner = £(hidden value)

    Tiles = £(based on area of wall calculation if possible)

    Tiler = £(based on titles x value)

    Products = £(component total)

    Profit as a % of total = £(hidden value)

    Commission at 11.1% = (hidden value)

    Total Cost = (value)

    VAT =(value)

    Contract Price =(value)

     

    Do you have an email address as i have a sample .skp file I can forward as it wont upload for some reason.

  • See if you can set up an excel spread sheet to show me a sample of what you are looking for.

     

    It will be best if you can create what you want without sub totals. (As this adds a lot of complexity to SpaceDesign Reporting. But I will consider it. (For example if you can calculate VAT row by row, rather than at the end)

     

    We can do a lot with rows created by invisible components.

  • Selected totals could be shown, extras works to be undertaken for example.

     

    The idea is not to export to another file as this will allow for possible user error. The ideal is to have set costs already as part of the total with components making up the remainer of the cost plan then 2 % values added to these and finally a total.

     

    I hope I am explaining myself. If needed I can send a sample cost breakdown to assist. 

This reply was deleted.