How to fix this program?

How to fix this program?

Anonymous
Not applicable
823 Views
8 Replies
Message 1 of 9

How to fix this program?

Anonymous
Not applicable

Hello!

 

I've found a Lisp some days ago that exports intersections points.

 

Given a polyline (or spline, etc) and a Line crossing this P.line, the lisp should read the intersection points and export them to a .csv file.
This isn't what is happening...

 

There are 2 things I want to change:

#1 - When the csv file is created, only the X point is exported... I'd like the Y point too.
#2 - For some reason, the UCS location influences the code in a negative way... Depending on the ucs location, the coordinates exported are wrong.

 

Please, can you help me?
Thank you for your time.
Cheers!

0 Likes
824 Views
8 Replies
Replies (8)
Message 2 of 9

stevor
Collaborator
Collaborator

# 1 Better responses when the subject line describes the content

# 2 Clever code, who is the author?

# 3 Y value might be by:


(defun Pnt->Csv  (lst / Str) (setq Str "")
  (while lst
    (setq Str (strcat (rtos (car lst)) (chr 44)   ; X
                      (rtos (cadr lst)) (chr 44)  ; Y
                      Str ) ; strcats
             lst (cdr lst) ) 

  ) ; wh
  Str )

S
Message 3 of 9

Anonymous
Not applicable
Hi Stevor, thank you very much for the answer.

#1 - I did this in the tags, but I'll remember to change the subject line next time.
#2 - It seems that Lee Mac made it, about seven years ago.
#3 - Where exactly I have to paste the code you wrote?
0 Likes
Message 4 of 9

stevor
Collaborator
Collaborator

 

#2 First, paste the Leemac info at the top

of the file, as a comment, by semicolins, etc,

to help you and everyone keep track of things.

 

#3 Then paste my 'Pnt->Csv suggestion'

at the bottom of the file.

Then load the file, to see if it all works.

 

As the file is read, it will load the old

'Pnt->Csv subroutine, then the new one,

and so replace the old Pnt->Csv def.

Then you have both on record,

when you change it again.

S
Message 5 of 9

Anonymous
Not applicable
Hi Stevor.

The command isn't working... In the very end, it is returning Nil
0 Likes
Message 6 of 9

stevor
Collaborator
Collaborator

Returned nil?

My version got an error,

just as well, as my mod was inappropriate.

 

The original code should make a file like:

,1,2,3,
Curve 1,-12.7904,-0.1232,0.0000,

 

Where the 'REALs, -12.7904,-0.1232,0.0000,

are the X displacement values.

 

What do you want in the CSV file?

 

 

S
Message 7 of 9

Anonymous
Not applicable
I will work with the coordinates separately.

I think the easier way to do this is to make another lisp, that consists of exactly the same lisp that I attached, but giving the Y coordinates instead X.

In the end of the story, I'll have 2 LISPs, one to each coordinate. ( I think the command name to call the lisp have to be different too)
0 Likes
Message 8 of 9

stevor
Collaborator
Collaborator

After chopping the original code,

here is a version that adds the X and Y values,

based on the original code calculations,

or some more commas for a non-intersection.

 

In a zip file, since the .lsp version got a forum annotation; The attachment's Intersection-xy.lsp content type (application/octetstream) does not match its file extension and has been removed.
S
0 Likes
Message 9 of 9

Anonymous
Not applicable
Hello Stevor.
Sorry for the late reply, but I had a serious problem that made me lie down on a bed in the hospital until yesterday hahaha

Well, the program works fine untill the "select curve" part. After that, this error is showed:

Select Curve to Measure:
DXY_Csv; error: no function definition: P_
0 Likes