Jump to content

Converting x and y back to point!


bubsta82

Recommended Posts

I need help converting a X value and a Y value to a usable point for this function

 

(if (not c:cal)(arxload "geomcal"))
(setq x (cal "ang(xy,xy2,xy1)"))

 

Which finds the angle between two points.

 

Here is what I have tried.

 

(setq xy (list xval yval))

 

I modified an existing code to export the coordinates of a polyline to a .txt file in seperate x and y values. Which works, but when I try to add the angle between them by recombining the x and y values and getting this error.

 

Value of AutoLISP variable XY must be a point, real or integer

 

So I am guessing using the list is not working!

full2.Lsp

Edited by rkmcswain
added CODE tags
Link to comment
Share on other sites

Your problem appears to be due to you using rtos and then using that string on the cal function. I'd actually go with something like this:

;start the loop
(repeat (/ (length thelist) 2)
 (setq xval (rtos (setq x (nth n thelist)))
       n (1+ n)
       yval (rtos (setq x (nth n thelist)))
       xy (list x y)
       n (1+ n)
       xf (cal "ang(xy,xy2,xy1)")
 )
 ...

Note also you don't need to arxload the geomcal each time you use it. You can move that to outside the defun even, or at least outside the repeat loop.

Link to comment
Share on other sites

Update!

Finished the routine to do exactly what I needed!

 

Thank you irneb for your input! it was exactly what I needed with slight modification to access a previous point and a next point.

 

The routine allows you to select a polyline, checks to see if it is indeed a polyline, then prompts for for a file output if needed. If so, prompts for a file name and will save the point number of all vertex with the x and y coordinate, latitude and longitude and the change in angle at each vertex.

 

As an added bonus there is a prompt to label the vertex number, Northing and Easting, and angle on the drawing if needed. Does a great job at placing the text at different points along the line to avoid confusion. They then can be moved.

 

If there is any interest in the .lsp file let me know!

Link to comment
Share on other sites

  • 6 years later...

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...