Additional DC functions

More DC functions

Useful when working with sheet based furniture and structures based on profiles.

  • Making Dynamic components easier to work with.
  • Swapping components with option list for swapable components
  • Pricing components globally maintained.
  • Making components behave depending on where a component is placed in another component.

BOXLOOKUP

=BOXLOOKUP(“attribute_name”,false)

Overview

BOXLOOKUP will look for an attribute name through multiple parent components, and return the value of the attribute. Can be set to return the FIRST or the LAST value found.

Parameters

  • Attribute name to lookup. Name must be in quotations – “attribute_name”
  • TRUE returns the last attribute value found, FALSE returns the first attribute value found, including the component itself. FALSE is default

Returns the value of the attribute found.

Error is raised if no attribute is found.

Sample usage

=BOXLOOKUP(“bx”)

This will return the value of the first found attribute called ‘bx’, which could be a cabinet depth.

BOXSWAPCOMPONENT

=BOXSWAPCOMPONENT(“selector_attribute_name”,false)

Overview

BOXSWAPCOMPONENT need 2 attributes to function and will preform several tasks. Learn more… Tags and Components overview

  • BOXSWAPCOMPONENT function is placed on the component that can be swapped for another component on a custom attribute, that could be named ‘select_door’.
  • Selector attribute must be a LIST choice and can be placed on the component itself or on any parent component, the FIRST attribute found will be used.
  • Option list on the selector attribute will be automatic populated every-time the component is redrawn.
  • Option list is populated with component files that has matching tags. The Tag system for components are used to find options.
  • New component are inserted and the old removed. If ‘Allow automatic purge’ is set in ‘Extension preferences’ the removed component is purged from the model.

Parameters

  • Name of the selector attribute. Name must be in quotations.
  • If the second parameter id TRUE, formula for ‘x’ ‘y’ and ‘z’ position will be copied to the new component(s). This is useful if one selector swaps multiple components.  FALSE is default.

Returns text ‘Swap done’ or ‘Options updated’ if successful.

Error is raised if selector attribute is not found.

Sample usage

=BOXSWAPCOMPONENT(“door_selector”)

This will swap the component that hold the formula, with the file selected in ‘door_selector’.

BOXSETACCESS

=BOXSETACCESS(“attribute_name”,state)

Overview

BOXSETACCESS will set the access state for a custom attribute. BOXSETACCESS will look for the attribute on the component itself or set the first found on any parent component

Parameters

  • Attribute name to set access for. Name must be in quotations – “attributename”
  • State must 0-3.  0 = no user access, 1 = user can view,  2 = user can edit textbox, 3 = user can choose from list. State is required.

Returns text ‘set to state’

Error are raised if attribute is not found. Error is raised if state is not 0,1,2 or 3

Sample usage

=IF( lenx>60, BOXSETACCESS(“option”,0), BOXSETACCESS(“option”,2) )

This formula will lookup custom attribute called ‘option’ and set access to ‘no user access’, if ‘lenx’ is greater than 60. Othervise its set to ‘user can edit textbox’

BOXPANELCOST

=BOXPANELCOST(false)

Overview

BOXPANELCOST will calculate the cost of a panel material based on the attributes of the sheet based material on the ‘Primary face’ of the component. Can also calculate secondary linear based materials, this is useful fore calculating edge material costs. Learn more… Cost calculations overview

  • Cost will be calculated based on the attributes found on ‘Material attributes’ for Sheet cost and waste factor.
  • Square area is calculated by multiplying the two longest of LenX, LenY or LenZ.
  • If any none ‘Primary face’ has a Linear material, cost will be calculated based on attributes found on ‘Material attributes’ for the Linear material, waste factor and leading/trailing material.
  • Length of Linear material will be the longest of LenX, LenY or LenZ.

Parameters

  • TRUE will include calculated cost of secondary Linear material if any found. FALSE will calculate only Sheet material. FALSE is default.

Returns the calculated cost.

Error is raised if no material attributes is found or if area is 0.

Sample usage

=BOXPANELCOST()

This will return the calculated cost of a component with sheet material on primary face.

BOXLINEARCOST

=BOXLINEARCOST()

Overview

BOXLINEARCOST will calculate the cost of a Linear material based on the attributes of the linear material on the ‘Primary face’ of the component. Linear components are typically metal, plastic or wood profiles, edgebanding, gaskets and so on. Learn more… Cost calculations overview

  • Cost will be calculated based on attributes found on ‘Material attributes’ for the Linear material, waste factor and leading/trailing material.
  • Length of Linear material will be the longest of LenX, LenY or LenZ.

Parameters

  • No parameteres is alowed, but () is still required

Returns the calculated cost.

Error is raised if no material attributes is found or if length is 0.

Sample usage

=BOXLINEARCOST()

This will return calculated cost of a component with linear material on primary face.

BOXCOMPONENTCOST

=BOXCOMPONENTCOST(“key”)

Overview

BOXCOMPONENTCOST will lookup the ‘key’ in file called componentcost.csv located in the BoxUp Extension App folder. This file can be edited with BoxUp ‘Component cost list’ found in the BoxUp menu. The file can also be edited with most spreadsheet applications. The ‘key’ can be constructed with other Dynamic Component functions to uniquely identify component, like component name, size, material and so on. If the key was NOT found, the key will be added to the file with a cost of 0. If component.csv does not exist, if will be created. Learn more… Cost calculations overview

Parameters

  • ‘key’ must be a text string

Returns the cost found using the ‘key’, 0 if no ‘key’ was found

Error None

Sample usage

=BOXCOMPONENTCOST(CONCATENATE(BOXDEFNAME(),” “,BOXLOOKUP(“modul_y”)))

This formula could find the cost of a drawer slide, where the key contains the definition name i.e. ‘Drawer slide telescopic’ and lookup a cabinet’s drawer depth i.e. ‘500’, resulting in a key ‘Drawer slide telescopic 500’.

BOXDEFNAME

=BOXDEFNAME(false)

Overview

BOXDEFNAME will return the component name as found in the Sketchup Entity Info under Definition. The name can be stripped of any trailing characters after #.

Parameters

  • TRUE will return Definition name as found. FALSE will remove any characters found after a ‘#’ including the ‘#’ itself.

Returns definition name

Error is raised if no name was found.

Sample usage

=BOXDEFNAME()

This will return definition name of the component, stripped of any numbering (i.e #2).

BOXDCNAME

=BOXDCNAME()

Overview

BOXDCNAME will return the component name as found in the Sketchup Dynamic Component Editor. Not to be mistaken for the name attribute.

Parameters

  • No parameteres is alowed, but () is still required.

Returns Dynamic component name

Error is raised if no name was found.

Sample usage

=BOXDCNAME()

This will return the name found in the name attribute of the DC component. Error is raised if name attribute is not yet given.

BOXPRIMARYMAT

=BOXPRIMARYMAT()

Overview

BOXPRIMARYMAT will return the name of the material found on the ‘Primary face’ of the component.

Parameters

  • No parameteres is alowed, but () is still required.

Returns Material name.

Error is raised if no material was found.

Sample usage

=BOXPRIMARYMAT()

This will return the name of the material found on the components primary face.

BOXSECTIONS

=BOXSECTIONS(startposition_1, length_1, startposition_N, length_N)

Overview

BOXSECTIONS will define sections within the component along z y or z axis. Use other section functions to enquire section information. Section list is defined by sets of start position and length within the component, separated by commas.  Other DC function used to calculate these sets of position and length.

Parameters

  • Sets start position and length, as many as needed, all separated by commas.

Returns a formated list for easy reading.

Error is raised if the list has an odd number of entries.

Sample usage

BOXSECTIONNEAR

=BOXSECTIONNEAR(“axis”,”sectionlist”)

Overview

BOXSECTIONNEAR returns the nearest start position i the given sectionlist along the given axis, from the point where a component is newly inserted.

Parameters

  • Axis, must be “x”, “y” or “z”
  • Attribute name of sectionlist to use

Returns the nearest start point from sectionlist along axis given

Error is raised if none valid axis character is used or if sectionlist was not found

Sample usage

=BOXSECTIONNEAR(“x”,”section_x”)

This will return the nearest start position in section list “section_x” along “x” axis.

BOXSECTIONPOS

=BOXSECTIONPOS(“axis”,”sectionlist”)

Overview

BOXSECTIONPOS returns the position a component was inserted into another component

Parameters

  • Axis, must be “x”, “y” or “z”
  • Attribute name of sectionlist to use

Returns

  • -1  if component was inserted where the section list has ONLY one section
  • 0   if component was inserted into section list the FIRST section
  • 1   if component was inserted into section list the MIDDLE section(s)
  • 2   if component was inserted into section list the LAST section

Error is raised if none valid axis character is used or if section list was not found

Sample usage

=BOXSECTIONPOS(“x”,”section_x”)

This will return the position number of where it is currently placed in section list “section_x” along “x” axis.

BOXSECTIONLEN

=BOXSECTIONLEN(“axis”,”sectionlist”)

Overview

BOXSECTIONLEN returns the length of the section where the component was inserted into another component.

Parameters

  • Axis, must be “x”, “y” or “z”
  • Attribute name of section list to use

Returns

  • Length of section

Error is raised if none valid axis character is used or if section list was not found

=BOXSECTIONLEN(“x”,”section_x”)

This will return the section length of where it is currently placed in section list “section_x” along “x” axis.

BOXSECTIONINDEX

=BOXSECTIONINDEX(“axis”,”sectionlist”)

Overview

BOXSECTIONINDEX returns the section number(index) of the section where the component was inserted into another component.

Parameters

  • Axis, must be “x”, “y” or “z”
  • Attribute name of sectionlist to use

Returns 1 for first section, 2 for second section and so on.

Error is raised if none valid axis character is used or if sectionlist was not found

=BOXSECTIONINDEX(“x”,”section_x”)

This will return the index number of where it is currently placed in section list “section_x” along “x” axis.

© Copyright Torben Mogensen 2018-2021