<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Getting 'normal vector' of non-planar surface in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/getting-normal-vector-of-non-planar-surface/m-p/9834630#M18119</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/553576"&gt;@R.Gerritsen4967&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have also tried to access the curve geometry of the edges of the surface (your 2nd link). But those curves don't seem to have anything like a 'normal' property.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Second link is only to see that it is possible to get Brep from Surface directly.&lt;/P&gt;</description>
    <pubDate>Fri, 30 Oct 2020 11:39:05 GMT</pubDate>
    <dc:creator>Alexander.Rivilis</dc:creator>
    <dc:date>2020-10-30T11:39:05Z</dc:date>
    <item>
      <title>Getting 'normal vector' of non-planar surface</title>
      <link>https://forums.autodesk.com/t5/net-forum/getting-normal-vector-of-non-planar-surface/m-p/9832440#M18113</link>
      <description>&lt;P&gt;I'm trying to indicate the direction for a thicken operation on a surface by drawing temporary vectors in the editor.&lt;/P&gt;&lt;P&gt;For planar surfaces I can use:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;surface.getplane.normal&lt;/LI-CODE&gt;&lt;P&gt;But (obviously) this does not work on non-planar surfaces.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to determine the direction for the thickening operation?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 14:11:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getting-normal-vector-of-non-planar-surface/m-p/9832440#M18113</guid>
      <dc:creator>R.Gerritsen4967</dc:creator>
      <dc:date>2020-10-29T14:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: Getting 'normal vector' of non-planar surface</title>
      <link>https://forums.autodesk.com/t5/net-forum/getting-normal-vector-of-non-planar-surface/m-p/9832673#M18114</link>
      <description>&lt;P&gt;Every point on surface has owned 'normal vector'. Maybe this article help you: &lt;A href="https://adndevblog.typepad.com/autocad/2012/07/retrieving-a-solid3d-face-normal-through-brep-api.html" target="_blank"&gt;https://adndevblog.typepad.com/autocad/2012/07/retrieving-a-solid3d-face-normal-through-brep-api.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 15:37:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getting-normal-vector-of-non-planar-surface/m-p/9832673#M18114</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2020-10-29T15:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: Getting 'normal vector' of non-planar surface</title>
      <link>https://forums.autodesk.com/t5/net-forum/getting-normal-vector-of-non-planar-surface/m-p/9832735#M18115</link>
      <description>&lt;P&gt;Thanks Alexander, I'll look into it.&lt;/P&gt;&lt;P&gt;Do you know a way to access the surface with the brep api?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 16:08:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getting-normal-vector-of-non-planar-surface/m-p/9832735#M18115</guid>
      <dc:creator>R.Gerritsen4967</dc:creator>
      <dc:date>2020-10-29T16:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: Getting 'normal vector' of non-planar surface</title>
      <link>https://forums.autodesk.com/t5/net-forum/getting-normal-vector-of-non-planar-surface/m-p/9832907#M18116</link>
      <description>&lt;P&gt;As far as I remember BREP API can work with Surface:&amp;nbsp;&lt;A href="https://adndevblog.typepad.com/autocad/2012/08/retrieving-native-curve-geometry-using-brep-api.html" target="_blank"&gt;https://adndevblog.typepad.com/autocad/2012/08/retrieving-native-curve-geometry-using-brep-api.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 17:29:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getting-normal-vector-of-non-planar-surface/m-p/9832907#M18116</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2020-10-29T17:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Getting 'normal vector' of non-planar surface</title>
      <link>https://forums.autodesk.com/t5/net-forum/getting-normal-vector-of-non-planar-surface/m-p/9832912#M18117</link>
      <description>&lt;P&gt;Other way is creating Solid3d from Surface with method&amp;nbsp; Solid3d.CreateFrom(...)&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 17:34:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getting-normal-vector-of-non-planar-surface/m-p/9832912#M18117</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2020-10-29T17:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Getting 'normal vector' of non-planar surface</title>
      <link>https://forums.autodesk.com/t5/net-forum/getting-normal-vector-of-non-planar-surface/m-p/9834610#M18118</link>
      <description>&lt;P&gt;Unfortunately this gives me an error.&lt;/P&gt;&lt;P&gt;However I've made some progression with the other links you provided.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of Solid3d.CreateFrom(...), i now use a temporary solid made with thicken from the surface. (because a surface does not seem to have a face)&lt;/P&gt;&lt;P&gt;Then I use a face (the original surface) of the temp solid to determine a normal vector of the edges.&lt;/P&gt;&lt;P&gt;But as far as I can see, all the edges have different normal vectors.&lt;/P&gt;&lt;P&gt;Only points on the surface(not on the edges) have a usable normal vector. but this normal vector is not always the real normal vector unfortunately...&lt;/P&gt;&lt;P&gt;My code is a real mess now, so I'll do some cleaning up and try to find a working solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also tried to access the curve geometry of the edges of the surface (your 2nd link). But those curves don't seem to have anything like a 'normal' property.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2020 11:31:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getting-normal-vector-of-non-planar-surface/m-p/9834610#M18118</guid>
      <dc:creator>R.Gerritsen4967</dc:creator>
      <dc:date>2020-10-30T11:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Getting 'normal vector' of non-planar surface</title>
      <link>https://forums.autodesk.com/t5/net-forum/getting-normal-vector-of-non-planar-surface/m-p/9834630#M18119</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/553576"&gt;@R.Gerritsen4967&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have also tried to access the curve geometry of the edges of the surface (your 2nd link). But those curves don't seem to have anything like a 'normal' property.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Second link is only to see that it is possible to get Brep from Surface directly.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2020 11:39:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getting-normal-vector-of-non-planar-surface/m-p/9834630#M18119</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2020-10-30T11:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Getting 'normal vector' of non-planar surface</title>
      <link>https://forums.autodesk.com/t5/net-forum/getting-normal-vector-of-non-planar-surface/m-p/9834676#M18120</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/481027"&gt;@Alexander.Rivilis&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;Brep from Surface directly.&lt;/BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Ok. Thanks. I guess I misunderstood...;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I have now solved the problem.&lt;/P&gt;&lt;P&gt;In a part of my code I was breaking down a surface into nurbs (according to &lt;A href="https://through-the-interface.typepad.com/through_the_interface/2011/02/gathering-points-defining-3d-autocad-geometry-using-net.html" target="_blank" rel="noopener"&gt;https://through-the-interface.typepad.com/through_the_interface/2011/02/gathering-points-defining-3d-autocad-geometry-using-net.html&lt;/A&gt; ) to access points across the surface.&lt;/P&gt;&lt;P&gt;I just found out that nurbs have a normal property which I can use directly.&lt;/P&gt;&lt;P&gt;So now I'm able to draw temp vectors in the direction of the surface 'normal'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vectors.png" style="width: 653px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/838417iE6B92FA1FC17BD05/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vectors.png" alt="vectors.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2020 12:03:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getting-normal-vector-of-non-planar-surface/m-p/9834676#M18120</guid>
      <dc:creator>R.Gerritsen4967</dc:creator>
      <dc:date>2020-10-30T12:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: Getting 'normal vector' of non-planar surface</title>
      <link>https://forums.autodesk.com/t5/net-forum/getting-normal-vector-of-non-planar-surface/m-p/9834805#M18121</link>
      <description>&lt;P&gt;OK, I cleaned up my code a bit.&lt;/P&gt;&lt;P&gt;Here is a function to draw temp vectors in the normal direction of a surface:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;&amp;lt;CommandMethod("THICKEN3D", CommandFlags.Modal)&amp;gt; Public Shared Sub THICKEN3D()
Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
Dim ed As Editor = doc.Editor
Dim db As Database = doc.Database
Dim peo As New PromptEntityOptions(vbLf &amp;amp; "Select surface:")
peo.SetRejectMessage(vbLf &amp;amp; "Needs to be a SURFACE!")
peo.AddAllowedClass(GetType(Autodesk.AutoCAD.DatabaseServices.Surface), True)
peo.AddAllowedClass(GetType(Autodesk.AutoCAD.DatabaseServices.PlaneSurface), True)
peo.AddAllowedClass(GetType(Autodesk.AutoCAD.DatabaseServices.ExtrudedSurface), True)
peo.AddAllowedClass(GetType(Autodesk.AutoCAD.DatabaseServices.SweptSurface), True)
peo.AddAllowedClass(GetType(Autodesk.AutoCAD.DatabaseServices.LoftedSurface), True)
peo.AddAllowedClass(GetType(Autodesk.AutoCAD.DatabaseServices.RevolvedSurface), True)
peo.AddAllowedClass(GetType(Autodesk.AutoCAD.DatabaseServices.NurbSurface), True)
Dim per As PromptEntityResult = ed.GetEntity(peo)
If per.Status &amp;lt;&amp;gt; PromptStatus.OK Then Return
        Using trx As Transaction = db.TransactionManager.StartTransaction()
            Dim btr As BlockTableRecord = TryCast(trx.GetObject(db.CurrentSpaceId, OpenMode.ForWrite), BlockTableRecord)
            Dim ent As Entity = TryCast(trx.GetObject(per.ObjectId, OpenMode.ForWrite), Entity)

            Dim solPlate As New Solid3d With {
                .RecordHistory = True
            }
            Dim Thickness As Double = Nothing

            If TypeOf ent Is Autodesk.AutoCAD.DatabaseServices.Surface Then
                Try
                    Dim srf As Autodesk.AutoCAD.DatabaseServices.Surface = TryCast(trx.GetObject(per.ObjectId, OpenMode.ForWrite), Autodesk.AutoCAD.DatabaseServices.Surface)
                    ExtrusionVectors(srf)

                    Thickness = SelDbl("Thickness: ")
                    If Thickness = Nothing Then Exit Sub

                    solPlate = srf.Thicken(Thickness, False)
                    btr.AppendEntity(solPlate)
                    trx.AddNewlyCreatedDBObject(solPlate, True)

                Catch ModelingFailure As Autodesk.AutoCAD.Runtime.Exception When ModelingFailure.Message = "eGeneralModelingFailure"
                    ed.WriteMessage(vbLf &amp;amp; "Probably a self-intersecting surface...")
                    trx.Abort()
                    Return

                End Try

            End If

            ent.Erase()
            trx.Commit()
        End Using
    End Sub

Public Shared Sub ExtrusionVectors(srf As Autodesk.AutoCAD.DatabaseServices.Surface)
        'https://through-the-interface.typepad.com/through_the_interface/2011/02/gathering-points-defining-3d-autocad-geometry-using-net.html

Dim ed As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Dim vec_size As Double = Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("VIEWSIZE") / 10 
Dim cross_size As Double = vec_size / 10
Dim nurbs As Autodesk.AutoCAD.DatabaseServices.NurbSurface() = srf.ConvertToNurbSurface

For Each nurb As Autodesk.AutoCAD.DatabaseServices.NurbSurface In nurbs
     Dim ustart As Double = nurb.UKnots.StartParameter, uend As Double = nurb.UKnots.EndParameter, uinc As Double = 2 * (uend - ustart) / nurb.UKnots.Count, vstart As Double = nurb.VKnots.StartParameter, vend As Double = nurb.VKnots.EndParameter, vinc As Double = 2 * (vend - vstart) / nurb.VKnots.Count
            Dim u As Double = ustart

            While u &amp;lt;= uend
                Dim v As Double = vstart

                While v &amp;lt;= vend
                    Dim vec As Vector3d = nurb.GetNormal(u, v) * vec_size
                    If Not vec = Nothing Then
                        Dim pt2 As Point3d = nurb.Evaluate(u, v).TransformBy(Matrix3d.Displacement(vec))
                        ed.DrawVector(nurb.Evaluate(u, v), pt2, 6, True)
                        ed.DrawVector(New Point3d(pt2.X - cross_size, pt2.Y - cross_size, pt2.Z), New Point3d(pt2.X + cross_size, pt2.Y + cross_size, pt2.Z), 6, False)
                        ed.DrawVector(New Point3d(pt2.X - cross_size, pt2.Y + cross_size, pt2.Z), New Point3d(pt2.X + cross_size, pt2.Y - cross_size, pt2.Z), 6, False)
                    End If

                    v += vinc
                End While

                u += uinc
            End While
        Next

    End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2020 12:58:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getting-normal-vector-of-non-planar-surface/m-p/9834805#M18121</guid>
      <dc:creator>R.Gerritsen4967</dc:creator>
      <dc:date>2020-10-30T12:58:11Z</dc:date>
    </item>
  </channel>
</rss>

