Most elements in this site involve removing the “resize-ability” of objects. But occasionaly, adding flexibility to elements means adding the ability to resize elements, or portions of elements. For this you will need to know, at a minimum, scripts for basic 3d shapes. You will also need to know some basic transformations and how to stack them.
In this example, we will look at a table with basic legs that become stretchable. We will save the tabletop as an object to copy in, then script the legs from scratch.
Step 1: Save a slab as the tabletop, with its center/top at 0,0,0
Fig 1.0 Table Top from Plan View
Step 2: Remove the ADD/MUL/GLOB list from the top of the 3D list
Fig 2.0 Script to be Removed from Table Top
Step 3: Set the table height to be dynamic based on the table legs (to be scripted)
Use the following transformation:
ADDz B+2” !(table thickness from saved element)
!Table Script Here
DEL TOP !This adjusts the table top script to sit at height B from the parameter list. We will use dimension B in the script of the table legs. The DEL command tells the script to finish the transformation to the top of the script, preventing it from modifying any script that follows (the legs, or other elements to be added)
Fig 3.0 Table Leg Scripts and Table Top Transformation
Step 4: Place round legs with a stack of transformations to locate each leg.
Table Leg 1:
ADDx 2’ !(Offset leg 2’ to the right of center)
ADDy 2’ !(Offset leg 2’ above center)
Material MaterialAttribute_1 !(includes a surface setting from the parameters)
CYLIND B, 1” !(B is from the parameter for table leg height, 1” defines the cylinder radius)
DEL TOP !Again, removing all transformations before moving to the next leg
Table Leg 2:
ADDx -2’ !(Offset leg -2’ to the left of center)
ADDy 2’ !(Offset leg 2’ above center)
Material MaterialAttribute_1 !(includes a surface setting from the parameters)
CYLIND B, 1” !(B is from the parameter for table leg height, 1” defines the cylinder radius)
DEL TOP !Again, removing all transformations before moving to the next leg
Table Leg3:
ADDx 2’ !(Offset leg 2’ to the right of center)
ADDy -2’ !(Offset leg -2’ below center)
Material MaterialAttribute_1 !(includes a surface setting from the parameters)
CYLIND B, 1” !(B is from the parameter for table leg height, 1” defines the cylinder radius)
DEL TOP !Again, removing all transformations before moving to the next leg
Table Leg 4:
ADDx -2’ !(Offset leg -2’ to the left of center)
ADDy 2’ !(Offset leg -2’ below center)
Material MaterialAttribute_1 !(includes a surface setting from the parameters)
CYLIND B, 1” !(B is from the parameter for table leg height, 1” defines the cylinder radius)
DEL TOP !Again, removing all transformations before moving to the next leg
Step 5: Explode the original table top and use to create a new 2d script to be copied into the 2d script window of the final table object
Step 6: Replace the preview image to include the scripted legs
This object is available for download from the Download Section of this site.