CAD Forum - Database of tips, tricks and utilities for AutoCAD, Inventor and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 3625
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

 

HelpCAD discussion

 
CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.

How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Polygcode.lsp

 Post Reply Post Reply
Author
r.b.hughes View Drop Down
Newbie
Newbie


Joined: 07.Oct.2022
Location: Canada
Using: AutoCAD 2023
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote r.b.hughes Quote  Post ReplyReply Direct Link To This Post Topic: Polygcode.lsp
    Posted: 07.Oct.2022 at 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 XY

For 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.
Back to Top
Kent Cooper View Drop Down
Senior Member
Senior Member


Joined: 12.Mar.2013
Location: United States
Using: AutoCAD2020, 2023
Status: Offline
Points: 580
Post Options Post Options   Thanks (0) Thanks(0)   Quote Kent Cooper Quote  Post ReplyReply Direct Link To This Post Posted: 10.Oct.2022 at 14:23
Very basic AutoLisp multiplication:
....
(princ (strcat "\n" "X" (rtos (* (cadr PT1) 2) 2 __PV_DP) __PV_Delimiter
....
Back to Top
r.b.hughes View Drop Down
Newbie
Newbie


Joined: 07.Oct.2022
Location: Canada
Using: AutoCAD 2023
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote r.b.hughes Quote  Post ReplyReply Direct Link To This Post Posted: 10.Oct.2022 at 21:43
Thanks for the help.

I am not a LISP user. My mistake was not putting "cadr PT1" in brackets.
Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 1,211 seconds.