public void Helix_Basic() { var sp = Point.Origin(); var z = Vector.ZAxis(); var s = Vector.XAxis().AsPoint(); var p = 5.0; var a = 3240; var helix = Autodesk.DesignScript.Geometry.Helix.ByAxis(sp, z, s, p, a); var revitCurve = helix.ToRevitType(); Assert.NotNull(revitCurve); Assert.IsAssignableFrom <Autodesk.Revit.DB.CylindricalHelix>(revitCurve); helix.StartPoint.AssertShouldBeApproximately(revitCurve.GetEndPoint(0).ToPoint()); helix.EndPoint.AssertShouldBeApproximately(revitCurve.GetEndPoint(1).ToPoint()); var revitHelix = (Autodesk.Revit.DB.CylindricalHelix)revitCurve; revitHelix.Pitch.AssertShouldBeApproximately(p); revitHelix.Height.AssertShouldBeApproximately(9 * p); revitHelix.GetEndPoint(0).AssertShouldBeApproximately(s); }
/// <summary> /// Synchronize the manipulator position with the node's value. /// </summary> protected override void UpdatePosition() { Active = false; if (Node == null || !indexedAxisNodePairs.Any()) { return; } if (origin == null) { origin = Point.Origin(); //First time initialization } //Node output could be a collection, consider the first item as origin. Point pt = GetFirstValueFromNode(Node) as Point; if (null == pt) { return; //The node output is not Point, could be a function object. } //Don't cache pt directly here, we need to create a copy, because //pt may be GC'ed by VM. origin = Point.ByCoordinates(pt.X, pt.Y, pt.Z); Active = true; }
public void IsLineLike_Curve_CorrectlyIdentifiesArc() { var arc = Arc.ByThreePoints( Point.Origin(), Point.ByCoordinates(1, 1), Point.ByCoordinates(0, 1)); Assert.False(CurveUtils.IsLineLike(arc.ToRevitType(false))); }
public void IsLineLike_Curve_CorrectlyIdentifiesLine() { var line = Line.ByStartPointEndPoint( Point.Origin(), Point.ByCoordinates(12, 3, 2)); var revitCurve = line.ToRevitType(false); Assert.True(CurveUtils.IsLineLike(revitCurve)); }