TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: FELIX on February 01, 2019, 02:17:15 PM

Title: Convert VLA-OBJECT IVector
Post by: FELIX on February 01, 2019, 02:17:15 PM
How to convert "VLA-OBJECT IVector"? Read your content.
Title: Re: Convert VLA-OBJECT IVector
Post by: Gemini on February 20, 2020, 07:08:24 AM
Check here:

http://www.theswamp.org/index.php?topic=38072.msg514709#msg514709
Title: Re: Convert VLA-OBJECT IVector
Post by: Rod on February 23, 2020, 06:13:05 PM
Hi Felix,
did you have any luck with this?
From memory the iVector contained a list of numerators and a list denominators that corresponded with degrees minutes and seconds

I copied this directly from the code I already posted https://www.theswamp.org/index.php?topic=38072.msg592382#msg592382 (https://www.theswamp.org/index.php?topic=38072.msg592382#msg592382)

Code - Auto/Visual Lisp: [Select]
  1. (defun getgpsvalue (vectorObj / Numlist Denomlist i numerator denominator dms dd)
  2.   (setq Numlist (getitemfromcollection vectorobj "Numerator"))
  3.   (setq Denomlist (getitemfromcollection vectorobj "Denominator"))
  4.   (setq i 0)
  5.   (repeat 3
  6.     (if (and (setq numerator (nth i Numlist))
  7.              (setq denominator (nth i Denomlist))
  8.              (not (zerop denominator))
  9.         ) ;_ end of and
  10.       (setq dms (cons (/ (float numerator) denominator) dms))
  11.       (setq dms (cons 0 dms))
  12.     ) ;_ end of if
  13.     (setq i (1+ i))
  14.   ) ;_ end of repeat
  15.   (setq dms (reverse dms))
  16.   (setq dd (getdecimaldegrees dms))
  17. ) ;_ end of defun

Cheers, Rod.
Title: Re: Convert VLA-OBJECT IVector
Post by: Rod on February 23, 2020, 06:14:59 PM
This may provide more info
https://docs.microsoft.com/en-us/previous-versions/windows/desktop/wiaaut/-wiaaut-rational (https://docs.microsoft.com/en-us/previous-versions/windows/desktop/wiaaut/-wiaaut-rational)