Author Topic: Mesh from listed x,y,z  (Read 1404 times)

0 Members and 1 Guest are viewing this topic.

lamarn

  • Swamp Rat
  • Posts: 601
Mesh from listed x,y,z
« on: November 18, 2009, 03:44:08 PM »
I'm looking for a way to make a surface,mesh for the points listed below?
Does anybody have a clue how to to this in Autocad (.. not Civil or MAP)?
Is it possible?

Thanks in regard

x,y,z
187102.50,420037.50,3.42
187107.50,420037.50,3.40
187112.50,420037.50,3.39
187097.50,420042.50,3.55
187102.50,420042.50,3.38
187107.50,420042.50,3.39
187112.50,420042.50,3.44
187097.50,420047.50,3.45
187102.50,420047.50,3.38
187107.50,420047.50,3.40
187112.50,420047.50,3.55
187097.50,420052.50,3.61
187102.50,420052.50,3.65
187107.50,420052.50,3.45
187092.50,420057.50,3.40
187097.50,420057.50,3.42
187102.50,420057.50,3.51
187107.50,420057.50,3.58
187092.50,420062.50,3.54
187097.50,420062.50,3.49
Design is something you should do with both hands. My 2d hand , my 3d hand ..

Lee Mac

  • Seagull
  • Posts: 12270
  • London, England
Re: Mesh from listed x,y,z
« Reply #1 on: November 18, 2009, 05:36:34 PM »
Quick example:

Code: [Select]
(defun Mk_mesh (lst m n)
  (vl-load-com)

  (vla-add3DMesh
    (vla-get-ModelSpace
      (vla-get-ActiveDocument
        (vlax-get-acad-object))) m n
    (vlax-make-variant
      (vlax-safearray-fill
        (vlax-make-safearray
          vlax-vbDouble (cons 0 (1- (* 3 m n))))
        (apply 'append lst)))))

(defun c:test ( )

  (Mk_mesh

    '(
      (187102.50 420037.50 3.42)
      (187107.50 420037.50 3.40)
      (187112.50 420037.50 3.39)
      (187097.50 420042.50 3.55)
      (187102.50 420042.50 3.38)
      (187107.50 420042.50 3.39)
      (187112.50 420042.50 3.44)
      (187097.50 420047.50 3.45)
      (187102.50 420047.50 3.38)
      (187107.50 420047.50 3.40)
      (187112.50 420047.50 3.55)
      (187097.50 420052.50 3.61)
      (187102.50 420052.50 3.65)
      (187107.50 420052.50 3.45)
      (187092.50 420057.50 3.40)
      (187097.50 420057.50 3.42)
      (187102.50 420057.50 3.51)
      (187107.50 420057.50 3.58)
      (187092.50 420062.50 3.54)
      (187097.50 420062.50 3.49)
     )

    5 4)

  (princ))

Lee Mac

  • Seagull
  • Posts: 12270
  • London, England
Re: Mesh from listed x,y,z
« Reply #2 on: November 18, 2009, 07:43:39 PM »
Speaking of Meshes, this is one if my favourite Mathematical surfaces   :-)

Code: [Select]
(defun c:saddle (/ xMin xMax yMin yMax xInc yInc x y lst)
  (vl-load-com)

  (setq xMin -10 xMax 10
        yMin -10 yMax 10

        xInc 1 yInc 1)

  (setq x (- xMin xInc))
  (while (<= (setq x (+ xInc x)) xMax)

    (setq y (- yMin yInc))
    (while (<= (setq y (+ yInc y)) yMax)

      (setq lst (append (list x y (- (* x x) (* y y))) lst))))

  (vla-add3Dmesh
    (vla-get-ModelSpace
      (vla-get-ActiveDocument
        (vlax-get-acad-object))) 21 21
    (vlax-make-variant
      (vlax-safearray-fill
        (vlax-make-safearray
          vlax-VbDouble
          (cons 0 (1- (fix (* (/ (1+ (- xMax xMin)) (float xInc))
                              (/ (1+ (- yMax yMin)) (float yInc)) 3))))) lst)))

  (princ))

DEVITG

  • Bull Frog
  • Posts: 426
Re: Mesh from listed x,y,z
« Reply #3 on: November 22, 2009, 06:50:30 PM »
Hi Lee Mac , nice work .
Location @ Córdoba Argentina<br /><br />using acad 2008 under win XP

Lee Mac

  • Seagull
  • Posts: 12270
  • London, England
Re: Mesh from listed x,y,z
« Reply #4 on: November 22, 2009, 07:06:39 PM »
Hi Lee Mac , nice work .


Thanks Mr Devit :-)

lamarn

  • Swamp Rat
  • Posts: 601
Re: Mesh from listed x,y,z
« Reply #5 on: November 23, 2009, 03:55:18 PM »
Thank Lee mac,
The surface is not logical but the saddle looks nice !
Design is something you should do with both hands. My 2d hand , my 3d hand ..

Lee Mac

  • Seagull
  • Posts: 12270
  • London, England
Re: Mesh from listed x,y,z
« Reply #6 on: November 23, 2009, 07:19:56 PM »
Thank Lee mac,
The surface is not logical but the saddle looks nice !

I did not know of the dimensions you wanted for the surface - so I guess 5x4  :|

lamarn

  • Swamp Rat
  • Posts: 601
Re: Mesh from listed x,y,z
« Reply #7 on: November 24, 2009, 04:51:47 PM »
I want to create a surface that is defined witg these points, for example

(x,y,z)

3,1,3
2,4,6
5,6,3
7,3,9
7,5,7

can you drape this surface with code?
 
Design is something you should do with both hands. My 2d hand , my 3d hand ..

Lee Mac

  • Seagull
  • Posts: 12270
  • London, England
Re: Mesh from listed x,y,z
« Reply #8 on: November 24, 2009, 04:56:26 PM »
There needs to be a number of points that has a factor that is greater than or equal to 2, - hence 5 points will not work... 4 will though.

Lee Mac

  • Seagull
  • Posts: 12270
  • London, England
Re: Mesh from listed x,y,z
« Reply #9 on: November 24, 2009, 05:14:09 PM »
For example for 2x2:

Code: [Select]
(defun Mk_mesh (lst m n)
  (vl-load-com)

  (vla-add3DMesh
    (vla-get-ModelSpace
      (vla-get-ActiveDocument
        (vlax-get-acad-object))) m n
    (vlax-make-variant
      (vlax-safearray-fill
        (vlax-make-safearray
          vlax-vbDouble (cons 0 (1- (* 3 m n))))
        (apply 'append lst)))))
Code: [Select]
(defun c:test ( )

  (Mk_mesh

    '((3 1 3)
      (2 4 6)
      (5 6 3)
      (7 3 9)
      ;(7 5 7)
      )

    2 2)

  (princ))