Display full version of the post: Polygcode.lsp

r.b.hughes
07.10.2022, 17:59
I have been using this .lsp file (downloaded from this site) for students to extract XYZ coordinates to be used in a CNC.program. I am trying to adapt the program to extract XZ coordinates for programs for a CNC lathe. The problem I am having is that the X values I get are radius, and I need diameter. I have not been able to find out how to multiply the polyline point value by 2.Here is a clip of the section of the script   (foreach PT1 listCOORDINATES ;all vertices    (princ (strcat "\n" "X" (rtos (cadr PT1) 2 __PV_DP) __PV_Delimiter                        "Z" (rtos (car PT1) 2 __PV_DP) )) ; display XYFor simplicity, the Y coordinate (cadr) is the X axis, and the X coordinate (car) is the Z axis.I need the value of the Y coordinate to be multiplied by 2. Can anyone suggest how to do this?Many thanks.

Kent Cooper
10.10.2022, 14:23
Very basic AutoLisp multiplication:....(princ (strcat "\n" "X" (rtos (* (cadr PT1) 2) 2 __PV_DP) __PV_Delimiter....

r.b.hughes
10.10.2022, 21:43
Thanks for the help.I am not a LISP user. My mistake was not putting "cadr PT1" in brackets.