<?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: Selecting only visible (not obscured) 3D faces in AutoCAD Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12594029#M20209</link>
    <description>&lt;P&gt;May want post here&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/civil-3d-forum/bd-p/66" target="_blank"&gt;https://forums.autodesk.com/t5/civil-3d-forum/bd-p/66&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Mar 2024 21:46:39 GMT</pubDate>
    <dc:creator>paullimapa</dc:creator>
    <dc:date>2024-03-01T21:46:39Z</dc:date>
    <item>
      <title>Selecting only visible (not obscured) 3D faces</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12593814#M20208</link>
      <description>&lt;P&gt;I work in mining, where we can get 3D objects representing overburden / clay / ore bodies / etc. Most of the time these are represented as 3D faces that represent a watertight solid (for lack of a better description).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We would like to represent these objects in Civil 3D as top and bottom surfaces but the best workflow I can currently think of is to use a visual style that shades the surfaces and then manually select them. Not an efficient process.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a workflow or a tool that will allow the selection of only the top/visible 3D faces? I've posted a screenshot below and provided an example drawing.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jbokic2F9MM_0-1709320605241.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1332429i7BCF0AF7FD69622C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jbokic2F9MM_0-1709320605241.png" alt="jbokic2F9MM_0-1709320605241.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2024 19:18:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12593814#M20208</guid>
      <dc:creator>jbokic2F9MM</dc:creator>
      <dc:date>2024-03-01T19:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting only visible (not obscured) 3D faces</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12594029#M20209</link>
      <description>&lt;P&gt;May want post here&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/civil-3d-forum/bd-p/66" target="_blank"&gt;https://forums.autodesk.com/t5/civil-3d-forum/bd-p/66&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2024 21:46:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12594029#M20209</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2024-03-01T21:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting only visible (not obscured) 3D faces</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12594165#M20210</link>
      <description>&lt;P&gt;Thanks paullimapa&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1137264" target="_self"&gt;&lt;SPAN class=""&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN class=""&gt;I will if nobody here knows of a solution but the separation of surfaces seemed more of an AutoCAD than Civil 3D issue.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Mar 2024 18:45:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12594165#M20210</guid>
      <dc:creator>jbokic2F9MM</dc:creator>
      <dc:date>2024-03-10T18:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting only visible (not obscured) 3D faces</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12608513#M20211</link>
      <description>&lt;P&gt;The following&amp;nbsp;program changes the layer of selected 3dfaces that are facing you.&amp;nbsp; I've done minimal testing on the file you posted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;;Changes the layer of seleted 3dfaces that
;are facig towards you.
;L. Minardi 3/2/2024
(defun c:FacingMe (/)
  (setq	lay (getstring "\nEnter a layer name: ")
	ss  (ssget '((0 . "3dface")))
	i   0
  )
  (command "_ucs" "V")
  (while (setq en (ssname ss i))
    (setq ed	     (entget en)
	  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))
	  v12	     (mapcar '- pt2 pt1)
	  v13	     (mapcar '- pt3 pt1)
	  FaceNormal (cross v13 v12)
    )
    (setq viewNormal (trans '(0 0 1) 1 0))
    (setq vis (dot FaceNormal viewNormal))
    (if	(&amp;gt; vis 0.)
      (progn
	;(princ "\nVisble")
	(if
	  (not (tblsearch "layer" lay))
	   (command "_.-layer" "_n" lay "")
	   (command "_chprop" en "" "_LA" lay "")
	)
      )
    )
    (setq i (+ i 1))
  )					; end while
  (command "ucs" "p")
  (princ)
)
;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)))
)					;end of dot&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 02 Mar 2024 21:52:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12608513#M20211</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2024-03-02T21:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting only visible (not obscured) 3D faces</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12630920#M20212</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/822616"&gt;@leeminardi&lt;/a&gt;&amp;nbsp;thank you that works brilliantly!&amp;nbsp; Does this work as the 3D faces are based on the right hand rule or is it for a different reason?&lt;/P&gt;</description>
      <pubDate>Sun, 10 Mar 2024 22:51:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12630920#M20212</guid>
      <dc:creator>jbokic2F9MM</dc:creator>
      <dc:date>2024-03-10T22:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting only visible (not obscured) 3D faces</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12631468#M20213</link>
      <description>&lt;P&gt;See the Normals utility on Autodesk Apps:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://apps.autodesk.com/ACD/en/Detail/Index?id=6799700742884340036&amp;amp;appLang=en&amp;amp;os=Win32_64" target="_blank"&gt;https://apps.autodesk.com/ACD/en/Detail/Index?id=6799700742884340036&amp;amp;appLang=en&amp;amp;os=Win32_64&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Vladimir Michl, &lt;A href="http://www.arkance-systems.cz" target="_blank"&gt;www.arkance-systems.cz&lt;/A&gt;&amp;nbsp; -&amp;nbsp; &lt;A href="http://www.cadforum.cz" target="_blank"&gt;www.cadforum.cz&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 06:58:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12631468#M20213</guid>
      <dc:creator>vladimir_michl</dc:creator>
      <dc:date>2024-03-11T06:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting only visible (not obscured) 3D faces</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12631956#M20214</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7892262"&gt;@jbokic2F9MM&lt;/a&gt;&amp;nbsp;yes, using the right-hand-rule the face normals in your model consistently pointed inward. Looking at the sign of the dot product of the normal with a vector perpendicular to the screen is used to determine if the face is visible. I'm glad that you found the program helpful.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 11:26:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12631956#M20214</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2024-03-11T11:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting only visible (not obscured) 3D faces</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12632645#M20215</link>
      <description>&lt;P&gt;That helped tremendously, would never have thought of that until seeing your code.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 15:52:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12632645#M20215</guid>
      <dc:creator>jbokic2F9MM</dc:creator>
      <dc:date>2024-03-11T15:52:54Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting only visible (not obscured) 3D faces</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12632646#M20216</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/239200"&gt;@vladimir_michl&lt;/a&gt;&amp;nbsp;, this also looks like a good solution.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 15:53:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12632646#M20216</guid>
      <dc:creator>jbokic2F9MM</dc:creator>
      <dc:date>2024-03-11T15:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting only visible (not obscured) 3D faces</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12853259#M20217</link>
      <description>&lt;P&gt;A very useful lisp, thanks.&lt;BR /&gt;Only thing is, that it filters the faces of the opposite side from the view direction (the bottom ones, if the view is from the top).&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2024 09:10:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12853259#M20217</guid>
      <dc:creator>robert06</dc:creator>
      <dc:date>2024-06-21T09:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting only visible (not obscured) 3D faces</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12853287#M20218</link>
      <description>&lt;P&gt;Correction provided by ChatGPT&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Summary of Changes:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Fixed the cross product calculation to ensure the correct face normal direction.&lt;/LI&gt;&lt;LI&gt;Modified the dot product calculation to correctly sum the products of the components.&lt;/LI&gt;&lt;LI&gt;Adjusted the order of vector subtraction to ensure proper calculation of face normals.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;(defun c:FacingMe (/ lay ss i en ed pt1 pt2 pt3 pt4 v12 v13 FaceNormal viewNormal vis)&lt;BR /&gt;(setq lay (getstring "\nEnter a layer name: ")&lt;BR /&gt;ss (ssget '((0 . "3DFACE")))&lt;BR /&gt;i 0&lt;BR /&gt;)&lt;BR /&gt;(command "_ucs" "V")&lt;BR /&gt;(while (setq en (ssname ss i))&lt;BR /&gt;(setq ed (entget en)&lt;BR /&gt;pt1 (cdr (assoc 10 ed)) ;get points of 3DFACE from entity data&lt;BR /&gt;pt2 (cdr (assoc 11 ed))&lt;BR /&gt;pt3 (cdr (assoc 12 ed))&lt;BR /&gt;pt4 (cdr (assoc 13 ed))&lt;BR /&gt;v12 (mapcar '- pt2 pt1)&lt;BR /&gt;v13 (mapcar '- pt3 pt1)&lt;BR /&gt;FaceNormal (cross v12 v13) ; calculate face normal&lt;BR /&gt;)&lt;BR /&gt;(setq viewNormal (trans '(0 0 1) 1 0)) ; view normal in WCS&lt;BR /&gt;(setq vis (dot FaceNormal viewNormal))&lt;BR /&gt;(if (&amp;gt; vis 0.)&lt;BR /&gt;(progn&lt;BR /&gt;;(princ "\nVisible")&lt;BR /&gt;(if (not (tblsearch "layer" lay))&lt;BR /&gt;(command "_.-layer" "_n" lay "")&lt;BR /&gt;(command "_chprop" en "" "_LA" lay "")&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(setq i (+ i 1))&lt;BR /&gt;) ; end while&lt;BR /&gt;(command "ucs" "p")&lt;BR /&gt;(princ)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;;cross product&lt;BR /&gt;(defun cross (a b / crs)&lt;BR /&gt;(setq crs (list&lt;BR /&gt;(- (* (nth 1 a) (nth 2 b)) (* (nth 1 b) (nth 2 a)))&lt;BR /&gt;(- (* (nth 2 a) (nth 0 b)) (* (nth 2 b) (nth 0 a)))&lt;BR /&gt;(- (* (nth 0 a) (nth 1 b)) (* (nth 0 b) (nth 1 a)))&lt;BR /&gt;) ;end list&lt;BR /&gt;) ;end setq crs&lt;BR /&gt;) ;end cross&lt;/P&gt;&lt;P&gt;;Dot Product&lt;BR /&gt;(defun dot (a b / dd)&lt;BR /&gt;(setq dd (mapcar '* a b))&lt;BR /&gt;(apply '+ dd)&lt;BR /&gt;) ;end of dot&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2024 09:34:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/selecting-only-visible-not-obscured-3d-faces/m-p/12853287#M20218</guid>
      <dc:creator>robert06</dc:creator>
      <dc:date>2024-06-21T09:34:56Z</dc:date>
    </item>
  </channel>
</rss>

