Author Topic: Creating list of points  (Read 3938 times)

0 Members and 1 Guest are viewing this topic.

HasanCAD

  • Swamp Rat
  • Posts: 1420
Creating list of points
« on: March 01, 2019, 01:14:14 AM »
Hi all
I am trying to get a list of perpanducular points of alligned objects
but the list comes in strage format

Code - Auto/Visual Lisp: [Select]
  1. (setq dtlst nil )
  2. (setq p1 (getpoint"\nPick Point"))
  3. (setq p2 (getpoint p1 "\nPick Point"))
  4.  
  5. (setq objs (ssget "_C" p1 p2 ))
  6.  
  7. (repeat (setq cnt (sslength objs))
  8.   (setq objVL (vlax-ename->vla-object (ssname objs (setq cnt (1- cnt)))))
  9.   (setq dtlst (cons ps p1n))
  10.   )


Quote
((((((((nil 20.2771 10.3859 0.0) 20.9515 9.64759 0.0) 21.6259 8.90925 0.0) 22.3004 8.1709 0.0) 22.9748 7.43256 0.0) 23.6492 6.69422 0.0) 24.3236 5.95587 0.0) 24.791 6.38282 0.0)

edit kdub : Topics Merged
« Last Edit: March 01, 2019, 10:22:26 AM by kdub »

CADwiesel

  • Newt
  • Posts: 46
  • Wir machen das Mögliche unmöglich
Re: Creating list of points
« Reply #1 on: March 01, 2019, 02:08:09 AM »
ssget normaly returns the objects in order they had been created.
you need to sort the points relative to P1 in the distance
Gruß
CADwiesel
Besucht uns im CHAT

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Creating list of points
« Reply #2 on: March 01, 2019, 03:08:26 AM »
The code cannot produce the supplied return I think. The variable 'ps' is nil throughout.

But this:
Code: [Select]
(setq dtlst (cons ps p1n))Should probably be:
Code: [Select]
(setq dtlst (cons p1n dtlst))

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Creating list of points
« Reply #3 on: March 01, 2019, 08:02:05 AM »
You calculate a point assigned to variable p1n, but construct the list dtlst using variable ps which is not defined in your posted code.

Code - Auto/Visual Lisp: [Select]
  1.   (setq dtlst (cons ps p1n))

HasanCAD

  • Swamp Rat
  • Posts: 1420
Re: Creating list of points
« Reply #4 on: March 01, 2019, 07:55:07 PM »
Thanks CADwiesel
Thanks roy_043
Thanks Lee

BIGAL

  • Swamp Rat
  • Posts: 1398
  • 40 + years of using Autocad
Re: Creating list of points
« Reply #5 on: March 02, 2019, 01:09:58 AM »
If you use the fence option in your ssget it will pick objects in order. you have pt1 pt2

Code: [Select]
(setq lst (list p1 p2))
(setq objs (ssget "F" lst (list (cons 0 "line"))))
A man who never made a mistake never made anything

HasanCAD

  • Swamp Rat
  • Posts: 1420
Re: Creating list of points
« Reply #6 on: March 05, 2019, 10:16:11 AM »
If you use the fence option in your ssget it will pick objects in order. you have pt1 pt2

Code: [Select]
(setq lst (list p1 p2))
(setq objs (ssget "F" lst (list (cons 0 "line"))))
Thanks BIGAL

Tharwat

  • Swamp Rat
  • Posts: 707
  • Hypersensitive
Re: Creating list of points
« Reply #7 on: March 05, 2019, 12:50:05 PM »
If you use the fence option in your ssget it will pick objects in order. you have pt1 pt2

Code: [Select]
(setq lst (list p1 p2))
(setq objs (ssget "F" lst (list (cons 0 "line"))))
Fence option will never detect hidden lines of example if the vector line of variables p1 & p2 passed through the empty gap of the line type.

BIGAL

  • Swamp Rat
  • Posts: 1398
  • 40 + years of using Autocad
Re: Creating list of points
« Reply #8 on: April 23, 2019, 06:19:38 AM »
Thanks Tharwat have had that happen in day to day stuff. Its another of those frustrating Autocad lisp bugs.
A man who never made a mistake never made anything

Tharwat

  • Swamp Rat
  • Posts: 707
  • Hypersensitive
Re: Creating list of points
« Reply #9 on: April 23, 2019, 09:46:32 AM »
Thanks Tharwat have had that happen in day to day stuff. Its another of those frustrating Autocad lisp bugs.
Its my pleasure.