Quality control AutoCAD drawings in Grasshopper
In this tutorial, we'll send a floorplan from AutoCAD to Rhino with Speckle, run a simple Grasshopper script to find incorrectly drawn lines, and send the annotations back to AutoCAD. We'll also adjust some blocks in Rhino along the way.
Prerequisites
To follow along with this tutorial, you will need to register with Speckle and install the required connectors 🔌. It takes less than 3 minutes!
For a comprehensive overview of these connectors, check our docs 📚!
Tutorial
With the setup completed, download the AutoCAD and Grasshopper files for this tutorial.
- Open the AutoCAD file. The drawing is a simplified version of a sample dwg that comes installed with AutoCAD.
- Pull up the AutoCAD Desktop UI by typing
Speckle
in the command line, or by clicking on the Speckle 2 plugin in the Add-Ins tab in your ribbon. - Open a new Rhino file and start Grasshopper by typing
Grasshopper
in the command line. Open the .gh file included with this tutorial.
Send the AutoCAD Drawing to Rhino
Let's send our first stream to Speckle! Keep in mind that we'll use branches to organize our data in this tutorial.
- Create a new
Plan Coordination
stream and check that it's on Sender mode. If not, click the arrows on the top right corner to toggle between the two modes. - Create a new
Annotations
branch by clicking on main in the bottom left of the stream and selecting Add a new branch from the drop-down. Switch back to main after creating the new branch. - Select all geometry in the file.
- Click the blue Objects button and select Set Selection from the dropdown.
- Click Send on the
Plan Coordination
stream. TypeDrawing for review
in the comment line, and click Send again to commit the selected geometry. - To view the drawing in the Speckle Web App, click the Open in browser icon in the top right corner of the stream. Keep this tab open for later.
- In Rhino Desktop UI, click the blue Add a stream button on the bottom. Add the
Plan Coordination
stream card to UI by clicking the arrow next to the stream in the popup window. - Click the big Receive on button the stream and watch the drawing you just sent come into Rhino!
Run a Grasshopper Script to Identify Bad Lines
The sample plan drawing from AutoCAD has some messy lines with gaps or overlaps at the ends that need to be cleaned up. Now, we'll run a quick analysis in Grasshopper and send the results back to AutoCAD.
- Select all drawing lines in Rhino and set them in the input
Crv node
in Grasshopper by right-clicking the node and selecting Select Multiple Curves from the dropdown. - You should see small circles previewed on all curve ends that are not correctly adjoining other curves in the drawing! Adjust the
Radius
slider in the input to customize the size of these annotation circles. - To send our annotations back to AutoCAD, get the
Annotations
branch URL from the Speckle Web App tab we opened in the previous section. Navigate to theAnnotations
branch page in the browser and copy this URL. - In the Speckle section of the Grasshopper script, paste your copied URL into the text panel.
- Make sure you have a valid account selected for the stream server in the accounts node, and click Send in the Send Data node.
- Go back to AutoCAD and swap the
Plan Coordination
stream to receiver mode. Select theAnnotations
branch from the branch dropdown, and click Receive. - The Grasshopper generated circles now appear in your file - change their layer color to red and use these as a guide to see which lines need to be fixed!
Modify Drawing Blocks in Rhino
Finally, we'll make some changes to the door blocks and send them back to AutoCAD.
- Double-click a door block instance in the Rhino file to open block editing mode.
- Trim the end of the door swing curve to match the end of the door curve, and press enter to save block changes. Make the same change for any other door block definitions that need trimming.
- Open the Block Manager by typing
BlockManager
in the command line. Locate the door block definitions (left and right swing) and rename them by removing the stream commit prefix. Now they are ready for sending! - Create a new
Block edits
branch in thePlan Coordination
stream in Rhino. - Select all door block instances, set the selection, and send them to this branch.
- Receive the new blocks in AutoCAD - open Block Manager to delete the old door blocks from your file, and rename the received block definitions by removing the commit prefix.
Remarks
Block conversions in Rhino and AutoCAD are an early prototype, so we currently do not support nested block definitions or dynamic blocks. If you have feedback on this feature, hop over to our community forum and give us a shout!
Conclusion
We hope you enjoyed this tutorial and found it useful!
Speckle is an Open Source project and we really ❤️ feedback, so if you have any questions, comments, critiques, or praises please let us know on our community forum.
Subscribe to Speckle News
Stay updated on the amazing tools coming from the talented Speckle community.