The Shape module
Quick Notes |
The ShapeInfo parametric that is mentioned (below) in PR 28793 can be found in the plugins/Distributed/BV folder ( ) in the data directory that is used by your current version of the SDS2 program that you are currently using. It provides an excellent example of how Shape attributes can be used in a parametric.
|
On this page :
- Introduction
sh1 =
(declaring the object)- Shape attributes for C, cold formed C, L, Pipe, WT, ST, HSS/TS, W, S shape & joist:
- Shape attributes for angle material
- Shape attributes for HSS/TS material
- Shape attributes for joist material
- Shape attributes for welded plate wide flange
- Methods
Also see :
PR 15346 In parametrics,
shape.Shape()
now results in ashape.error
with an empty string, just like it does with other invalid section sizes. (v7.3)PR 32395 Additional information about section properties that depend on production standards are now available via Python in the Job and Shape modules. (v2015)
PR 43832 Cold form section bends have been exposed via the shape parametric module. (v2018)
The shape module (introduction):
To enter a shape variable, first define a shape object (see
sh 1 =
), then define a shape attribute .Shape attributes can be read from member objects (see
mem1 =
) or from any section size. You can use these attributes to locate the work points of parametrically added materials.
mem1
replacesmem1.Shape()
. Users need only type in the member object and the shape attribute (example:mem1.Depth
).
mem1.Shape()
works the same asmem1
.
Shape("W10x33")
is a method for assigning a particular specific section size in the local shape file to be the shape object. In this example, "W10x33" is the specific section size, a string .>>> from shape import Shape >>> Shape("W14x90") # a shape object is returned <shape object at 0x12134b0> >>> from param import Units, dim >>> Units("feet") >>> Shape("W14x90").depth # section depth is returned 14.02 >>> Shape(W14x90) # no quotes returns NameError NameError: name 'W14x90' is not defined >>> Shape( ) # no argument returns an error error: Shape initializer must be section size or index >>> Shape(' ') # empty string returns an error error: Section size not found in material database.
Shape(idx)
is another method for assigning a specific section size to be the shape object.idx
is an index number in the local shape file .Warning: The section size associated with a particular index number in your local shape file may not match the section size for that same index in a different shape file. Be careful!
Shape attributes for C, cold formed C, L, Pipe, WT, ST, HSS/TS, W, S shape & joist :
sh1 .SectionSize
or sh1.section_size
returns a specific " Section Size " (a string ) found in the local shape file for channel, cold formed channel, angle, pipe, W tee, S tee, HSS/TS, S shape, wide flange or joist material.
# Prints W10x33.
from shape import Shape
var = Shape("W10x33").SectionSize
print("The section size is", var)
# Prints the section size of the member the user selects.
from member import MemberLocate
from param import ClearSelection
mem1 = MemberLocate("Select a non-misc member")
if mem1.Type != "Misc":
print("The section size is: ", mem1.SectionSize)
else:
print("Please select a non-miscellaneus member.")
ClearSelection()
sh1 .NominalDepth
or sh1.nom_depth
returns the " Nominal depth " reported in the local shape file for C, cold formed channel, pipe, W tee, S tee, S shape, wide flange or joist material. Note that the Units("...")
that are specified affect the floating point number that is returned. The first example returns 304.8
since Units("metric")
is specified. If Units("feet")
had been specified, the returned result would have been 12.0
.
# Prints the nominal depth of WT12x81.
from param import Units
Units("metric") # sets output to millimeters
from shape import Shape
var = Shape("WT12x81").NominalDepth
print("The nominal depth is", var)
# Prints the nominal depth of the section the user selects.
from param import Units
from dialog import Dialog
from dialog.choose_file import ChooseMtrl
from shape import Shape
Units("inch-decimal") # sets output to decimal inches
dlg1 = Dialog("Select a Section Size") # dialog opens
Mtrl_browse1 = ChooseMtrl(dlg1, "sect", ("W Tee",),
label ="Select a section:", default="WT12x81")
# dialog closes after user presses "OK" or "Cancel"
if dlg1.Run(): # user presses "OK"
sz = Shape(dlg1.sect)
print("Nominal depth:", sz.NominalDepth)
else: # user presses "Cancel"
pass
# Prints the nominal depth of the member the user selects.
from member import MemberLocate
from param import Units, ClearSelection
Units("feet") # sets output to decimal inches
mem1 = MemberLocate("Select a member")
print("The member's nominal depth is", mem1.NominalDepth)
ClearSelection()
Note: " Nominal depth " is not reported for HSS/TS or L material.
sh1 .Depth
or sh1.depth
returns the " Depth " reported in the local shape file for channel , cold formed channel , HSS round , HSS rectangular , W tee , S tee , S shape or wide flange material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
. For angle , sh1.Depth
(but not sh1.depth
) is the " Long leg " length. For HSS rectangular (tube) , sh1.Depth
(but not sh1.depth
) is the " Long side depth ."
# Prints the long-leg length of L8x6x3/4.
from shape import Shape
from param import Units
Units("inch-decimal") # sets output to decimal inches
print("The long-leg length is", Shape("L8x6x3/4").Depth)
# Prints the depth of a selected W, C or WT member.
from member import MemberLocate
from param import ClearSelection, dim_print, Units
Units("feet") # sets dim_print output to ft-in frac
allowed = ["W flange", "W Tee", "Channel"]
mem1 = MemberLocate("Select a non-miscellaneous member")
if mem1.MaterialType in allowed:
var = mem1.Depth
print("The depth of the member is", dim_print(var))
else:
print("You selected a", mem1.MaterialType)
print("This parametric works only on these materials:")
print(allowed)
ClearSelection()
Note: For the short leg of an angle or the short side of a HSS/TS, use .short_depth
or .FlangeWidth
. For a joist, use .BearingDepth
.
sh1 .WeightPerFoot
or sh1.weight
returns the " Weight per foot/meter " reported i the local shape file for channel , cold formed channel , HSS round , W tee , S tee , S shape , HSS rectangular or wide flange or joist material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .kDistanceDetail
or sh1.k
returns the " k distance(detail) " reported in the local shape file for channel, W tee, S tee, S shape or wide flange material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .kDistanceDesign
or sh1.design_k
returns the " k distance (design) " reported in the local shape file for channel, W tee, S tee, S shape or wide flange material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .MomentOfInertiaXAxis
or sh1.Ix
returns the " Moment of inertia " reported in the local shape file for C, cold formed channel, L, pipe, W tee, S tee, HSS/TS, S shape or wide flange material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
Note: There is no " Moment of inertia " for joist material.
sh1 .FlangeThickness
or sh1.tf
returns the " Flange thickness " reported in the local shape file for channel , W tee , S tee , S shape or wide flange material. For angle material, sh1.FlangeThickness
(but not sh1.tf
) is the " Material thickness ." The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
. For HSS round or HSS rectangular material, sh1.FlangeThickness
(but not sh1.tf
) is the " Wall thickness ." For joist , sh1.FlangeThickness
(but not sh1.tf
) is the " Bottom chord width ."
sh1 .WebThickness
or sh1.tw
returns the " Web thickness " reported in the local shape file for channel , cold formed channel , W tee , S tee , S shape or wide flange material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
. For joist , sh1.WebThickness
(but not sh1.tw
) is the " Bearing width ."
sh1 .FlangeWidth
or sh1.bf
returns the " Flange width " reported in the local shape file for channel , cold formed channel , W tee , S tee , S shape or wide flange material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
. For HSS/TS , this the " Short side depth ." For angle , sh1.FlangeWidth
(but not sh1.bf
) is the " Short leg " length reported in the local shape file for L (angle) material. For joist , sh1.FlangeWidth
(but not sh1.bf
) is the " Top chord width ."
# Prints 7 15/16 -- the flange width of W10x33.
from shape import Shape
from param import Units, dim_print
Units("feet") # sets dim_print output to ft-in frac
print("The flange width is", dim_print(Shape("W10x33").bf))
# Prints the flange width of the section the user enters.
from shape import Shape
from param import Prompt, ResponseNotOK, Units
Units("feet") # sets output to decimal inches
try:
var = Prompt("W10x33", "Wide flange section size:")
flange_width = Shape(var).bf
print("The flange width is", flange_width)
except ResponseNotOK:
print("You pressed the Cancel button.")
sh1 .FlangeGage
or sh1.gage
returns the " Flange gage " reported in the local shape file for channel , cold formed channel , W tee , S tee , S shape or wide flange material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
Shape attributes for angle material :
Note: The weight per unit of length and other attributes of angle material can be read using shape attributes for C, L, Pipe, WT, ST, HSS/TS, W, S & joist .
sh1 .Depth
or sh1.LL_depth
returns the " Long leg " length reported in the local shape file for L (angle) material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
# Prints 8.0 -- the long-leg length of L8x6x3/4.
from shape import Shape
from param import Units
Units("inch") # sets output to decimal inches
print("The long-leg length is", Shape("L8x6x3/4").LL_depth)
# Prints the long-leg length of the section the user selects.
from param import Units
from dialog import Dialog
from dialog.choose_file import ChooseMtrl
from shape import Shape
Units("feet") # sets output to decimal inches
dlg1 = Dialog("Select a Section Size")
Mtrl_browse1 = ChooseMtrl(dlg1, "sect", ("Angle",), label = "Select a section:",
default = "L8x6x3/4")
# dialog closes after user presses "OK" or "Cancel"
if dlg1.Run(): # user presses "OK"
sz = Shape(dlg1.sect)
print("Long-leg length of angle:", sz.LL_depth)
else: # user presses "Cancel"
pass
sh1 .FlangeWidth
or sh1.SL_depth
returns the " Short leg " length reported in the local shape file for L material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
# Prints 3 1/2 -- the short-leg length of L5x3 1/2x7/16.
from shape import Shape
from param import Units, dim_print
Units("feet") # sets dim_print output to ft-in frac
var = Shape("L5x3 1/2x7/16").SL_depth
print("Short-leg length: ", dim_print(var))
sh1 .ShortLegGage1
or sh1.SL_gage
returns the " Single column short leg gage " reported in the local shape file for L material with a single column of bolts on the short leg. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .ShortLegGage2
or sh1.SL_dbl_gage1
returns the " Double column short leg first gage " reported in the local shape file for L material with a double column of bolts on the short leg. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .ShortLegGage3
or sh1.SL_dbl_gage2
returns the " Double column short leg second gage " reported in the local shape file for L material with a double column of bolts on the short leg. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .LongLegGage1
or sh1.LL_gage
returns the " Single column long leg gage " reported in the local shape file for L material with a single column of bolts on the long leg. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .LongLegGage2
or sh1.LL_dbl_gage1
returns the " Double column long leg first gage " reported in the local shape file for L material with a double column of bolts on the long leg. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .LongLegGage3
or sh1.LL_dbl_gage2
returns the " Double column long leg second gage " reported in the local shape file for L material with a double column of bolts on the long leg. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .FlangeWidth
or sh1.thick
returns the " Material thickness " reported in the local shape file for L material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
Shape attributes for HSS round or HSS rectangular material :
Note: The weight per unit of length, depth and other attributes of pipe or HSS/TS material can be read using shape attributes for C, L, HSS round, WT, ST, HSS rectangular, W, S & joist .
sh1 .Depth
or sh1.long_depth
returns the " Long side depth " reported in the local shape file for HSS/TS material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .FlangeWidth
or sh1.short_depth
returns the " Short side depth " reported in the local shape file for HSS/TS material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .FlangeThickness
or sh1.thick
returns the " Wall thickness " reported in the local shape file for pipe or HSS/TS material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
Shape attributes for joist material :
Note: The depth, nominal depth and other attributes of joist material can be read using shape attributes for C, L, Pipe, WT, ST, HSS/TS, W, S & joist .
sh1 .FlangeThickness
or sh1.BC_width
returns the " Bottom chord width " reported in the local shape file. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
# Prints bottom chord width of the joist the user selects.
from member import MemberLocate
from param import Units, ClearSelection
Units("feet") # sets output to decimal inches
mem1 = MemberLocate("Select a joist")
print("Bottom chord width = ", mem1.BC_width)
ClearSelection()
sh1 .BearingDepth
or sh1.brg_depth
returns the " Bearing depth " reported in the local shape file. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
# Prints the bearing depth of the joist you select.
from member import MemberLocate
from param import Units, ClearSelection
Units("feet") # sets output to decimal inches
mem1 = MemberLocate("Select a joist")
if mem1.Type == "Joist":
print("Joist bearing depth is:", mem1.BearingDepth)
else:
print("You selected a ", mem1.Type, "-- instead select a joist.")
ClearSelection()
sh1 .WebThickness
or sh1.brg_width
returns the " Bearing width " reported in the local shape file. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .kDistanceDetail
or sh1.brg_thick
returns the " Bearing thickness " reported in the local shape file. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .FlangeGage
or sh1.gage
returns the " Gage " reported in the local shape file. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .LongLegGage1
or sh1.max_brg
returns the " Maximum bearing " reported in the local shape file. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .MinimumBearing
or sh1.min_brg
returns the " Minimum bearing " reported in the local shape file for the joist. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .JoistTypeDescription
or sh1.series
returns the " Material type " reported in the local shape file. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .FlangeWidth
or sh1.TC_width
returns the " Top chord width " reported in the local shape file for the joist. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
Shape attributes for welded plate wide flange :
Note: The depth and web thicknesses and other attributes of welded plate wide flange material can be read using shape attributes for C, cold formed C, L, Pipe, WT, ST, HSS/TS, W, S shape & joist .
sh1 .TopFlangeThickness
or sh1.LongLegGage2
returns the " Top flange thickness " reported in the local shape file for the welded plate wide flange material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .TopFlangeWidth
or sh1.LongLegGage1
returns the " Top flange width " reported in the local shape file for the welded plate wide flange material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .TopFlangeGage
or sh1.FlangeGage
returns the " Top flange gage " reported in the local shape file for the welded plate wide flange material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .TopFlangeWeldSize
or sh1.ShortLegGage2
returns the " Top flange weld size " reported in the local shape file for the welded plate wide flange material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .BtmFlangeThickness
or sh1.ShortLegGage1
returns the " Bottom flange thickness " reported in the local shape file for the welded plate wide flange material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .BtmFlangeWidth
or sh1.LongLegGage3
returns the " Bottom flange width " reported in the local shape file for the welded plate wide flange material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .BtmFlangeGage
or sh1.MinimumBearing
returns the " Bottom flange gage " reported in the local shape file for the welded plate wide flange material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1 .BtmFlangeWeldSize
or sh1.ShortLegGage3
returns the " Bottom flange weld size " reported in the local shape file for the welded plate wide flange material. The returned value is a floating point number in mm or inches, depending on the startup code Units(' ... ')
.
sh1
.Type()
returns one of the following strings : "W flange" or "Channel" or "Angle" or "W Tee" or "Pipe" or "Tube" or "Welded Plate Wide Flange" or "Welded Plate Box" or "Joist" or "Cold Formed C" or "Cold Formed Z" or "S Shape" or "S Tee" or "Clevis" or "Turnbuckle" -- whichever type corresponds to the tab the material is reported under in the local shape file.
# Prints Angle as the material type.
from shape import Shape
print(Shape("L8x6x3/4").Type())
# Prints the material type of the section the user selects.
from dialog import Dialog
from dialog.choose_file import ChooseMtrl
from shape import Shape
# dialog opens
dlg1 = Dialog("Select a Section Size")
Mtrl_browse1 = ChooseMtrl(dlg1, "sect", ("W Flange", "Channel", "Angle"),
label = "Select a section:", default="W8x24")
# dialog closes after user presses "OK" or "Cancel"
if dlg1.Run(): # user presses "OK"
sz = Shape(dlg1.sect)
print("Material type:", sz.Type())
else: # user presses "Cancel"
print("You pressed the Cancel button.")