Shukoor Posted 5 hours ago Posted 5 hours ago (edited) I want to create an AutoLISP file that can paste objects to multiple reference points within a CAD file. I have a sample generated by GPT that works, but the problem is that I have to hardcode the reference point inside the LISP code every time. I need to modify it so that I can define the base point manually within CAD instead. See the reference and suggest the solution (defun c:PASTEPOINT ( / choice basept) ;; Define your reference points for each floor ;; Replace the coordinates with your actual base points (setq basement '(0 0 0)) (setq ground '(1000 0 0)) (setq first '(2000 0 0)) ;; Ask user which floor to paste into (setq choice (strcase (getstring "\nPaste to which floor? [Basement/Ground/First]: ") ) ) ;; Select base point based on user choice (cond ((= choice "BASEMENT") (setq basept basement)) ((= choice "GROUND") (setq basept ground)) ((= choice "FIRST") (setq basept first)) (T (progn (prompt "\nInvalid option. Use Basement, Ground, or First.") (exit) ) ) ) ;; Execute paste command at selected base point (command "_.PASTECLIP" basept) (princ) ) Edited 1 hour ago by SLW210 Added Code Tags!! Quote
SLW210 Posted 1 hour ago Posted 1 hour ago Please use Code Tags (not Quote Tags) for your code. (<> in the editor toolbar) Quote
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.