Line to curve problem

the offset method is no longer valid?
I need to access the revitapi but some api only work on curve, not line.

1 Like

@newshunhk ,

do you need some libraries ? , i use in general the Primier frame:

https://primer.dynamobim.org/10_Custom-Nodes/10-6_Python-Templates.html

Can you give us more information about the Offset issue? Why is it no longer valid? You’re showing it working.

You’re correct that the Revit API methods for Curves do not always work for Lines, however Revit Lines inherit their members from Curves, so that is not the issue. You are however attempting to use a Revit method on a Dynamo object without loading the Revit API. Do a little more digging through the forums but you’ll need to load the API before you can use it and you’ll also have to convert the Dynamo geometry to Revit geometry as well.

1 Like

@newshunhk

Could be my template is overloaded, but i think it works

import clr

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

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI 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
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

#Preparing input from dynamo to revit
x = UnwrapElement(IN[0])
OUT = x.PointAtParameter(1)

I converted to revit geometry before but it is the same :frowning:

old method should work I remember, but not in revit 2023?
this picture is captured from other.

hi, PointAtParameter is not from revitapi, so sure it works.

1 Like

Hello,
2 curves (1 + reverse) for a line if you are interested

But, it is necessary to read remark of Mr. C.Poupin of yesterday on Line and curve
(question from yesterday)

Cordially
christian.stan

3 Likes

Unwrapping is not the same as converting geometry. There are conversion methods or you can break down the Dynamo curve and rebuild it as a new Revit curve.

The method you’re using there is not from the Revit API. It’s a Dynamo method. I believe Dynamo now retains Lines as Lines when making conversions but either way, there’s no functional difference between a Line and a Curve. Why do you specifically need a Curve? Are you trying to convert the Line to a Curve so that you can use a Revit API method on the Curve? Which method are you trying to use?

1 Like