Author Topic: Paste not allowed, not sticking..[SOLVED..]  (Read 5737 times)

0 Members and 1 Guest are viewing this topic.

ScottMC

  • Newt
  • Posts: 193
Re: Paste not allowed, not sticking.. [SOLVED..]
« Reply #15 on: May 03, 2023, 06:56:10 PM »
Special thanks to danAllen as your first suggestion was exactly what I needed
This inspires me to not give up 'period'. Here's the final that is truely helpful in
the situation mentioned. Thanks dan! [show me more..]

Code: [Select]
(defun c:l2c ( / t1 clist pp) ;; https://www.theswamp.org/index.php?PHPSESSID=e0a54b27fe871d6007843325830312b0&topic=58190.msg613883#msg613883
    (setq t1 (getstring " Paste List Here: ")) ;; as suggested.. it works!
    (setq clist (read t1))
    (setq pp                               ;;  makes coords copy/paste usable
                  (strcat
                       (rtos (car clist) 2 5) ","
                       (rtos (cadr clist) 2 5) ","
                       (rtos (caddr clist) 2 5)
                     )
              )
      pp              ;; removed princ
 )
 
;; 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)

« Last Edit: May 03, 2023, 07:19:35 PM by ScottMC »

ScottMC

  • Newt
  • Posts: 193
Re: Paste not allowed, not sticking..[SOLVED..]
« Reply #16 on: August 28, 2023, 10:36:14 PM »
Just re.digging through my pile and saw something wrong with it in that it posts an error: ' Can't reenter LISP. '
At this site https://www.theswamp.org/index.php?topic=43587.msg488577#msg488577 Lee Mac uses a tool:
(getstring T " Paste List Here: < !pp > ") << the 'T' which removes the error somehow.. Thanks Much Lee

Option commented near end for transparent use.
Code: [Select]
(defun c:l2c ( / t1 clist) ;; https://www.theswamp.org/index.php?PHPSESSID=e0a54b27fe871d6007843325830312b0&topic=58190.msg613883#msg613883
    (setq t1 (getstring T " Paste List Here: < !pp > ")) ;; as suggested.. it works!
 ;; T solved the: 'Can't reenter LISP.' responce..
 (setq clist (read t1));;
   ;; (setq pp             
    (setq ptx (rtos (car clist) 2 5)  ;; cmd usable coords
            pty (rtos (cadr clist) 2 5)
            ptz (rtos (caddr clist) 2 5)
            )
            (setq pp (strcat " " ptx "," pty "," ptz))                  ;;  makes coords copy/paste usable
        ;(princ (strcat "    " ptx "," pty "," ptz)) ;; makes print w/o quotes..but princ cancels trans
     pp  ;; better looking ; ;;  makes coords copy/paste usable
 ;;(princ)
)
« Last Edit: August 28, 2023, 10:53:35 PM by ScottMC »

danAllen

  • Newt
  • Posts: 134
Re: Paste not allowed, not sticking..[SOLVED..]
« Reply #17 on: August 28, 2023, 11:37:05 PM »
Providing T to getstring allows entering spaces: https://help.autodesk.com/view/OARX/2022/ENU/?guid=GUID-B139EFBD-74B7-4276-B422-D2186F7D8D0A

Glad I could help. Still worried about loss of precision when pasting values. Is that not a concern for you? If coordinates are on integer coordinates I can see it being a non-issue, but most CAD work seems to not end up that way.

If I needed to save values, I would obtain the data as a point list (getpoint or entget) and have the lisp enter it as the same. Are you copying coordinates between drawings? For that you can use vl-bb-ref & vl-bb-set and preserve full precision of data values.

ScottMC

  • Newt
  • Posts: 193
Re: Paste not allowed, not sticking..[SOLVED..]
« Reply #18 on: August 31, 2023, 09:36:27 PM »
Just in case anyone could benefit.. taking a coords list and just adding the word list is
pastable too.  (12.0 2.0 0.0) to (list 12.0 2.0 0.0)

danAllen

  • Newt
  • Posts: 134
Re: Paste not allowed, not sticking..[SOLVED..]
« Reply #19 on: September 03, 2023, 04:12:45 PM »
good point. Note Z 0.0 isn't needed unless say your ELEVATION var is set to non 0, and you want zero. Also some 2d commands won't accept a 3d point.

ScottMC

  • Newt
  • Posts: 193
Re: Paste not allowed, not sticking..[SOLVED..]
« Reply #20 on: September 03, 2023, 06:39:38 PM »
Found that on my keyboard, seriously.. [I know, having more experience helps, give me a... several years!] currently 2 years here at the school-of-hard-knocks. Without the struggles, digging and asking, this to me is really interesting to learn [no other coding experience period] Have no desire to learn the others.. yet. U do any code for 3dsolid, 3dface?

ScottMC

  • Newt
  • Posts: 193
Re: Paste not allowed, not sticking..[SOLVED..]
« Reply #21 on: September 22, 2023, 09:52:50 PM »
No significant change.. just seems simpler.
Code: [Select]
(defun c:l2c ( / t1) ;; clist https://www.theswamp.org/index.php?PHPSESSID=e0a54b27fe871d6007843325830312b0&topic=58190.msg613883#msg613883
    (setq t1 (getstring T " Paste List Here: <!pp> ")) ;; as suggested.. it works!
 ;; T solved the: 'Can't reenter LISP.' responce..
 (setq pp (read t1));;
    (prompt             
        (strcat
           (rtos (car pp) 2 7) ","  ;; cmd usable coords
            (rtos (cadr pp) 2 7)","
            (rtos (caddr pp) 2 7)
        )
      )
(princ)
pp ;
)

« Last Edit: September 22, 2023, 10:24:03 PM by ScottMC »