How to convert 3D Curve to 2D Curve

How to convert 3D Curve to 2D Curve

Anonymous
Not applicable
2,239 Views
3 Replies
Message 1 of 4

How to convert 3D Curve to 2D Curve

Anonymous
Not applicable

Dear Revit API experts,

 

I am trying to convert ramp to floor.

I have found how to do it using dynamo, now i want to do it using API.

The ramp face consists of HermiteSpline curve. (which i consider as 3D curve, am I right?)

I want to convert this curve to 2D. (XY surface)

 

RampToFloorDynamo.png

 

Attached is the dynamo graph.

I want to find similar API method equivalent to Curve.Project in the dynamo.

 

Before Curve.Project

[0] Curve(StartPoint = Point(X = 1037.124, Y = 1761.638, Z = 0.000), EndPoint = Point(X = 1256.636, Y = 2737.248, Z = 0.000))
[1] Curve(StartPoint = Point(X = 1256.636, Y = 2737.248, Z = 0.000), EndPoint = Point(X = 2463.127, Y = -3567.063, Z = 990.600))
[2] Curve(StartPoint = Point(X = 2463.127, Y = -3567.063, Z = 990.600), EndPoint = Point(X = 1898.903, Y = -2741.441, Z = 990.600))
[3] Curve(StartPoint = Point(X = 1898.903, Y = -2741.441, Z = 990.600), EndPoint = Point(X = 1037.124, Y = 1761.638, Z = 0.000))

 

After:

[0] Line(StartPoint = Point(X = 1037.124, Y = 1761.638, Z = 0.000), EndPoint = Point(X = 1256.636, Y = 2737.248, Z = 0.000), Direction = Vector(X = 219.512, Y = 975.610, Z = 0.000, Length = 1000.000))
[1] NurbsCurve(Degree = 3)
[2] Line(StartPoint = Point(X = 2463.127, Y = -3567.063, Z = 0.000), EndPoint = Point(X = 1898.903, Y = -2741.441, Z = 0.000), Direction = Vector(X = -564.224, Y = 825.622, Z = 0.000, Length = 1000.000))
[3] NurbsCurve(Degree = 3)

 

Thanks.

0 Likes
2,240 Views
3 Replies
Replies (3)
Message 2 of 4

Revitalizer
Advisor
Advisor

Hi,

 

just an idea:

 

There is a Document.ConvertModelToDetailCurves method which needs a View and a ModelCurveArray as parameters.

It returns a DetailCurveArray.

 

So, if you create some temporary elements (View, ModelCurves, DetailCurves), you can let Revit do the projection math.

 

The resulting DetailCurves' GeometryCurves is what you want to get.

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Message 3 of 4

Anonymous
Not applicable

Hi Revitalizer,

 

I not yet able to draw ModelCurve of HermiteSpline or ModelNurbSpline as in this topic:

So i cant apply your idea yet. Smiley Sad

 

https://forums.autodesk.com/t5/revit-api-forum/how-to-draw-modelnurbspline/td-p/7500615

 

 

Anyway the good news is I already able to create floor from ramp.

The method i used: (for those who might need it)

1) draw 2D HermiteSpline curve as an arc at XY axis. (change all points to same Z value)

2) create flat floor (no slope)

3) change vertex of the floor.

 

Here is part of my code:

 

Floor floor = doc.Create.NewFloor(curvearrayFloor, true);
doc.Regenerate();

SlabShapeEditor slabshapeeditor = floor.SlabShapeEditor;
SlabShapeVertex slabshapevertex = null;

foreach (Curve curv in lstcurve) {
slabshapevertex = slabshapeeditor.DrawPoint(curv.GetEndPoint(0));
}
doc.Regenerate();

 

 

0 Likes
Message 4 of 4

jeremytammik
Autodesk
Autodesk

Here are some more thoughts on various methods to create a sloped floor:

 

http://thebuildingcoder.typepad.com/blog/2014/03/creating-a-sloped-floor.html

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder