I have several detail line circles. I would like to change the radius of all of them in one go, rather than one by one. I have tried a couple of different approaches. For the second approach I used a python script generated by ChatGPT.
Please see screenshot below. Any help would be much appreciated.
BTW, the parameter name input in 1st attempt reads “Line Style” because I was experimenting with different parameter names to see if I could get something to work. I originally tried “Radius” here, but then I realised that there is no “Radius” parameter in the Properties dialog when a line is selected. The only dimension parameter is “Length”, but that’s greyed out, which means it’s read-only, right?
[10:39 am] Peter Christensen
# Import the required libraries
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
# Input Parameters
curveElement = IN[0] # Input curve element (e.g., a circle)
newRadius = IN[1] # New radius value
# Initialize an empty list to store the modified curves
modifiedCurves = []
# Start a Revit transaction
doc = DocumentManager.Instance.CurrentDBDocument
transaction = Transaction(doc, "Change Curve Radius")
transaction.Start()
# Loop through each input curve
for curve in curveElement:
# Check if the curve is a circle
if isinstance(curve, Arc):
# Create a modified circle with the new radius
modifiedCircle = Arc.Create(curve.Center, newRadius, curve.StartAngle, curve.EndAngle, curve.Normal)
# Add the modified circle to the list
modifiedCurves.append(modifiedCircle)
# Commit the transaction
transaction.Commit()
# Output the modified curves
OUT = modifiedCurves
Hi @sovitek thanks very much. I tried it but the element.delete node isn’t working. I couldn’t find a node called ‘elements.delete’, just ‘element.delete’
I get the preview in revit, but it doesn’t create the actual geometry (and it doesn’t delete the initial curves)
Oh that worked, thanks. I had the wrong node. I used active view in current document from the clockwork package.
I actually had a set of curves in an array group and I wanted to change all their radii rather than clicking each one individually. I see that your method creates the new curves outside the group, but that’s OK, I can still use it.
I wonder if there’s a way to get this to work inside an array group… ?