aloy Posted July 16, 2017 Share Posted July 16, 2017 Hello everybody, I have a set of about 1000 points covered in the window given in the code below with which I am trying to draw them in my drawing area. I find that they do not appear unless I Zoom Extent again. And when they appear the coordinates that appear are outside the limits. Can someone help me to get the points on screen without zooming again. (defun C:drawpoints ( / list1 pt1) (setq p1 '(3800.00 1000.0) p2 '(4400.0 1300.0)) (command "limits" p1 p2) (command "zoom" "E") (setq list1 pl pt1 (car list1)) (while (/= pt1 nil) (setq pt1 (car list1)) (command "point" pt1) (setq list1 (cdr list1)) ) ) Thanks in advance pointlist.lsp Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted July 16, 2017 Share Posted July 16, 2017 Do you want to move the points so that they fall inside the limits? Or do you want to change the limits to match the extents of the points? Quote Link to comment Share on other sites More sharing options...
Commandobill Posted July 16, 2017 Share Posted July 16, 2017 Your limits are nowhere near your points... Quote Link to comment Share on other sites More sharing options...
aloy Posted July 16, 2017 Author Share Posted July 16, 2017 (edited) Roy_043, Yes I want the points to be displayed without Zoom Extent being invoked as I find my programs will not work inside this extent. Actually I have made a mistake in the limits. It is being corrected as follows: (defun C:drawpoints ( / list1 pt1) (setq p1 '(163800.00 91000.0) p2 '(164400.0 91300.0)) (command "limits" p1 p2) (command "zoom" "E") (setq list1 pl pt1 (car list1)) (while (/= pt1 nil) (setq pt1 (car list1)) (command "point" pt1) (setq list1 (cdr list1)) ) ) Edited July 16, 2017 by aloy Quote Link to comment Share on other sites More sharing options...
aloy Posted July 16, 2017 Author Share Posted July 16, 2017 Commandobill, Sorry I have made a mistake in giving the limits. It has been corrected in post #4. Thanks Aloy Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted July 16, 2017 Share Posted July 16, 2017 The rectangle defined by your limits measures 69400 x 300. Are you sure this is correct? Why not simply use: (foreach pt pl (command "_.point" "_non" pt) ) (command "_.zoom" "_extents") Quote Link to comment Share on other sites More sharing options...
aloy Posted July 16, 2017 Author Share Posted July 16, 2017 Roy_043, Sorry my mistake again. The rectangle is 600x300 and it has been corrected in my previous post. Is there no way to avoid Zoom Extent?. I tried setting limits. But I am not able to get the griddisplay correctly. It appears to me when Zoom Extent is done the coordinate system doesn't work correctly and a certain program I use gives me errors. Regards, Aloy Quote Link to comment Share on other sites More sharing options...
1958 Posted July 17, 2017 Share Posted July 17, 2017 Why not simply use: (vl-cmdf "_.zoom" "_w" (getvar "extmax") (getvar "extmin") ) Quote Link to comment Share on other sites More sharing options...
aloy Posted July 17, 2017 Author Share Posted July 17, 2017 1958, Yes it draws points and zoom to the extent and bring all my points to the screen, but doesn't help me with my other program. I need to first set the limits and then draw the points. Regards, Aloy Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 17, 2017 Share Posted July 17, 2017 Search here for min x y, max x y of a list, its lisp code, do that 1st then you have your window values, I would add a litte bit more offset. Quote Link to comment Share on other sites More sharing options...
aloy Posted July 17, 2017 Author Share Posted July 17, 2017 Hi BIGAL, That exactly what I have done in addition to removing duplicate points and also trimming down the coordinates using the following code: (defun c:DrawPoints() (mytrim) (setq ptlist pl lst1 ptlist fuzz 0.003) (remduppts ptlist fuzz) (sortbyx) (setq p1 (car ptlist) p2 (car (reverse ptlist))) (sortbyy) (setq p3 (car ptlist) p4 (car (reverse ptlist)) wx2 (list (car p2) (+ (cadr p4) 10.0)) wx1 (list (-(car p1) 10.0) (-(cadr p3) 10.0))) (command "limits" wx1 wx2) (command "Zoom" "E") (setq list1 ptlist pt1 (car list1)) (while (/= pt1 nil) (setq pt1 (car list1)) (command "point" pt1) (setq list1 (cdr list1)) ) (setq pl ptlist) (princ) ) (defun sortbyx() (setq ptlist (vl-sort ptlist (function (lambda (e1 e2) (< (car e1) (car e2)) ) ) ) ;list points by x value (smaller value first) ) ) (defun sortbyy () (setq ptlist (vl-sort ptlist (function (lambda (e1 e2) (< (cadr e1) (cadr e2)) ) ) ) ) ;list points by y value (smaller value first) ) (defun mytrim() (setq pl(mapcar '(lambda (x) (list (- (car x) 160000.000) (- (cadr x) 90000.00) (caddr x))) pl)) ) (defun remduppts (pl fuzz / res p) (repeat (1- (length pl)) (setq p (car pl)) (if (> (distance (list (car p) (cadr p)) (cadr pl)) fuzz) (setq res (cons p res)) ) (setq pl (cdr pl)) ) (reverse (cons (car pl) res)) ) However I have used Zoom Extents. I believe this has done some changes to coordinates system therefore I get error when I use a program I developed. When I use the same program on another drawing without zoom extent I get it working ok. I attache snipped sections of these drawings on which I have drawn centerlines of road alignments. I am trying to figure out what the problem is. Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted July 17, 2017 Share Posted July 17, 2017 Your function mytrim is changing the coordinates. Why do you use it if you do not want to change the coordinate system? Maybe this helps: (foreach pt pl (command "_.point" "_non" pt) ) (command "_.zoom" "_extents") (setvar 'limmin (getvar 'extmin)) (setvar 'limmax (getvar 'extmax)) Quote Link to comment Share on other sites More sharing options...
aloy Posted July 17, 2017 Author Share Posted July 17, 2017 Roy_043, There is no change; I still get the center lines marked as in the first picture. As for mytrim function there is a long story behind it. A few years back a member of this forum gave a program (some 3000 lines of code) with which one could get z coordinates within the drawing of points covered by something like my list of points (pointlist in this case). So in order to trim the coordinates and consequently make the numbers small I used mytrim. It is sort of digital terrain modelling using autolisp. If I am successful in solving this issue I will put it in this forum again with 'Delaunay' triangulation. Regards, Aloy Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted July 17, 2017 Share Posted July 17, 2017 I don't think I can help you. Your problem remains too cryptic. But I am sure that a zoom extents does *not* change the coordinate system. Quote Link to comment Share on other sites More sharing options...
aloy Posted July 17, 2017 Author Share Posted July 17, 2017 (edited) Is there a way of bringing out griddisplay (with a number such as 0,1,2) with new coordinates after limits command without doing a Zoom, Extents?. Edited July 17, 2017 by aloy Quote Link to comment Share on other sites More sharing options...
aloy Posted July 17, 2017 Author Share Posted July 17, 2017 Roy_043, You are correct. The zoom, extents do not affect my coordinate system. The error in my first drawing is due to the two lines not meeting at one point instead of intersecting. So, the problem is solved. Thanks very much to you, Commandobill, 1958, and Bigal for the advice. Aloy Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.