How do I draw a cropped arc?

I have imported some geometry from Revit:

Arc(Normal = Vector(X = 0.000, Y = 0.000, Z = 1.000, Length = 1.000), CenterPoint = Point(X = 7857.358, Y = 2521.494, Z = 0.000), Radius = 150.000, StartAngle = 296.266, SweepAngle = 70.283)
Arc(Normal = Vector(X = 0.000, Y = 0.000, Z = 1.000, Length = 1.000), CenterPoint = Point(X = 7953.692, Y = 2842.128, Z = 0.000), Radius = 308.065, StartAngle = 279.848, SweepAngle = 35.833)

I want to recreate this exactly using Python:

Vec = Vector.ByCoordinates (0, 0, 1, True)
BodyPoints = [Point.ByCoordinates(7857.358, 2521.494, 0), Point.ByCoordinates(7953.692, 2842.128, 0) ]
Radii = [150, 308.065 ]
StartAngles = [296.266, 279.848 ]
SweepAngles = [70.283, 35.833 ] 
Body =  [] 

for index, Pt in enumerate(BodyPoints):
    Body.append(Arc.ByCenterPointRadiusAngle(Pt, Radii[index], StartAngles[index],  SweepAngles[index], Vec))

Now it’s drawing in the right place. But the length is wrong and I can’t work out how to alter it.

The blue is the import - the black is the extra Python length.

image

Convert to radians from degrees.

2 Likes

Tried it the other way round too (blue is Python)

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('ProtoGeometry')
import math

Vec = Vector.ByCoordinates (0, 0, 1, True)


BodyPoints = [Point.ByCoordinates(7857.358, 2521.494, 0), Point.ByCoordinates(7953.692, 2842.128, 0) ]
Radii = [150, 308.065 ]
StartAngles = [296.266, 279.848 ]
SweepAngles = [70.283, 35.833 ] 
RAD_start = []
RAD_sweep = []
for StDeg in StartAngles:
    RAD_start.append (math.degrees(StDeg))
for SwAng in SweepAngles:
    RAD_sweep.append ( math.degrees(SwAng)) 
    
Body =  [] 
for index, Pt in enumerate(BodyPoints):
    Body.append(Arc.ByCenterPointRadiusAngle(Pt, Radii[index], RAD_start[index],  RAD_sweep[index], Vec))

# Return the created arc
OUT = Body

You’re using the Dynamo geometry engine, so the angles are in degrees, and should move in a clockwise fashion.

If I put the start angles in radians and the sweep angles in degrees I get the mirror of what i’m after.

I am so confused :crazy_face:

Even more confusing is if I use the exact same numbers in a Dynamo node I get different lines (blue is the node)

Try from 90 to 180.

You’re close. :slight_smile:

A little less cryptic please. It’s the weekend and everything is tired :sleeping:

1 Like

Draw an arc from 90 degrees to 180 degrees, with a radius of 1 unit.

Start with a node.
Then design script.
Then Python.
Then do list of values in Python.
Then try changing your angles and radii to the harder values to conceptualize.

I don’t come on the forum to think for myself! :stuck_out_tongue_winking_eye:

1 Like

Joke aside though, how come the Python gives a different output to the Dynamo node even with identical figures?

They aren’t. Your input figures are not the same as the arc in question.

The reason I wanted you to try the ‘90 to 180’ exercise was that it would make it clear. The description of the geometry is formatted as such (emphasis added by me):

Normal
CenterPoint
Radius
StartAngle
SweepAngle

The node and constructor ask for (in another order):

Normal
CenterPoint
Radius
StartAngle
EndAngle

Note that the EndAngle and SweepAngle are different parameter names which are related, though not the same.

So when I try to build your base curve using exactly the numbers you gave in pure Dynamo, I see this:

Which is exactly what you didn’t want but you were getting with Python.

Instead, you want to add the sweepAngle to the startAngle, to get endAngle values of 366.549 and 315.681 respectively.

From there we can move onto the Python, which looks like this:


Note that on line 22 I am adding the start angle to the sweep angle, to get the endAngle.

1 Like