.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Curved 3D Faces

3 REPLIES 3
Reply
Message 1 of 4
Micaletti
1092 Views, 3 Replies

Curved 3D Faces

Gentlemen, I need to create some complex curved 3D Faces with the .NET API however I have never done it before so I am unsure where to start. I have a series of points that I can connect with lines/arcs to create the outline of a curved 3D Face. How can I create a 3D face with these points? Can someone point me in the right direction or possibly link me some sample code?

 

EDIT:

It doesnt have to be a face. It can be any solid surface.

3 REPLIES 3
Message 2 of 4
Micaletti
in reply to: Micaletti

I have attached an image to hopefully better describe what I am trying to accomplish. The circles represent Point3d References. The lines and arcs represent the boundry of the curved face I am trying to create via the .NET API. The shape is not planar, and it cannot be swept or extruded because of it's shape. I feel like the first step would be to create a closed boundry using the points, but I am not sure which classes/methods to use.

 

face.jpg

Message 3 of 4
hgasty1001
in reply to: Micaletti

Hi,

 

That surface looks like a rulesurf (check for rulesurf command, and also tabsurf and edgesurf out in the Autocad help), but i'm not sure if a rulesurf can be created with a lofted surface (i'm not sure if a lofted surface can be mathematically equivalent to a rulesurf). But lofted surface can be created with the API, see this link Lofted Surfaces

 

Gaston Nunez

Message 4 of 4
Hallex
in reply to: Micaletti

Another way is using command edgesurf, tested in A2014:

        'ads_queueexpr
        ' A2010

        <DllImport("acad.exe", CharSet:=CharSet.Unicode, CallingConvention:=CallingConvention.Cdecl, EntryPoint:="ads_queueexpr")> _
        Private Shared Function ads_queueexpr(command As Byte()) As Integer
        End Function
        ' A2014
        '<DllImport("accore.dll", CharSet:=CharSet.Unicode, CallingConvention:=CallingConvention.Cdecl, EntryPoint:="ads_queueexpr")> _
        ''____________________________________________________________________
#Region "command Edgesurf"
        <CommandMethod("loope")> _
        Public Sub LoopGetEntity()
            Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
            Dim db As Database = doc.Database
            Dim ed As Editor = doc.Editor
            Dim hnds() As String = GetObjectHandles(doc, "Select curve: ")
            ed.Regen()
            Using tr As Transaction = doc.Database.TransactionManager.StartTransaction()
                Dim uEncode As New UnicodeEncoding()
                ads_queueexpr(uEncode.GetBytes("(Command ""_.edgesurf""" & "(handent " & """" & hnds(0) & """" & ")" _
                & "(handent " & """" & hnds(1) & """" & ")" & _
                "(handent " & """" & hnds(2) & """" & ")" _
                & "(handent " & """" & hnds(3) & """" & ")" & vbCr & ")"))

            End Using
        End Sub

        Private Shared Function GetObjectHandles(ByVal doc As Document, msg As String) As String()
            Dim ids As New List(Of ObjectId)
            Dim hnds As New List(Of String)
            Using tr As Transaction = doc.Database.TransactionManager.StartTransaction()
                Dim go As Boolean = True
                While go
                    go = False

                    Dim opt As New PromptEntityOptions(vbLf & msg)
                    Dim res As PromptEntityResult = doc.Editor.GetEntity(opt)

                    If res.Status = PromptStatus.OK Then
                        Dim exists As Boolean = False
                        For Each id As ObjectId In ids
                            If id = res.ObjectId Then
                                exists = True
                                Exit For
                            End If
                        Next

                        If Not exists Then
                            'Highlight
                            Dim ent As Entity = DirectCast(tr.GetObject(res.ObjectId, OpenMode.ForWrite), Entity)
                            Dim strhandle As String = ent.Handle.ToString()
                            ent.Highlight()
                            hnds.Add(strhandle)
                            ids.Add(res.ObjectId)
                            If hnds.Count > 4 Then go = False
                            go = True
                        End If
                    End If
                End While

                tr.Commit()
            End Using
            Return hnds.ToArray()

        End Function
#End Region

 

_____________________________________
C6309D9E0751D165D0934D0621DFF27919

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost