DynamoDS / DynamoRevit

Dynamo Libraries for Revit
https://dynamobim.org
342 stars 188 forks source link

Lofting ModelCurve.ByCurve gives different result than ModelCurve.ReferenceCurveByCurve #1299

Closed eibre closed 8 years ago

eibre commented 8 years ago

If this issue is not a bug report or improvement request, please check the Dynamo forum, and start a thread there to discuss your issue.

Dynamo version

1.2

Revit version

2017

Operating system

W7

What did you do?

Made a curve and created planes along it. Then added rectangles in the rotated coordinate systems. Converted the rectangles to ModelCurves and used Form.ByLoftCrossSections to create a solid in a revit mass family enviroment.

image

2016-09-18 21_17_08-dynamo

bridgeLoft.dyn.txt

What did you expect to see?

image

What did you see instead?

When using ModelCurve.ByCurve it looks like the Modelcurve gets rotated to be parallell to the vertical reference plane in Revit. With ModelCurve.ReferenceCurveByCurve this did not happen. I also tried with a python script, and it worked as expected too.

image

kronz commented 8 years ago

@eibre if you run this using ModelCurve.ByCurve on a fresh file, and run it only once, does it still give the weird result? The reason I ask: There is a VERY weird relationship that will get created here using ModelCurves that are NOT reference curves, because after Dynamo creates the Model line curves, the FormElement will "consume" the model curves (deleting them) but will leave Reference curves behind. This is the as-designed behavior in Revit, the intention is to clean up construction geometry in the Model Curve case, but leave construction geometry in the reference line case. For Dynamo, however, this is very awkward, as the elements just created in the graph will get deleted by a downstream process in the graph. If you then re-run the same graph, you get into a pretty dicey situation as Dynamo tries to modify model curves that are no longer there.

Anyway, this may not be the source of the issue, but it's my first thought for investigation.

eibre commented 8 years ago

@kronz

If I only create the ModelCurves in a fresh file, they look right. But if I try to create a form after selecting them (both manually in Revit or with Form.ByLoftCrossSections) the finished profiles is rotated.

loftproblem

kronz commented 8 years ago

@eibre thanks, that is what I was afraid of. This sounds like it is an issue inside of Revit at the moment of Form Element creation, and not something that the Dynamo team can address. I'll let some folks on the Revit team know about this, but will close out this particular issue.

Do you think you could share the file that just has all the model line rectangles placed?

eibre commented 8 years ago

@kronz I'm not to sure it's entirely a Revit thing, because with the following python node it works as excpected (testet lofting both manual and with script).

import clr 

clr.AddReference('RevitAPI') 
from Autodesk.Revit.DB import * 
from Autodesk.Revit.DB.Structure import * 

clr.AddReference('System') 
from System.Collections.Generic import List 

clr.AddReference('RevitNodes') 
import Revit 
clr.ImportExtensions(Revit.GeometryConversion) 
clr.ImportExtensions(Revit.Elements) 

clr.AddReference('RevitServices') 
import RevitServices 
from RevitServices.Persistence import DocumentManager 
from RevitServices.Transactions import TransactionManager 

doc = DocumentManager.Instance.CurrentDBDocument 
#Preparing input from dynamo to revit 
curves = IN[0]
sketchPlanes = UnwrapElement(IN[1])

#create curveloops

#Do some action in a Transaction 
TransactionManager.Instance.EnsureInTransaction(doc)

refAA = ReferenceArrayArray()
for list,sp in zip(curves,sketchPlanes):
    refA = ReferenceArray()
    for curve in list:
        modelCurve = doc.FamilyCreate.NewModelCurve(curve.ToRevitType(),sp)
        refA.Append(modelCurve.GeometryCurve.Reference)
    refAA.Append(refA)

OUT = doc.FamilyCreate.NewLoftForm(True, refAA)

TransactionManager.Instance.TransactionTaskDone()