Code Red > AutoLISP (Vanilla / Visual)
Paste not allowed, not sticking..[SOLVED..]
ScottMC:
How do I enable pasting coords into this [Lee's] converter?
Picking works fine.
Examples:
Pick Point for Coords to Use/Convert: 27.02485,12.61196,0
There's times when the conversion would be handy. THANKS
\/ pasted
Pick Point for Coords to Use/Convert: (41.9014 30.2182 0.0)
Can't reenter LISP.
Invalid point.
--- Code: ---
(defun c:xzz ()
(setq mlst (getpoint "\n Pick Point for Coords to Use/Convert: "))
(setq mlst (list (rtos (car mlst))(rtos (cadr mlst))(rtos (caddr mlst))))
;; List to String - Lee Mac
;; Concatenates each string in a supplied list, separated by a given delimiter
;; lst - [lst] List of strings to concatenate
;; del - [str] Delimiter string to separate each item
(defun LM:lst->str ( lst del / str )
(setq str (car lst))
(foreach itm (cdr lst) (setq str (strcat str del itm)))
str
)
(princ (LM:lst->str mlst ","))
(princ)
)
--- End code ---
danAllen:
Make a command variant that accepts a string and use read to convert to list:
: (setq t1 (getstring "paste here: "))
paste here: (41.9014 30.2182 0.0)
"(41.9014 30.2182 0.0)"
: (read t1)
(41.9014 30.2182 0.0)
57gmc:
Your lisp worked for me. Just don't try pasting the coordinates to the drawing area. Paste them into the command line.
Also, for readability, don't include Lee's defun inside your defun. It should be separate.
**Sorry, when I pasted, I didn't include the parens. That's what causes the error, forcing it to evaluate the lisp expression. You need to enter the coords as you would normally, as coordinates, not a lisp expression. How are you copying the point? from a list somewhere?
ScottMC:
Just seems it'd be easier to have a converter to do the work than changing however many lsp's I have.
Here's a link to just one which does just what needs conversion after in order to use during a command..
https://www.theswamp.org/index.php?topic=48726.msg538264#msg538264
As u'll see, understandably LSP programmers can/do choose not to add the rest of the desired pgm when posting code.
For me, it's exciting to work this another way instead of having to modify the many with this style of results..
As a subroutine, eventually I'll probably add this solution as time allows.
57gmc:
--- Quote from: ScottMC on April 06, 2023, 06:07:26 PM ---Just seems it'd be easier to have a converter to do the work than changing however many lsp's I have.
Here's a link to just one which does just what needs conversion after in order to use during a command..
https://www.theswamp.org/index.php?topic=48726.msg538264#msg538264
As u'll see, understandably LSP programmers can/do choose not to add the rest of the desired pgm when posting code.
For me, it's exciting to work this another way instead of having to modify the many with this style of results..
As a subroutine, eventually I'll probably add this solution as time allows.
--- End quote ---
You lost me? I thought you were talking about pasting a string representing a point at the prompt to pick a point. I was asking about where you obtain the string. I don't know what converter you're talking about.
Navigation
[0] Message Index
[#] Next page
Go to full version