<?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: How to add point to a surface and detect Z coordinates? in AutoCAD Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11618104#M45980</link>
    <description>Hi,&lt;BR /&gt;I would want both functions if possible so I can share around the information.&lt;BR /&gt;We only have AutoCAD 2020 from the company.</description>
    <pubDate>Tue, 13 Dec 2022 20:21:28 GMT</pubDate>
    <dc:creator>jiahao.billy</dc:creator>
    <dc:date>2022-12-13T20:21:28Z</dc:date>
    <item>
      <title>How to add point to a surface and detect Z coordinates?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11615981#M45974</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have surveyor drawings come back to me with a modelled topography in AutoCAD. They do give me some points to show the level of the ground (height above sea).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jiahaobilly_0-1670902997019.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1151728iFF9C422A0494BB7E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jiahaobilly_0-1670902997019.png" alt="jiahaobilly_0-1670902997019.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jiahaobilly_1-1670903023033.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1151729iAF6255CC65B5A974/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jiahaobilly_1-1670903023033.png" alt="jiahaobilly_1-1670903023033.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jiahaobilly_2-1670903193045.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1151730i1BB2B853E8D53105/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jiahaobilly_2-1670903193045.png" alt="jiahaobilly_2-1670903193045.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The numbers in white are the levels done by the surveyor. The green Web is the 3D topography done accurately by the surveyor. The point they plot are EXACTLY the Z coordinates, eg, 24.05m above sea level on site is exactly Z = 24.05&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way for me to plot directly onto the topo surface and get the exact Z coordinate?&lt;/P&gt;&lt;P&gt;I have tried multiple methods, including making/using Z coordinate annotation blocks. They fail me when I use them on other projects.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a .lisp available for these type of situations?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 03:49:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11615981#M45974</guid>
      <dc:creator>jiahao.billy</dc:creator>
      <dc:date>2022-12-13T03:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to add point to a surface and detect Z coordinates?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11616163#M45975</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Honestly i did not catch your point !! Would you please clarify more your exact need ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 06:34:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11616163#M45975</guid>
      <dc:creator>imadHabash</dc:creator>
      <dc:date>2022-12-13T06:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to add point to a surface and detect Z coordinates?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11616248#M45976</link>
      <description>&lt;P&gt;Hi Billy,&lt;BR /&gt;If I understand you correctly, what you want is spot elevation labels. Or do you just want to see elevations as you hover your mouse over the surface? That is exactly what Civil 3D is designed to do. What version of AutoCAD do you have?&lt;BR /&gt;Dave&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-center" image-alt="Z_Hover_1.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1151783i59431F3B1C11B24F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Z_Hover_1.png" alt="Z_Hover_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 07:28:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11616248#M45976</guid>
      <dc:creator>Pointdump</dc:creator>
      <dc:date>2022-12-13T07:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to add point to a surface and detect Z coordinates?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11616344#M45977</link>
      <description>&lt;P&gt;I would make a tool in the tool palette :&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tramber_0-1670918791009.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1151805i7DB5F5957846E964/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tramber_0-1670918791009.png" alt="tramber_0-1670918791009.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And i would use this old fashion CAL, may i say 'CAL&lt;/P&gt;
&lt;P&gt;5 clics to go dans it is done.&lt;/P&gt;
&lt;P&gt;NB : you don't see the osnaps but it works&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;'cal;ilp(end,end,end,end,end);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&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="tramber_1-1670919001845.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1151809i2E4BFEF768C6391C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tramber_1-1670919001845.png" alt="tramber_1-1670919001845.png" /&gt;&lt;/span&gt;&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="tramber_2-1670919009472.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1151810i03ED9EF2D7ADC9CA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tramber_2-1670919009472.png" alt="tramber_2-1670919009472.png" /&gt;&lt;/span&gt;&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="tramber_3-1670919019933.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1151811i85D477AD95BEB0FA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tramber_3-1670919019933.png" alt="tramber_3-1670919019933.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can build modern surface, transforming a 3Dface (easy) and finding an interference, etc, but i like those old tools, it is strongeur than me.&lt;/P&gt;
&lt;P&gt;Have a look on CAL function and its ilp(p1,p2,p3,p4,p5) option&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 08:14:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11616344#M45977</guid>
      <dc:creator>tramber</dc:creator>
      <dc:date>2022-12-13T08:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to add point to a surface and detect Z coordinates?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11616346#M45978</link>
      <description>&lt;P&gt;OUPSSS !&lt;/P&gt;
&lt;P&gt;Sorry... replace EXT with END, English version ! I did it in the message. Should be possible with _END too.&lt;/P&gt;
&lt;P&gt;I am checking&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 08:15:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11616346#M45978</guid>
      <dc:creator>tramber</dc:creator>
      <dc:date>2022-12-13T08:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to add point to a surface and detect Z coordinates?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11618093#M45979</link>
      <description>&lt;P&gt;Hello, sorry for the bad English, not my strong language &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So in short, I want to find the Z coordinate on any point of the 3D surface. How am I able to plot this point on the surface with annotations suggesting the Z coordinates?&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 20:16:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11618093#M45979</guid>
      <dc:creator>jiahao.billy</dc:creator>
      <dc:date>2022-12-13T20:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to add point to a surface and detect Z coordinates?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11618104#M45980</link>
      <description>Hi,&lt;BR /&gt;I would want both functions if possible so I can share around the information.&lt;BR /&gt;We only have AutoCAD 2020 from the company.</description>
      <pubDate>Tue, 13 Dec 2022 20:21:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11618104#M45980</guid>
      <dc:creator>jiahao.billy</dc:creator>
      <dc:date>2022-12-13T20:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to add point to a surface and detect Z coordinates?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11618136#M45981</link>
      <description>Hi thanks for the help!&lt;BR /&gt;Sorry I am a bit new to AutoCAD and is confused on where I could create this tool in the tool palette. Do I select the 3D face when creating the tool?</description>
      <pubDate>Tue, 13 Dec 2022 20:34:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11618136#M45981</guid>
      <dc:creator>jiahao.billy</dc:creator>
      <dc:date>2022-12-13T20:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to add point to a surface and detect Z coordinates?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11619094#M45982</link>
      <description>&lt;P&gt;You will see for the button when you will be able to understand !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to invoque a command like LINE or whatever asking for a point.&lt;/P&gt;
&lt;P&gt;Then call 'CAL (' allows what we call the "transparency", write 'CAL and not CAL)&lt;/P&gt;
&lt;P&gt;And write your own ILP&lt;/P&gt;
&lt;P&gt;&lt;A href="https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2019/ENU/AutoCAD-Core/files/GUID-BF2773C6-0DA2-4A2C-86F4-EBDB30E4D464-htm.html" target="_blank"&gt;https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2019/ENU/AutoCAD-Core/files/GUID-BF2773C6-0DA2-4A2C-86F4-EBDB30E4D464-htm.html&amp;nbsp;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;So you see if it works and if it is convenient. It is an old fashioned solution with no lisp or construction.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;ilp(end,end,end,end,end);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you will help you making a button&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;(My variable INPUTHISTORYMODE is set to 0 so that i can call and call again what was written by me with the up arrow of the keyboard. In other words i can test this formula easily many times be "re"-calling it several times.)&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 08:10:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11619094#M45982</guid>
      <dc:creator>tramber</dc:creator>
      <dc:date>2022-12-14T08:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to add point to a surface and detect Z coordinates?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11628132#M45983</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7317129"&gt;@jiahao.billy&lt;/a&gt;&amp;nbsp; &amp;nbsp;I thought I would try to reproduce with VLISP the Civil 3D program feature of being able to pick points on&amp;nbsp; a TIN and get the spot elevation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following program enables you to add points and elevation values at picked locations on a collection of 3DFACEs.&amp;nbsp; &amp;nbsp;The program prompts you to select a collection of 3DFACEs and then the user can pick any point to add a point on a 3DFACE with text that notes its elevation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In writing the program I needed a routine to determine if a point was within the bounds of a triangle. I could not find any that I liked so I wrote my own.&amp;nbsp; At first I thought it necessary to determine if a point was outside, on a triangle vertex, triangle edge, or fully within the bounds of the triangle.&amp;nbsp; I later determined that the point on an edge distinction was not necessary.&amp;nbsp; As a result there are unnecessary elements still in the code related to edge detection.&amp;nbsp; The program could be more made more efficient but some testing indicates that it is very reliable.&amp;nbsp; One major assumption that could affect results is&amp;nbsp; that &lt;U&gt;the first three vertices&lt;/U&gt; of a 3DFACE are used to determine its geometry. The code could be modified to look at all four 3DFACE vertices to determine which three form a true triangle.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a sample of the output.&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="leeminardi_0-1671376889376.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1153898i68C116CB52AE2E12/image-size/medium?v=v2&amp;amp;px=400" role="button" title="leeminardi_0-1671376889376.png" alt="leeminardi_0-1671376889376.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; Working in the top view, a user specifies a point location which is then
; projected to a 3DFACE above it. A point, and text of the z value, is added
; on the 3DFACE. One or more 3DFACES may be used to define the surface.
;
; L. Minardi 12/18/2022
		
(defun c:SpotElev (/ ss numsel i pt ed pt1 pt2 pt3 w ElevText )
(setup)
(princ "\nSelect one or more 3DFaces.")
(setq ss (ssget '((0 . "3dface"))))
(setq numsel (sslength ss))  
(setq i 0)
(setq pt (getpoint "\nEnter a point from the top view."))  
(while (&amp;lt; i numsel)
  (setq	ed  (entget (ssname ss i))
	pt1 (cdr (assoc 10 ed))		;get points of 3DFACE from entity data
	pt2 (cdr (assoc 11 ed))
	pt3 (cdr (assoc 12 ed))
	;  pt4  (cdr (assoc 13 ed))
  )
  (setq w (PtInTriangle pt1 pt2 pt3 pt)) ; Determine if point is inside current 3DFACE
  (cond
    ((= w 0) (setq i (1+ i)))		; point outside triangle
    ((= w 1) (setq PtOnFace (FullyInside)))
    ((= (car w) 2) (setq PtOnFace (cadr w))) ; point at 3DFACE vertex
    ((= (car w) 3) (setq PtOnFace (FullyInside)))
  )					; end cond
  (if (and (= w 0) (= i numsel))
    (progn
      (princ "\nNo intersection with a 3DFACE.")
      (setq pt (getpoint "\nEnter another point over a 3DFACE or [ENter] to exit.")
            i	 0
      )
  )
  )
  (if (/= w 0)
    (progn
      (setq ElevText (rtos (caddr PtOnFace)))
      (command "_point" ptOnFace)
      (command "_text" "J" "BL" ptOnFace "" "" ElevText)
      (setq pt (getpoint "\nEnter another point or [Enter] to exit.")
            i   0
      )
      (if (= pt nil) (setq i numsel))  ; quit
    )
 )
) ; end while
  (cleanup)
  (princ)
)					;end qq

(defun FullyInside ( / )
      (setq v12	(mapcar '- pt2 pt1)
	    b	(distance '(0. 0. 0.) v12)
      )
      (if (equal b 0.0 0.00001)
	(setq u12 '(0. 0. 0.))
	(setq u12 (mapcar '/ v12 (list b b b)))
					; unit vector from pt1 to pt2
      )
      (setq vn	(cross u12 (mapcar '- pt3 pt1))
	    b	(distance '(0 0 0) vn)
	    uvn	(mapcar '/ vn (list b b b))
					; unit normal vector to face
      )
      (if (&amp;lt; (dot uvn '(0 0 1)) 0)
	(setq uvn (mapcar '* uvn '(-1 -1 -1)))
					; make sure normal vector z component points up
      )
      (setq d (dot (mapcar '- pt1 pt) uvn))
      (setq magvz (/ d (caddr uvn)))	; z coordinate of point on face
      (setq
	ptOnFace (mapcar '+ pt (mapcar '* '(0 0 1) (list 0 0 magvz)))
      )					; point on face
)

; Determine if point pt is inside triangle defined by
; points pt1 pt2 pt3
; Returns
; 0 : if point outside triangle
; 1 : if point fully inside triangle
; 2 and point  ; if point at triangle  vertex
; 3 and two points ; if point on edge between the two points  
; L. Minardi 12/14/2022
(defun PtInTriangle (pt1 pt2 pt3 pt / ptfarright ptfarleft i j )
(setq i	0 j 0 )
(setq ptfarright (list 1000000.0 (cadr pt))
      ptfarleft	 (list -1000000.0 (cadr pt))
)
(if (inters PT ptfarright PT1 PT2)
  (setq i (1+ i))
)
(if (inters PT ptfarright PT2 PT3)
  (setq i (1+ i))
)
(if (inters PT ptfarright PT3 PT1)
  (setq i (1+ i))
)
(if (inters PT ptfarleft PT1 PT2)
  (setq j (1+ j))
)
(if (inters PT ptfarleft PT2 PT3)
  (setq j (1+ j))
)
(if (inters PT ptfarleft PT3 PT1)
  (setq j (1+ j))
)

(cond ((or				; if outside set w = 0
	 (and (= i 0) (= j 0))
	 (and (= i 2) (= j 0))
	 (and (= i 0) (= j 2))
       )
       (setq w 0)  ; point is OUTSIDE
      )					

      ((equal pt1 pt 0.01)		; if at vertex set w = 2 and point
       (setq w (list 2 pt1))
      )
      ((equal pt2 pt 0.01)
       (setq w (list 2 pt2))
      )
      ((equal pt3 pt 0.01)
       (setq w (list 2 pt3))
      )
      (setq w 1)
;;;;;;      ((PtsInLine pt1 pt2 pt)  ; if on edge set w = 3 and two points
;;;;;;       (setq w (list 3 pt1 pt2)))
;;;;;;      ((PtsInLine pt2 pt3 pt)
;;;;;;       (setq w (list 3 pt2 pt3)))
;;;;;;      ((PtsInLine pt3 pt1 pt)
;;;;;;       (setq w (list 3 pt3 pt1)))
;;;;;;      ((or (= i 1) (= j 1)) (setq w 1)) ; if interior set w = 1
)
  )

(defun setup (/)
  (setq osm (getvar "osmode"))
  (setvar "osmode" 0)
  (setvar "cmdecho" 0)
  (command "UCS" "W")
)					;end setup

(defun cleanup (/)
  (setvar "osmode" osm)
  (setvar "cmdecho" 1)
  (princ)
)					;end cleanup

; cross product
(defun cross (a b / crs)
  (setq	crs (list
	      (- (* (nth 1 a) (nth 2 b))
		 (* (nth 1 b) (nth 2 a))
	      )
	      (- (* (nth 0 b) (nth 2 a))
		 (* (nth 0 a) (nth 2 b))
	      )
	      (- (* (nth 0 a) (nth 1 b))
		 (* (nth 0 b) (nth 1 a))
	      )
	    )				;end list
  )					;end setq c
)					;end cross

; dot product
(defun dot (a b / dd)
  (setq dd (mapcar '* a b))
  (setq dd (+ (nth 0 dd) (nth 1 dd) (nth 2 dd)))
)					

;  unit vector
(defun unitv (v / d)
  (setq d (distance '(0 0 0) v))
  (if (equal d 0.0 1e-9) nil (mapcar '/ v (list d d d)))
)

; Determines if 3 points are in a line, nil if not
(defun PtsInLine (p1 p2 p3 / a)
 (setq ans (abs (dot (unitv (mapcar '- p1 p2)) (unitv (mapcar '- p1 p3)))))
  (if (equal (abs (dot (unitv (mapcar '- p1 p2)) (unitv (mapcar '- p1 p3)))) 1.0 1e-9)
    (setq a 1)
    (setq a nil)
  )
)


&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 18 Dec 2022 15:28:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11628132#M45983</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2022-12-18T15:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to add point to a surface and detect Z coordinates?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11628509#M45984</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp;&lt;/P&gt;&lt;P&gt;This worked perfectly!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would first have to EXPLODE my topo plans before I could detect the faces.&lt;/P&gt;&lt;P&gt;I had a look at the code and I couldn't fully understand the magic behind it. Hopefully I'll learn it in the years to come &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Dec 2022 23:05:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11628509#M45984</guid>
      <dc:creator>jiahao.billy</dc:creator>
      <dc:date>2022-12-18T23:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to add point to a surface and detect Z coordinates?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11628513#M45985</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for the late reply, was away on holiday &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have tested this this morning, seems to be working but requires me to be in 3D View.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/822616"&gt;@leeminardi&lt;/a&gt; has made a VLISP which reproduces&amp;nbsp;&lt;SPAN&gt;the Civil 3D program feature of being able to pick points on a TIN and get the spot elevation.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks again for the help!&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Dec 2022 23:08:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11628513#M45985</guid>
      <dc:creator>jiahao.billy</dc:creator>
      <dc:date>2022-12-18T23:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to add point to a surface and detect Z coordinates?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11628675#M45986</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7317129"&gt;@jiahao.billy&lt;/a&gt;&amp;nbsp;you are welcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You said "...&lt;SPAN&gt;but requires me to be in 3D View".&amp;nbsp; &amp;nbsp;It works fine for me when picking points in the top view and the WCS is acrive.&amp;nbsp; &amp;nbsp;I don't know what you mean by "3D View".&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 02:19:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11628675#M45986</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2022-12-19T02:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to add point to a surface and detect Z coordinates?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11628691#M45987</link>
      <description>&lt;P&gt;Ah sorry, I was replying to&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/62037"&gt;@tramber&lt;/a&gt;&amp;nbsp;about his method of plotting the points for Z axis.&lt;/P&gt;&lt;P&gt;His method requires me to be in a 3D view instead of 'top view'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apologies for confusion, I come from Rhino so my head isn't getting around AutoCAD terminology&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 02:34:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/how-to-add-point-to-a-surface-and-detect-z-coordinates/m-p/11628691#M45987</guid>
      <dc:creator>jiahao.billy</dc:creator>
      <dc:date>2022-12-19T02:34:23Z</dc:date>
    </item>
  </channel>
</rss>

