Author Topic: vla-put-Coordinate  (Read 6875 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
vla-put-Coordinate
« on: May 09, 2009, 06:52:15 PM »
Hi Guys,

Just wondering how to use the above method?

I have been trying the follow, but to no avail:

Code: [Select]
(vla-put-Coordinate <vla-object>  (vlax-3D-point (list (car pt) (cadr pt))) <Int>)

Where <vla-object> is an LWPOLYLINE, and pt is a point, and <Int> is an Integer representing a vertex parameter.

But I keep getting the error:

"Lisp has no Coercion to VARIANT with this type: <variant8197>..."

Any help or advice is appreciated :)

Cheers

Lee

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: vla-put-Coordinate
« Reply #1 on: May 09, 2009, 07:01:06 PM »
You need to use vla-put-Coordinates
Note the s
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: vla-put-Coordinate
« Reply #2 on: May 09, 2009, 07:02:46 PM »
Is there no way to use

vla-put-Coordinate?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: vla-put-Coordinate
« Reply #3 on: May 09, 2009, 07:05:25 PM »
Oh, you want to update a single coordinate?

You need to use the coordinate number.
Code: [Select]
(vla-put-coordinate obj param# coord)

try this:
Code: [Select]
(vla-put-Coordinate <vla-object> <Int>  (vlax-3D-point (list (car pt) (cadr pt))))
« Last Edit: May 09, 2009, 07:09:40 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: vla-put-Coordinate
« Reply #4 on: May 09, 2009, 07:10:28 PM »
Sorry CAB, I don't quite follow you -

Is Coord a "variant" or just a list?

Also, is param# an integer?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: vla-put-Coordinate
« Reply #5 on: May 09, 2009, 07:33:35 PM »
just like you had it but the integer was in the wrong place.
Code: [Select]
(vla-put-Coordinate <vla-object> <Int>  (vlax-3D-point (list (car pt) (cadr pt))))
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: vla-put-Coordinate
« Reply #6 on: May 09, 2009, 07:52:16 PM »
Many thanks CAB  8-)

I needed to make a safearray and variant, as I realised it was a 2D point, not 3D - hence vlax-3D-point would not work.

But I did get it working   :lol:


Thanks   :-)

Lee



CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: vla-put-Coordinate
« Reply #7 on: May 09, 2009, 07:54:52 PM »
Great, I just got this to work.
Code: [Select]
(defun c:test(/ ent obj vlapt)
  (setq obj (vlax-ename->vla-object (car(entsel))))
  (setq vlapt (vlax-make-safearray vlax-vbdouble '(0 . 1)))
  (vlax-safearray-fill vlapt '(2 2))
  (vla-put-Coordinate obj 1  vlapt)
  )

As you say it's not a 3-d point. 8-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: vla-put-Coordinate
« Reply #8 on: May 09, 2009, 09:27:50 PM »
I think if you use the (vlax-get\vlax-put obj 'Coordinate\s) you don't have to supply a variant.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: vla-put-Coordinate
« Reply #9 on: May 10, 2009, 09:19:02 AM »
Thanks for the tip Ron  :-)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: vla-put-Coordinate
« Reply #10 on: May 10, 2009, 09:57:35 AM »
This works:
Code: [Select]
(vlax-get obj 'Coordinates) ; returns a point list
This does not:
Code: [Select]
(vlax-get obj 'Coordinate 1)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: vla-put-Coordinate
« Reply #11 on: May 10, 2009, 11:22:36 AM »
Yeah, the get/put shortcut does not work with this property. Another one of those cases you must use the "long way" to do something.