Author Topic: wipeout vertices list  (Read 2118 times)

0 Members and 1 Guest are viewing this topic.

domenicomaria

  • Swamp Rat
  • Posts: 725
wipeout vertices list
« on: December 19, 2023, 05:47:02 AM »
is there a simple way to get wipeout vertices list ?
(... I want to convert it in a solid hatch ...)
« Last Edit: December 19, 2023, 06:50:11 AM by domenicomaria »

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: wipeout vertices list
« Reply #1 on: December 19, 2023, 08:55:02 AM »

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: wipeout vertices list
« Reply #2 on: December 19, 2023, 11:05:48 AM »
before asking this question, I had already seen your code
and I asked myself: "is there a simpler way?" ...

(because I needed a quick solution)

... but maybe it's not too much complicated !

... and maybe I have to find the patience to read your explanation carefully ...

thank you

xdcad

  • Bull Frog
  • Posts: 493
Re: wipeout vertices list
« Reply #3 on: December 19, 2023, 11:57:04 AM »
before asking this question, I had already seen your code
and I asked myself: "is there a simpler way?" ...

(because I needed a quick solution)

... but maybe it's not too much complicated !

... and maybe I have to find the patience to read your explanation carefully ...

thank you

command: (xdrx-getpropertyvalue (entlast) "vertices")
((1590.98 1212.41 0.0) (1883.04 1445.99 0.0) (1969.33 1183.22 0.0) (2217.59 1297.35 0.0) (1873.75 887.261 0.0) (1328.13 826.212 0.0) (1590.98 1212.41 0.0))
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
https://github.com/xdcad
https://sourceforge.net/projects/xdrx-api-zip/
http://bbs.xdcad.net

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: wipeout vertices list
« Reply #4 on: December 19, 2023, 12:33:57 PM »
 @xdcad
 :-)

BIGAL

  • Swamp Rat
  • Posts: 1417
  • 40 + years of using Autocad
Re: wipeout vertices list
« Reply #5 on: December 19, 2023, 06:26:12 PM »
Do a (setq ent (entget (car (entsel)))) pick a wipeout it will reveal all the values required as suggested by Lee to work out the co-ords of the wipeout. I took the (14 . XYZ) points made a new pline moved it to correct co-ord then used the scale factor to make correct size, can then get the co-ords. Added to my to do list.
A man who never made a mistake never made anything

kozmos

  • Newt
  • Posts: 114
Re: wipeout vertices list
« Reply #6 on: December 20, 2023, 02:52:35 AM »
I have one in my Lib:
Code - Auto/Visual Lisp: [Select]
  1. (Defun TCGEOM-WipeoutVertice (wo / trp mxv DAT MAT P R U V X Y)
  2.   (Defun trp (m) (apply 'mapcar (cons 'list m)))
  3.   (Defun mxv (m v / R)
  4.     (mapcar (function (lambda (r) (apply '+ (mapcar '* r v))))
  5.             m
  6.     )
  7.   )
  8.   (setq dat (entget wo)
  9.         u   (cdr (assoc 11 dat))
  10.         v   (cdr (assoc 12 dat))
  11.         mat (list u (mapcar '- v) '(0. 0. 1.))
  12.   )
  13.   (mapcar
  14.     (function
  15.       (lambda (p)
  16.         (mapcar '+
  17.                 (mxv (trp mat) p)
  18.                 (mapcar (function (lambda (x y) (/ (+ x y) 2.))) u v)
  19.                 (cdr (assoc 10 dat))
  20.         )
  21.       )
  22.     )
  23.     (cdr
  24.       (mapcar 'cdr
  25.               (vl-remove-if-not
  26.                 (function (lambda (x) (= (car x) 14)))
  27.                 dat
  28.               )
  29.       )
  30.     )
  31.   )
  32. )
  33.  
KozMos Inc.

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: wipeout vertices list
« Reply #7 on: December 20, 2023, 03:22:27 AM »
@kozmos
your code works !

I just need to close the list of points (add the first point to the end)

I will study your code anyway

Thank you

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: wipeout vertices list
« Reply #8 on: December 20, 2023, 04:53:27 AM »
and thanks also to Bigal for the suggestions...

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: wipeout vertices list
« Reply #9 on: December 20, 2023, 05:37:50 AM »
This was what I had in my library - not quite as elegant as kozmos' variant -
Code - Auto/Visual Lisp: [Select]
  1. ;; Wipeout Boundary  -  Lee Mac
  2. ;; Returns a list of WCS points defining the boundary of a wipeout
  3.  
  4. (defun LM:wipeoutboundary ( ent / cen enx lst mat )
  5.     (setq enx (entget ent)
  6.           lst (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= 14 (car x))) enx))
  7.           cen (mapcar '+ (cdr (assoc 10 enx)) (mapcar '* (mapcar '+ (cdr (assoc 11 enx)) (cdr (assoc 12 enx))) '(0.5 0.5 0.5)))
  8.           mat (apply 'mapcar (cons 'list (list (cdr (assoc 11 enx)) (cdr (assoc 12 enx)) '(0.0 0.0 1.0))))
  9.     )
  10.     (mapcar '(lambda ( p ) (mapcar '+ cen (mxv mat (mapcar '* p '(1 -1 1)))))
  11.         (if (= 1 (cdr (assoc 71 enx)))
  12.             (list
  13.                 (car  lst)
  14.                 (list (caar  lst) (cadadr lst) 0.0)
  15.                 (cadr lst)
  16.                 (list (caadr lst) (cadar  lst) 0.0)
  17.             )
  18.             lst
  19.         )
  20.     )
  21. )
  22.  
  23. ;; Matrix x Vector  -  Vladimir Nesterovsky
  24. ;; Args: m - nxn matrix, v - vector in R^n
  25.  
  26. (defun mxv ( m v )
  27.     (mapcar '(lambda ( r ) (apply '+ (mapcar '* r v))) m)
  28. )