Jump to content

TIN Surface 3Dface


Eduardo Celiz

Recommended Posts

Hello, and being looking for information on how to obtain a specific elevation within a 3dface, I comment that I generated a surface conforming it by 3Dfaces and I am trying to be able to obtain a specific elevation by clicking (getpoint) in any internal part of the 3dfaces, I hope Can you help me with some idea of how to get what I require or if I am on the wrong path tell me what would be the correct procedure

Link to comment
Share on other sites

See if this suits you. Basically, the function finds the projection point on the 3dface entity, starting from a point located on the same x and y coordinates.

 

Immagine.thumb.png.9528745fe1f52bb6b2f31f6db28d67ff.png

 

;;; Syntax:
;;; (pointxface P1 fent)
;;;
;;; Arguments:
;;; P1 - point on Z=0
;;; fent - entity 3dFace
;;; 
;;; Retval:
;;; projection point on 3dface, if the projection of the point is outside the 3dface, the result will be nil 

(defun pointxface (P1 fent / vertice1 vertice2 vertice3 V1 V2 V3 D1 D2 D aa bb somma zeta puntoinalto)
 (setq vertice1	(cdr (assoc 10 (entget fent)))
       vertice2	(cdr (assoc 11 (entget fent)))
       vertice3	(cdr (assoc 12 (entget fent)))
       V1 (list (car vertice1)(cadr vertice1))
       V2 (list (car vertice2)(cadr vertice2))
       V3 (list (car vertice3)(cadr vertice3))
 )
 (setq D1 (- (* (- (car P1) (car V1)) (- (cadr V3) (cadr V1)))
	     (* (- (cadr P1) (cadr V1)) (- (car V3) (car V1)))
	  )
 )

 (setq D2 (- (* (- (car V1) (car P1)) (- (cadr V2) (cadr V1)))
	     (* (- (cadr V1) (cadr P1)) (- (car V2) (car V1)))
	  )
 )

 (setq D (- (* (- (car V2) (car V1)) (- (cadr V3) (cadr V1)))
	    (* (- (cadr V2) (cadr V1)) (- (car V3) (car V1)))
	 )
 )
 (setq aa (/ D1 D))
 (setq bb (/ D2 D))
 (setq somma (+ aa bb))

 (if (equal aa 0.00 0.000001)(setq aa 0.0))
 (if (equal bb 0.00 0.000001)(setq bb 0.0))
 (if (equal somma 1.0 0.000001)(setq somma 1.0))

 (if (and (>= aa 0.0) (>=  bb 0.0)(<= somma 1.0)) ;;; Se aa>=0 and bb>=0 and aa+bb<=1 allora P è interno al triangolo o sul bordo. Altrimenti è esterno
  (progn
   (setq zeta	     (/	(+ (-
			    (- (* (- (car P1) (car vertice1))
				  (- (*	(- (cadr vertice2) (cadr vertice1))
					(- (caddr vertice3) (caddr vertice1))
				     )
				     (*	(- (cadr vertice3) (cadr vertice1))
					(- (caddr vertice2) (caddr vertice1))
				     )
				  )
			       )
			       (* (- (cadr P1) (cadr vertice1))
				  (- (*	(- (car vertice2) (car vertice1))
					(- (caddr vertice3) (caddr vertice1))
				     )
				     (*	(- (car vertice3) (car vertice1))
					(- (caddr vertice2) (caddr vertice1))
				     )
				  )
			       )
			    )
			   )
			   (* (caddr vertice1)
			      (- (* (- (car vertice2) (car vertice1))
				    (- (cadr vertice3) (cadr vertice1))
				 )
				 (* (- (car vertice3) (car vertice1))
				    (- (cadr vertice2) (cadr vertice1))
				 )
			      )
			   )
			)
			(- (* (- (car vertice2) (car vertice1))
			    (- (cadr vertice3) (cadr vertice1))
			 )
			 (* (- (car vertice3) (car vertice1))
			    (- (cadr vertice2) (cadr vertice1))
			 )
		      )
		     )
	 puntoinalto (list (car P1) (cadr P1) zeta)
   )
  )
  (setq puntoinalto nil)
 )
 
 (princ "\n")
 puntoinalto
)

 

Edited by confutatis
  • Thanks 2
Link to comment
Share on other sites

Use civil3d create surface > add object > select 3d face > edit style surface > open point surface > explode point surface to autocad object or > create point by autocad point to get civil3d point

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...