Revit Polyline Fit and Spline

Just some fun stuff…

This started out several years ago as just simple Dynamo routine to make a pseudo Pline tool for Revit. At the time it was used mostly for “soft” site elements like ponds and walkways. Output was native Revit splines.

Then it was converted to pyRevit, just running a dyn file. Followed by full Python using a dynamo bridge.

But the company I’m with now works with a lot of archival DWG files, so I wanted output that was closer to the native AutoCAD Pedit tools. The Pedit Fit Curve doesn’t create a spline, but rather a series of tangent arcs passing thru all the points. So I had multiple iterations of calculating tangent arcs like AutoCAD. Arcs are good for construction dimensioning. I got it verry close but never perfect.

So back to AutoCAD (which I avoid like a bad dream). Ran across AutoCAD Core Console. So spun up LISP - my first programing language (wanted to stick to plain text code rather than jump over to C)

A bunch of refactoring and plenty of typing help from our friend ChatGPT and now have AutoCAD Pedit Fit.

Some fun code for merging multiple technologies. I kept some old dynamo more as example (and it works fine.) And have a fall back for systems that don’t have AutoCAD installed. I’ll probably revisit deciphering and replicating Pedit Fit at some point, but this works and I’ll probably use the AutoCAD Core Console for some other tasks down the road.

Github Polyline Script

I tried adding the script to my custom pyRevit tools, but upon reload, it’s giving me this error:


ERROR [pyRevitAssemblyBuilder.SessionManager.LoggingHelper] UI build error for 'mySlice-of-Py': Autodesk.Revit.Exceptions.ArgumentException: Unexpected tab.
Parameter name: tabName
 at ?A0x1a013a09.getTargetTab(String tabName)
 at Autodesk.Revit.UI.UIApplication.GetRibbonPanels(String tabName)
 at pyRevitAssemblyBuilder.UIManager.Builders.PanelBuilder.CreatePanel(ParsedComponent component, String tabName)
 at pyRevitAssemblyBuilder.UIManager.UIManagerService.HandlePanel(ParsedComponent component, String tabName, ExtensionAssemblyInfo assemblyInfo, String renamedTabTitle)
 at pyRevitAssemblyBuilder.UIManager.UIManagerService.BuildUI(ParsedExtension extension, ExtensionAssemblyInfo assemblyInfo)
 at pyRevitAssemblyBuilder.SessionManager.SessionManagerService.LoadSession()

Any ideas? I checked the folder structure and everything appears to be in the right place, in the Roaming/pyRevit/Extensions folder.

I used the pyRevit extension manager to add the script, by copy/pasting the Git URL. It showed a message saying the tool was installed, and all the folders and files were copied into the Extensions folder. However I don’t see mySlice-of-Py or your name as Author in the list of installed packages on my machine.

This isn’t a full extension. It is a single tool (button). You should be able to download and place the Polyline.pushbutton folder and associated 4 files anywhere in an existing extension tab folder of your choosing. The bundle file for your chosen folder would need to be updated to reference the pushbutton.

For adding full extensions from other sources there needs to be a json file (which I didn’t make since it is a single pushbuttton.)

thank you sir, that worked! I dropped it into the pyArchitect extension. I’m still a n00b when it comes to adding custom tools. haha