TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: lamarn 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
-
Quick example:
(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))
-
Speaking of Meshes, this is one if my favourite Mathematical surfaces :-)
(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))
-
Hi Lee Mac , nice work .
-
Hi Lee Mac , nice work .
Thanks Mr Devit :-)
-
Thank Lee mac,
The surface is not logical but the saddle looks nice !
-
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 :|
-
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?
-
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.
-
For example for 2x2:
(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
'((3 1 3)
(2 4 6)
(5 6 3)
(7 3 9)
;(7 5 7)
)
2 2)
(princ))