Author Topic: Is there a way to extract Z value in surface in specified X and Y  (Read 2276 times)

0 Members and 1 Guest are viewing this topic.

HasanCAD

  • Swamp Rat
  • Posts: 1422
in a surface how can extract Z value in exact point. Lets say we make a mesh 200x200


X= 0 Y= 0
X= 200 Y= 0
X= 400 Y= 0
.
.
.
X= 200 Y= 200
X= 400 Y= 200
X= 600 Y= 200
.
.
.
and so on

Is it possible?

Is there a problem in present my Idea?
Thanks for helping

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Is there a way to extract Z value in surface in specified X and Y
« Reply #1 on: August 21, 2012, 10:20:16 AM »
At a minimum, you will need three points to define a surface, and two points to define the line.  Look into vector math and calculating the intersection of a line and plane (I think there is a good paper on this by Bourke).
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

HasanCAD

  • Swamp Rat
  • Posts: 1422
Re: Is there a way to extract Z value in surface in specified X and Y
« Reply #2 on: August 21, 2012, 10:28:49 AM »
I need the opposite way
I have the surface and want extract the values

Faster

  • Guest
Re: Is there a way to extract Z value in surface in specified X and Y
« Reply #3 on: August 21, 2012, 10:36:03 AM »
in a surface how can extract Z value in exact point. Lets say we make a mesh 200x200


X= 0 Y= 0
X= 200 Y= 0
X= 400 Y= 0
.
.
.
X= 200 Y= 200
X= 400 Y= 200
X= 600 Y= 200
.
.
.
and so on

Is it possible?

Is there a problem in present my Idea?
Thanks for helping
Make a xline  through the point (X= 0 Y= 0 etc...),get the Intersections of xline and mesh with  vla-IntersectWith function. Extract Z value from Intersections.

HasanCAD

  • Swamp Rat
  • Posts: 1422
Re: Is there a way to extract Z value in surface in specified X and Y
« Reply #4 on: August 21, 2012, 01:01:05 PM »

Make a xline  through the point (X= 0 Y= 0 etc...),get the Intersections of xline and mesh with  vla-IntersectWith function. Extract Z value from Intersections.
Is there a way to get intersection between 3 objects?
My idea is (as attached there are regions at X & Y each 200mm and target Solid ) to insert a in intersection between the 3 of them them.

chlh_jd

  • Guest
Re: Is there a way to extract Z value in surface in specified X and Y
« Reply #5 on: August 21, 2012, 03:21:21 PM »
If the surface is plan , use trans method , else Use a plan though Z-Axis , and then cal the inters curve .
intersection of lines and planes http://www.theswamp.org/index.php?topic=36756.msg417643#msg417643
ClosestPointonPlane  http://www.theswamp.org/index.php?topic=36786.msg418082#msg418082
Getsection plan http://www.theswamp.org/index.php?topic=42478.msg476801#msg476801
« Last Edit: August 21, 2012, 03:53:36 PM by chlh_jd »

chlh_jd

  • Guest
Re: Is there a way to extract Z value in surface in specified X and Y
« Reply #6 on: August 21, 2012, 03:23:42 PM »
I think it can be done by simply method , but I don't know .
though Recursive

HasanCAD

  • Swamp Rat
  • Posts: 1422
Re: Is there a way to extract Z value in surface in specified X and Y
« Reply #7 on: August 22, 2012, 08:05:27 AM »
I got a solution

to create a section each 200 in vertical and horizontal then use http://www.lee-mac.com/intersectionfunctions.html to insert the block

The issue now how to create a sections (its around 400 section)
I created this code but not working
Code: [Select]
(defun c:sho (/)

  (setvar "OSNAPCOORD" 1)
  (setq ss (ssget))
 
  (while
    (setq pt (getpoint))
  (command "section" ss "" "YZ" pt)))

kruuger

  • Swamp Rat
  • Posts: 637
Re: Is there a way to extract Z value in surface in specified X and Y
« Reply #8 on: August 22, 2012, 08:37:13 AM »
I got a solution

to create a section each 200 in vertical and horizontal then use http://www.lee-mac.com/intersectionfunctions.html to insert the block

The issue now how to create a sections (its around 400 section)
I created this code but not working
Code: [Select]
(defun c:sho (/)

  (setvar "OSNAPCOORD" 1)
  (setq ss (ssget))
 
  (while
    (setq pt (getpoint))
  (command "section" ss "" "YZ" pt)))
working perfect on my side. on every click
k.

HasanCAD

  • Swamp Rat
  • Posts: 1422
Re: Is there a way to extract Z value in surface in specified X and Y
« Reply #9 on: August 22, 2012, 09:31:44 AM »
working perfect on my side. on every click
k.
Its working
Thanks krugger

HasanCAD

  • Swamp Rat
  • Posts: 1422
Re: Is there a way to extract Z value in surface in specified X and Y
« Reply #10 on: August 22, 2012, 09:42:10 AM »
All work done perfect

In extracting data step I want to renumber the block but its huge number of blocks
SO is there a lisp to renumber in sequence X then Y then Z direction?
 

HasanCAD

  • Swamp Rat
  • Posts: 1422
Re: Is there a way to extract Z value in surface in specified X and Y
« Reply #11 on: August 22, 2012, 09:51:06 AM »
This is CAD file

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Is there a way to extract Z value in surface in specified X and Y
« Reply #12 on: August 22, 2012, 10:42:57 AM »
Look into vl-sort to get the list in the correct order:
X
(vl-sort pts (function (lambda (x1 x2) (< (car x1) (car x2)))))
Y
(vl-sort pts (function (lambda (y1 y2) (< (cadr y1) (cadr y2)))))
Z
(vl-sort pts (function (lambda (z1 z2) (< (caddr z1) (caddr z2)))))
« Last Edit: August 23, 2012, 09:17:35 AM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Is there a way to extract Z value in surface in specified X and Y
« Reply #13 on: August 22, 2012, 12:45:18 PM »
This might help you as well:  :-)


Code - Auto/Visual Lisp: [Select]
  1. (defun c:foo (/ chk e e2 l n o out p ss)
  2.   (defun _listto3dpoints (lst / newlst)
  3.     (if lst
  4.       (while (setq newlst (cons (list (car lst) (cadr lst) (caddr lst)) newlst)
  5.                    lst    (cdddr lst)
  6.              )
  7.       )
  8.     )
  9.     (reverse newlst)
  10.   )
  11.   (if (and (setq e (car (entsel "\nSelect solid to section")))
  12.            (= (cdr (assoc 0 (entget e))) "3DSOLID")
  13.            (setq ss (ssget '((0 . "REGION,LWPOLYLINE"))))
  14.       )
  15.     (progn (setq n -1)
  16.            (while (setq e2 (ssname ss (setq n (1+ n))))
  17.              (setq chk (entlast))
  18.              (command "_section" e "" "object" e2 "")
  19.              (if (not (equal (entlast) chk))
  20.                (setq l (cons (vlax-ename->vla-object (entlast)) l))
  21.              )
  22.            )
  23.            (while (setq o (car l))
  24.              (mapcar (function (lambda (x)
  25.                                  (if (setq p (vlax-invoke o 'intersectwith x acextendnone))
  26.                                    (setq out (cons p out))
  27.                                  )
  28.                                )
  29.                      )
  30.                      l
  31.              )
  32.              (setq l (cdr l))
  33.              (vla-delete o)
  34.            )
  35.            (foreach p (_listto3dpoints (apply 'append out))
  36.              (entmakex (list (cons 0 "POINT") (cons 8 "_intersections") (cons 10 p)))
  37.            )
  38.     )
  39.   )
  40. )

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC