Overview
The Medeek Truss API allows developers and advanced users to programmatically create and manipulate Medeek roof truss assemblies inside SketchUp using Ruby.
Currently the documented attribute library access methods on this page are only available for the Common and Scissor Truss families. The development plan is to add API access for all truss, rafter and complex roofs.
All public API methods are accessed through the following modules and classes:
Medeek_Engineering_Inc_Extensions:: MedeekTrussPlugin:: MedeekMethods
common_truss_draw
Creates a new common truss assembly from a selected horizontal face, a SketchUp face object, or an array of four corner points that define a rectangular footprint.
Syntax
common_truss_draw(pitch = 4.0, trusstype = 'Fink', pts = nil)
Parameters
- pitch - Roof pitch expressed as rise in inches per 12 inches of run. Must be numeric and between 0.25 and 24.0.
- trusstype - The common truss web configuration/type. Valid truss types are given below (case sensitive).
- pts - Optional input geometry. May be omitted to use the current selected face, a Sketchup::Face object, an array of Geom::Point3d objects, or an array of [x,y,z] point arrays.
Valid Truss Types
- King Post
- Queen Post
- Fink
- Howe
- Fan
- Mod Queen
- Double Fink
- Double Howe
- Mod Fan
- Triple Fink
- Triple Howe
- Quad Fink
- Quad Howe
- Penta Howe
Examples:
mod = Medeek_Engineering_Inc_Extensions::
MedeekTrussPlugin::
MedeekMethods
mod.common_truss_draw
mod = Medeek_Engineering_Inc_Extensions::
MedeekTrussPlugin::
MedeekMethods
mod.common_truss_draw(6.0, 'Howe')
mod = Medeek_Engineering_Inc_Extensions::
MedeekTrussPlugin::
MedeekMethods
face = Sketchup.active_model.selection.grep(Sketchup::Face)[0]
mod.common_truss_draw(4.0, 'Fink', face)
mod = Medeek_Engineering_Inc_Extensions::
MedeekTrussPlugin::
MedeekMethods
pts = [[48,48,0], [240,48,0], [240,288,0], [48,288,0]]
mod.common_truss_draw(4.0, 'Fink', pts)
Notes
- The input face or point set must define a horizontal rectangle in sequential order.
- If an array of points is supplied, exactly four points are required.
- All supplied points will be normalized to a common elevation before the truss is created.
scissor_truss_draw
Creates a new scissor truss assembly from a selected horizontal face, a SketchUp face object, or an array of four corner points that define a rectangular footprint.
Syntax
scissor_truss_draw(pitch = 6.0, pitch2 = 3.0, trusstype = 'Scissor 4/4', pts = nil)
Parameters
- pitch - Top chord roof pitch expressed as rise in inches per 12 inches of run. Must be numeric and between 0.25 and 24.0.
- pitch2 - Bottom chord roof pitch expressed as rise in inches per 12 inches of run. Must be numeric and between 0.25 and 24.0.
- trusstype - The scissor truss web configuration/type. Valid truss types are given below (case sensitive).
- pts - Optional input geometry. May be omitted to use the current selected face, a Sketchup::Face object, an array of Geom::Point3d objects, or an array of [x,y,z] point arrays.
Valid Truss Types
- Scissor 2/2
- Scissor 4/2
- Scissor 4/4
- Scissor 6/4
- Scissor 6/6
Examples:
mod = Medeek_Engineering_Inc_Extensions::
MedeekTrussPlugin::
MedeekMethods
mod.scissor_truss_draw
mod = Medeek_Engineering_Inc_Extensions::
MedeekTrussPlugin::
MedeekMethods
mod.scissor_truss_draw(6.0, 3.0, 'Scissor 2/2')
mod = Medeek_Engineering_Inc_Extensions::
MedeekTrussPlugin::
MedeekMethods
face = Sketchup.active_model.selection.grep(Sketchup::Face)[0]
mod.scissor_truss_draw(6.0, 3.0, 'Scissor 4/4', face)
mod = Medeek_Engineering_Inc_Extensions::
MedeekTrussPlugin::
MedeekMethods
pts = [[48,48,0], [240,48,0], [240,288,0], [48,288,0]]
mod.scissor_truss_draw(6.0, 3.0, 'Scissor 4/4', pts)
Notes
- The input face or point set must define a horizontal rectangle in sequential order.
- If an array of points is supplied, exactly four points are required.
- All supplied points will be normalized to a common elevation before the truss is created.
attic_truss_draw
Creates a new attic truss assembly from a selected horizontal face, a SketchUp face object, or an array of four corner points that define a rectangular footprint.
Syntax
attic_truss_draw(pitch = 12.0, atticheight = 97.75, maxheight = 132.0, pts = nil)
Parameters
- pitch - Top chord roof pitch expressed as rise in inches per 12 inches of run. Must be numeric and between 4.0 and 24.0.
- atticheight - Height of the framed attic within the truss (this height includes the floor sheathing thickness). Must be numeric.
- maxheight - Maxiumm height of the attic truss, if the span dictates a larger truss size a piggyback truss will be utilized. Must be numeric.
- pts - Optional input geometry. May be omitted to use the current selected face, a Sketchup::Face object, an array of Geom::Point3d objects, or an array of [x,y,z] point arrays.
Examples:
mod = Medeek_Engineering_Inc_Extensions::
MedeekTrussPlugin::
MedeekMethods
mod.attic_truss_draw
mod = Medeek_Engineering_Inc_Extensions::
MedeekTrussPlugin::
MedeekMethods
mod.attic_truss_draw(12.0, 97.75, 132.0)
mod = Medeek_Engineering_Inc_Extensions::
MedeekTrussPlugin::
MedeekMethods
face = Sketchup.active_model.selection.grep(Sketchup::Face)[0]
mod.attic_truss_draw(12.0, 97.75, 132.0, face)
mod = Medeek_Engineering_Inc_Extensions::
MedeekTrussPlugin::
MedeekMethods
pts = [[48,48,0], [336,48,0], [336,432,0], [48,432,0]]
mod.attic_truss_draw(12.0, 97.75, 132.0, pts)
Notes
- The input face or point set must define a horizontal rectangle in sequential order.
- If an array of points is supplied, exactly four points are required.
- All supplied points will be normalized to a common elevation before the truss is created.
cathedral_truss_draw
Creates a new cathedral truss assembly from a selected horizontal face, a SketchUp face object, or an array of four corner points that define a rectangular footprint.
Syntax
cathedral_truss_draw(pitch = 6.0, pitch2 = 3.0, cspan = 192.0, trusstype = 'Cathedral 6/X', pts = nil)
Parameters
- pitch - Top chord roof pitch expressed as rise in inches per 12 inches of run. Must be numeric and between 0.25 and 24.0.
- pitch2 - Cathedral roof pitch expressed as rise in inches per 12 inches of run. Must be numeric and between 0.25 and 24.0.
- cspan - Span of the cathedral at the bottom of the truss. Must be numeric and greater than or equal to 12.0 inches.
- trusstype - The cathedral truss web configuration/type. Valid truss types are given below (case sensitive).
- pts - Optional input geometry. May be omitted to use the current selected face, a Sketchup::Face object, an array of Geom::Point3d objects, or an array of [x,y,z] point arrays.
Valid Truss Types
- Cathedral 4/X
- Cathedral 6/X
Examples:
mod = Medeek_Engineering_Inc_Extensions::
MedeekTrussPlugin::
MedeekMethods
mod.cathedral_truss_draw
mod = Medeek_Engineering_Inc_Extensions::
MedeekTrussPlugin::
MedeekMethods
mod.cathedral_truss_draw(6.0, 3.0, 192.0, 'Cathedral 6/X')
mod = Medeek_Engineering_Inc_Extensions::
MedeekTrussPlugin::
MedeekMethods
face = Sketchup.active_model.selection.grep(Sketchup::Face)[0]
mod.cathedral_truss_draw(6.0, 3.0, 192.0, 'Cathedral 6/X', face)
mod = Medeek_Engineering_Inc_Extensions::
MedeekTrussPlugin::
MedeekMethods
pts = [[48,48,0], [336,48,0], [336,432,0], [48,432,0]]
mod.cathedral_truss_draw(6.0, 3.0, 192.0, 'Cathedral 6/X', pts)
Notes
- The input face or point set must define a horizontal rectangle in sequential order.
- If an array of points is supplied, exactly four points are required.
- All supplied points will be normalized to a common elevation before the truss is created.
validate_medeektruss
Validates that the provided group represents a Medeek Truss assembly.
Syntax
validate_medeektruss(group)
Parameters
- group - Truss group name or SketchUp group object
Returns
- true, group - valid Medeek truss group
- false, group - invalid object
Example
Medeek_Engineering_Inc_Extensions::MedeekTrussPlugin::MedeekMethods.validate_medeektruss('TRUSS_ASSEMBLY_20260323172442')
truss_regen
Regenerates an existing truss assembly.
Syntax
truss_regen(group = nil)
Parameters
- group - Truss group name or SketchUp group object (optional)
Example
Medeek_Engineering_Inc_Extensions::MedeekTrussPlugin::MedeekMethods.truss_regen
Medeek_Engineering_Inc_Extensions::MedeekTrussPlugin::MedeekMethods.truss_regen('TRUSS_ASSEMBLY_20260323172442')
Notes
- If no group name is supplied the current selection set in the model will be analyzed.
- Regeneration is enabled for all truss families.
truss_read_attributes
Reads the stored attributes from an existing Medeek Truss assembly. Since the attributes are stored in nested libraries the data is given as a hash of hashes.
Syntax
truss_read_attributes(group = nil)
Parameters
- group - Truss group name or SketchUp group object (optional)
Returns
- A hash of truss attributes when the assembly is valid
falseornilif the supplied object is not a valid Medeek Truss assembly
Example
Medeek_Engineering_Inc_Extensions::MedeekTrussPlugin::MedeekMethods.truss_read_attributes('TRUSS_ASSEMBLY_20260323172442')
Notes
- Use this method when you need to inspect all available truss settings/parameters.
- Please read the attribute library index to understand what each parameter/attribute does with regards to the truss assembly.
- This method is only intended for reading truss configuration data; it does not alter the model or the truss assembly.
- If no truss group name is supplied the selection set in the model will be analyzed to determine if a truss assembly has been selected.
truss_get_attribute
Reads a single stored attribute from an existing Medeek Truss assembly.
Syntax
truss_get_attribute(param, group = nil)
Parameters
- param - The name of the attribute/parameter to read
- group - Truss group name or SketchUp group object (optional)
Returns
- The current value of the requested attribute/parameter
falseornilif the supplied object is not a valid Medeek Truss assemblynilif the requested attribute does not exist or has no stored value
Examples
Medeek_Engineering_Inc_Extensions::MedeekTrussPlugin::MedeekMethods.truss_get_attribute('PITCH')
Medeek_Engineering_Inc_Extensions::MedeekTrussPlugin::MedeekMethods.truss_get_attribute('PITCH', 'TRUSS_ASSEMBLY_20260323172442')
Notes
- This method is useful when querying one specific parameter without reading the entire truss attribute library.
- This method is only intended for reading truss configuration data; it does not alter the model or the truss assembly.
- If no truss group name is supplied the selection set in the model will be analyzed to determine if a truss assembly has been selected.
- Please read the attribute library index to understand what each parameter/attribute does with regards to the truss assembly.
truss_set_attribute
Sets a single stored attribute within an existing Medeek Truss assembly.
Syntax
truss_set_attribute(param, value, group = nil, regen = false)
Parameters
- param - The name of the attribute/parameter to set
- value - The new value to assign to the specified attribute/parameter
- group - Truss group name or SketchUp group object (optional)
- regen flag - Set to true or false in order to regen the assembly after the new value is set, default is false (optional)
Returns
trueif the attribute was successfully updatedfalseornilif the supplied object is not a valid Medeek Truss assemblyfalseif the requested attribute cannot be updated
Examples
Medeek_Engineering_Inc_Extensions::MedeekTrussPlugin::MedeekMethods.truss_set_attribute('PITCH', 6.0)
Medeek_Engineering_Inc_Extensions::MedeekTrussPlugin::MedeekMethods.truss_set_attribute('PITCH', 6.0, true)
Medeek_Engineering_Inc_Extensions::MedeekTrussPlugin::MedeekMethods.truss_set_attribute('PITCH', 6.0, 'TRUSS_ASSEMBLY_20260323172442')
Medeek_Engineering_Inc_Extensions::MedeekTrussPlugin::MedeekMethods.truss_set_attribute('PITCH', 6.0, 'TRUSS_ASSEMBLY_20260323172442', true)
Notes
- Use this method when you need to modify a single truss setting/parameter.
- Please read the attribute library index to understand what each parameter/attribute does with regards to the truss assembly.
- This method only updates the specified truss attribute/parameter; it does not automatically redraw or regenerate the truss assembly unless the regen flag is set to true.
- If no truss group name is supplied the selection set in the model will be analyzed to determine if a truss assembly has been selected.