Class Code: AB3910-Laucache.autodesk.com/au2012/sessionsFiles/3910/5043/... · Web viewEnter the...

20
Coding Autodesk® Vasari: Scripting for Conceptual Design Nathan Miller – CASE Design Inc Matt Jezyk - Autodesk Zach Kron - Autodesk This hands-on lab will introduce participants to the fundamentals of Python scripting and visual programming within the Autodesk Vasari conceptual design environment. Custom code gives users the ability to efficiently automate many design tasks while also enabling new generative design capabilities. This lab will demonstrate how to compose useful Python scripts with the RevitPythonShell add-in and Dynamo Visual Programming for Autodesk® Revit® software and Autodesk Vasari. The lab will provide users with resources and step-by-step examples for automating geometry creation, adjusting family parameters using external data, and sharing information with different design platforms. Class Code: AB3910-L Learning Objectives At the end of this class, you will be able to: Use two powerful Vasari Add-Ins: RevitPythonShell and Dynamo Learn useful automation techniques to support Conceptual Design. o Automate Conceptual Form creation. o Use external data to influence families and parameters. o Create interactive design workflows.

Transcript of Class Code: AB3910-Laucache.autodesk.com/au2012/sessionsFiles/3910/5043/... · Web viewEnter the...

Coding Autodesk® Vasari: Scripting for Conceptual DesignNathan Miller – CASE Design IncMatt Jezyk - AutodeskZach Kron - Autodesk

This hands-on lab will introduce participants to the fundamentals of Python scripting and visual programming within the Autodesk Vasari conceptual design environment. Custom code gives users the ability to efficiently automate many design tasks while also enabling new generative design capabilities. This lab will demonstrate how to compose useful Python scripts with the RevitPythonShell add-in and Dynamo Visual Programming for Autodesk® Revit® software and Autodesk Vasari. The lab will provide users with resources and step-by-step examples for automating geometry creation, adjusting family parameters using external data, and sharing information with different design platforms.

Class Code: AB3910-L 

Learning ObjectivesAt the end of this class, you will be able to:

Use two powerful Vasari Add-Ins: RevitPythonShell and Dynamo Learn useful automation techniques to support Conceptual Design.

o Automate Conceptual Form creation.

o Use external data to influence families and parameters.

o Create interactive design workflows.

Coding Autodesk Vasari: Scripting for Conceptual Design

About the Speakers

Nathan Miller, CASE Design Inc.

Nathan Miller is the Director of Computational Design for CASE Design Inc. In this capacity, Nathan leads efforts in computational design strategy, complex modeling and geometric rationalization, as well as the development of custom software applications.

With an extensive background in the strategic planning and implementation of computational design, Nathan comes to CASE from NBBJ where for over the past five years he held the positions of Associate Architectural Designer and Lead Computational Designer. There he led efforts in the development and implementation of computational design systems for generative design concepts, production efficiency, and building performance. Notable projects include the Hangzhou Stadium in China, where he was Lead Designer of the 80,000-seat sports stadium, and spearheaded a firm-wide strategic development initiative that expanded the firm’s expertise in computational design.

Matt Jezyk, Autodesk

Matt Jezyk is Senior Product Manager for AEC Conceptual Design Products. He has been in the Architecture and Engineering industry for 17 years and has spent the past 13 years developing Autodesk Revit. As one of the original architects hired by Revit Technology Corporation, Matt helped build what are now called Revit Architecture and Revit Structure. He is experienced in building both parametric and geometric modeling tools on the Revit platform but more recently has focused on emerging markets and technology. His latest development teams have produced new parametric modeling tools directly integrating energy analysis features. One such tool, Project Vasari, is available for preview on the website Autodesk Labs.

Zach Kron, Autodesk

Zach Kron is an architectural designer and a quality assurance analyst for Autodesk. Since 2007, he has worked on Autodesk® Revit® and associated platforms with product designers and developers creating feature functionality, exploring parametric design practices, and generally enjoying technology. In addition to internal teaching and curriculum development at Autodesk, Zach has helped create and run workshops at MIT, ACADIA, Autodesk University and WoodStEx, and maintains the Buildz blog. Before joining Autodesk, Zach worked as a designer in several Boston-area architectural offices on projects ranging from furniture to bridges. He has more than fifteen years of professional experience in design.

2

Coding Autodesk Vasari: Scripting for Conceptual Design

RevitPythonShell and Dynamo

This class will focus on the use of two powerful add-ins for Autodesk Vasari: The RevitPythonShell and Dynamo. Both tools are free, open source add-ins that enable users with the ability to automate conceptual design tools and to customize processes.

The class will first look at RevitPythonShell as an example of a scripting language that allows users to access the Revit/Vasari API and produce Python scripts that sit within the Vasari Ribbon Menu. RevitPythonShell gives users the unique ability to use a very popular programming language to produce simple, fast automation without the need for compiling

The course will then explore uses of Dynamo as an example of a visual programming language. Using a visual graph of nodes and connections, users can produce powerful, interactive systems without the need to learn traditional coding.

Automate Conceptual Design

Using RevitPythonShell and Dynamo, this class will focus on exercises for automating aspects of the Conceptual Design process in Vasari.

Automate Form Creation

Using the RevitPythonShell, we will explore API-based examples for constructing conceptual form geometry. The exercises will show the progression of points, curves, and surfaces. We will also use automated processes to place intelligent elements such as Adaptive Components.

Use External Data to Influence Parameters

RevitPythonShell and Dynamo both offer unique opportunities to affect parameters within Vasari. The class will look at examples for influencing and modifying family parameters that would be very difficult or impossible to do using conventional workflows.

Create Interactive Design Workflows

Dynamo’s interface allows users to assemble complex systems without the need for traditional scripting. The systems are also dynamic and allow for real-time modification. The class will show examples of using Dynamo to create interactive design systems that allow the user to immediately see changes resulting from parametric modification.

3

Coding Autodesk Vasari: Scripting for Conceptual Design

Python

Example 01: Interactive Python Shell

1. Launch Vasari.

2. Click    > New > Family> Mass.rft3. Activate the Interactive Python Shell under the Add-ins menu4. Find the workshop folder containing the Python Example Files: C:\…\01 Python\01 Form

Creation5. This folder contains a series of examples which explain the workflow for scripting conceptual form

creation.6. Load 01-RPS-SinglePoint.py7. Press the “Play” button. The script will create a single Reference Point.8. Modify the variables x, y, or z and press “Play” to see a new Reference Point created.

4

Coding Autodesk Vasari: Scripting for Conceptual Design

Example 02: Adding to the Python Ribbon

1. Launch Vasari.

2. Click    > New > Family> Mass.rft3. Activate the Python Shell “Configure…” menu under Add-Ins4. Under the Command’s tab choose “Add”5. Navigate to the workshop folder containing the Python Example Files …

C:\…\01 Python\01 Form Creation C:\…\01 Python\02 Adaptive Placement

6. Add each Python Script file to the Command tab Enter the Name (as you want it to appear in the Ribbon menu) Enter the Group (to create a drop down of related scripts in the Ribbon)

7. After the scripts are loaded… Hit “Save” and Restart Vasari

8. Loaded Python Scripts will now appear in the Ribbon menu

5

Coding Autodesk Vasari: Scripting for Conceptual Design

Example 03: Running & Editing Conceptual Form Scripts

1. Launch Vasari.

2. Click    > New > Family> Mass.rft3. Test and Run the series of Python scripts for points and surfaces…

Run the Single Point script to create a single point

Run the Row of Points script to create a row of points

6

Coding Autodesk Vasari: Scripting for Conceptual Design

Run the Grid of Points script to see a grid of points

Run the Wave Point script to see a 3D grid following a Sin wave

Run the Wave Curves script to see interpolated curves going through the grid

7

Coding Autodesk Vasari: Scripting for Conceptual Design

Run the Wave Loft script to create a loft form element from the points

EDIT the Wave Loft script to change the amplitude Find the Wave Script *.py file on your hard drive Open the script with Notepad (Notepad ++ recommended) Edit the zAmp variable (controls the amplitude of the wave) Save the script and Re-Run the command in Vasari

8

Coding Autodesk Vasari: Scripting for Conceptual Design

Run the Mobius Band script to create a mathematical Mobius surface

EDIT the Mobius Band script to create more twists to the surface Find the Mobius Band *.py file on your hard drive Open the script with Notepad (Notepad ++ recommended) Edit the T variable from 0.5 to 1.5 Save the script and Re-Run the command in Vasari

9

Coding Autodesk Vasari: Scripting for Conceptual Design

Example 03: Placing Adaptive Families and Editing Parameters

1. Launch Vasari.

2. Click    > New > Family> Mass.rft3. Load Adaptive Families found in C:\... \01 Python\02 Adaptive Placement

FoldedPanel.rfa SimplePipe.rfa

4. In the Scripts: Verify that the filename and dir variables are correct.5. Run the Structure script. This will place the Simple Pipe adaptive component based on a CSV

coordinates file. (Structure.csv)

6. Run the Panel script. This will place the Folded Panel adaptive component based on a CSV coordinates file. (Panels.csv)

10

Coding Autodesk Vasari: Scripting for Conceptual Design

7. Run the Parameters script. This will change the t instance parameter for each panel. The panel apertures will adjust based on the external values in ParametersA.csv

EDIT the Parameters script to change the external file reference for new parameter values.

Find the Parameters *.py file on your hard drive Open the script with Notepad (Notepad ++ recommended) Edit the filename and dir variables to refer to the ParametersB.csv file Save the script and Re-Run the command in Vasari

11

Coding Autodesk Vasari: Scripting for Conceptual Design

Dynamo

Example 01: Create a Point

8. Launch Vasari.

9. Click    > New > Family> Mass.rft10. Go to Add-ins tab and launch Dynamo11. From the Dynamo File Menu, go to File/Samples/ 1. Create Point12. Notice a few nodes (Number, XYZ and Ref Point) in the workspace. Run to create a single

Reference Point at 0,0,0.13. Select and move nodes by using the left mouse button, the right mouse button to delete

12

Coding Autodesk Vasari: Scripting for Conceptual Design

14. Now we will learn how to re-wire the workspace to add more inputs: From the Component Bar, find the Number node by searching or expanding

the Primitives Group Drag and drop a Number node into the Workspace Find the Number Slider node and add that as well On the XYZ node, select the end of the wire connecting to the Y port. Drag it off into

space to disconnect. Do the same for the Z port. Connect the new Number node to the Y port and the Number Slider node to the Z

port. 

Example 02: Create a Grid

1. From Vasari, Click   >   (Open).    2. Navigate to  C:\VasariWIP\Beta1-0\Dynamo\Samples3. Open Mass with Loaded Families.rfa from the Samples directory4. Go to Add-ins tab and launch Dynamo (re-launch it if you already had it open)5. From the Dynamo File Menu, go to File/Samples/ 2. Ref Grid Sliders. You should see this

workspace appear: 6. Here we have a few Number and Number Slider nodes that drive a new node called XYZ

Grid.7. TheXYZ Grid is responsible for creating a 2-d or 3-d array of XYZs based on the inputs.

The X-count, Y-count and Z-count inputs control how many XYZs to create in each direction. The X-space, Y- space and Z- space inputs control the spacing between XYZs in each direction.

13

Coding Autodesk Vasari: Scripting for Conceptual Design

8. The XYZ Grid node does not make any Revit elements on Its own, only invisible XYZ nodes. In order to see something appear in the Revit view, we need to connect other nodes to the XYZ Grid output node that can accept XYZs as input. In the sample a Reference Point node is taking the output of the XYZ Grid (a list or collection of XYZs) and is creating a list of Reference Points as its output. (Hit Run to see the grid of points)

9. Now we will extend this workspace to do something more useful than just creating points.10. Go to the Search Bar and type in “Family”, this filters the available nodes down and allows

easier access from the Component Bar.  If component list are collapsed after the search, open them to see the nodes.

11. Drag and drop one Family Instance Creator node and one Family Type Selector node into the workspace

12. Connect the Family Type Selector output to the Family Instance Creator “typ” input port.13. Disconnect the Reference Point node. You can delete it by right-clicking or pressing CTRL-

Delete.14. Now select the Cone Family Type from the pulldown and then connect the XYZ output from

the XYZ Grid to the XYZ input of the Family Instance Creator. Hit Run and you should see something like this: 

15. With “Run Automatically” checked, experiment with different values in the input sliders and watch the Revit view update with new Cone family instances.

14

Coding Autodesk Vasari: Scripting for Conceptual Design

Dynamo + Python

Example 01: Sine Wave on Curve

16. From Vasari 2.5, go to Open/Family…and open Mass with Loaded Families.rfa from theSamples directory

17. Go to Add-ins tab and launch Dynamo18. From the Dynamo File Menu, go to File/Samples/ 6. Create Sine Wave From Selected

Points.You should see this workspace appear:

19. A Python Script Node can take in input from other Dynamo nodes20. Now place two points using the Vasari Sketching Gallery21. Select each point using the Point By Selection Node in Dynamo22. Press Run. You should see a line and a sine wave be plotted between the two entered

points. These elements all came from the Python Script inside of Dynamo.23. Experiment with moving the points or the straight line, notice how the sine wave is updated

to follow the new position? This is because Dynamo and the Python node can watch specific elements and then re-run the workspace to keep things in sync based on your changes.

15

Coding Autodesk Vasari: Scripting for Conceptual Design

24. Sine Wave plotted by the Python Script Node inside Dynamo25. Below is the Python script. We will not dissect it in detail now but take a look at how

the beginPointand endPoint variables, get assigned objects from IN. The IN and OUT ports map to variable in the script.

Example 02: Dynamic Mobius

16

Coding Autodesk Vasari: Scripting for Conceptual Design

1. Launch Vasari.

2. Click    > New > Family> Mass.rft3. Go to Add-ins tab and launch Dynamo4. Load the Dynamic Mobius *.dyn file5. Find the “filename” node and click “Browse”

Locate the Dynamic Mobius *.py script6. Set the Dynamo file to Run Automatically.

Manipulate the slider value to see the Mobius transform

17