Create new loft form

AndrewButenko
Advocate
Advocate

Create new loft form

AndrewButenko
Advocate
Advocate

Hello!

 

I try use new loft form with 

 

fdoc.FamilyCreate.NewLoftForm(True, ref_ar_ar)

 

In the ref_ar_ar I add two array(Bottom and Top) of ReferencePoint. 

 

But I get form like a screenshot: 

 screen.png

I want get red line, but revit create line like a "wave".

 

Help me pleaase.

 

0 Likes
Reply
1,024 Views
4 Replies
Replies (4)

jeremytammik
Autodesk
Autodesk

Dear Andrew,

 

It is very hard to say anything at all based only on the screen snapshot you share.

 

Maybe you should share the relevant code snippet as well, or, better still, a full reproducible case.

 

Here are some discussions by The Building Coder on making use of NewLoftForm:

 

 

Cheers,

 

Jeremy

 



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

0 Likes

AndrewButenko
Advocate
Advocate

Hi Jeremy!

 

I create loft using next code: 

 

   Private Function CreateLoftForm(document As Autodesk.Revit.DB.Document) As Form
        Dim loftForm As Form = Nothing

        Dim rpa As New ReferencePointArray()
        Dim ref_ar_ar As New ReferenceArrayArray()
        Dim ref_ar As New ReferenceArray()
        Dim rp As ReferencePoint = Nothing
        Dim xyz As XYZ = Nothing


        Dim TransGlobal As Transaction = New Transaction(document)
        TransGlobal.Start("Create loft")




        xyz = document.Application.Create.NewXYZ(85.138522515, 45.303356517, 101.706036745)
        rp = document.FamilyCreate.NewReferencePoint(xyz)
        rpa.Append(rp)


        xyz = document.Application.Create.NewXYZ(85.383921301, 35.572182287, 101.706036745)
        rp = document.FamilyCreate.NewReferencePoint(xyz)
        rpa.Append(rp)


        xyz = document.Application.Create.NewXYZ(85.363870218, 35.083519311, 102.034120735)
        rp = document.FamilyCreate.NewReferencePoint(xyz)
        rpa.Append(rp)


        xyz = document.Application.Create.NewXYZ(84.757225743, 28.25298673, 102.034120735)
        rp = document.FamilyCreate.NewReferencePoint(xyz)
        rpa.Append(rp)


        xyz = document.Application.Create.NewXYZ(84.689869322, 27.761501607, 102.362204724)
        rp = document.FamilyCreate.NewReferencePoint(xyz)
        rpa.Append(rp)


        xyz = document.Application.Create.NewXYZ(83.219675545, 20.111233411, 102.362204724)
        rp = document.FamilyCreate.NewReferencePoint(xyz)
        rpa.Append(rp)


        xyz = document.Application.Create.NewXYZ(83.126540038, 19.735242886, 102.690288714)
        rp = document.FamilyCreate.NewReferencePoint(xyz)
        rpa.Append(rp)




        Dim cbp As CurveByPoints = document.FamilyCreate.NewCurveByPoints(rpa)
        ref_ar.Append(cbp.GeometryCurve.Reference)
        ref_ar_ar.Append(ref_ar)
        rpa.Clear()
        ref_ar = New ReferenceArray()


        xyz = document.Application.Create.NewXYZ(85.138522515, 45.303356517, 114.829397126)
        rp = document.FamilyCreate.NewReferencePoint(xyz)
        rpa.Append(rp)

        xyz = document.Application.Create.NewXYZ(85.383921301, 35.572182287, 115.157481116)
        rp = document.FamilyCreate.NewReferencePoint(xyz)
        rpa.Append(rp)

        xyz = document.Application.Create.NewXYZ(85.363870218, 35.083519311, 115.157481116)
        rp = document.FamilyCreate.NewReferencePoint(xyz)
        rpa.Append(rp)

        xyz = document.Application.Create.NewXYZ(84.757225743, 28.25298673, 115.485565105)
        rp = document.FamilyCreate.NewReferencePoint(xyz)
        rpa.Append(rp)

        xyz = document.Application.Create.NewXYZ(84.689869322, 27.761501607, 115.485565105)
        rp = document.FamilyCreate.NewReferencePoint(xyz)
        rpa.Append(rp)

        xyz = document.Application.Create.NewXYZ(83.219675545, 20.111233411, 115.813649095)
        rp = document.FamilyCreate.NewReferencePoint(xyz)
        rpa.Append(rp)

        xyz = document.Application.Create.NewXYZ(83.126540038, 19.735242886, 115.813649095)
        rp = document.FamilyCreate.NewReferencePoint(xyz)
        rpa.Append(rp)

        cbp = document.FamilyCreate.NewCurveByPoints(rpa)
        ref_ar.Append(cbp.GeometryCurve.Reference)
        ref_ar_ar.Append(ref_ar)
        rpa.Clear()
        ref_ar = New ReferenceArray()



        loftForm = document.FamilyCreate.NewLoftForm(True, ref_ar_ar)
        TransGlobal.Commit()
        Return loftForm
    End Function

As a result, I get:

 

screen2.png

 

I would like, that points would be connected not by "waves", but by lines. Is it possible?

0 Likes

jeremytammik
Autodesk
Autodesk

Dear Andrew,

 

I am sure it is possible.

 

Please solve this manually through the user interface first, then analyse the result with RevitLookup to see what kind of shape you really require..

 

Maybe you do not need a loft form but some other shape?

 

About Revit forms:

 

http://help.autodesk.com/view/RVT/2019/ENU/?guid=GUID-2B3F71CB-4274-457A-BF31-49280B3B0913

 

Afaict, a loft has smooth curves between the profiles:

 

 

If you want linear curves instead of non-linear ones, you should probably use a different shape.

 

Cheers,

 

Jeremy

 



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

0 Likes

jeremytammik
Autodesk
Autodesk

... Also, if you just need straight edges, a direct shape may be easier and more effective to generate:

 

http://thebuildingcoder.typepad.com/blog/2018/01/directshape-topics-and-happy-new-year.html/#3

  

Do you have a reason to prefer a loft form?

 

Parametrics, for instance?

 

Cheers,

 

Jeremy

 



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

0 Likes