Message 1 of 5

Not applicable
05-07-2020
01:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good day!
I'm having an issue trying to modify a lisp routine that works for a single object to make it run for a selection of objects. It's very simple. I'm trying to copy multiple dimension values to a clipboard with a "; " string in between each of the dimensions.
The original script that works for copying a single dimension value to a clipboard:
(Defun c:Dim2Clip (/ ss st 2ClipB)
(vl-load-com)
(print "Select Dimension...")
(if (setq ss (ssget "_+.:S" '((0 . "*DIMENSION"))))
(progn (setq st (vla-get-measurement (setq vl (vlax-ename->vla-object (ssname ss 0)))))
(vlax-invoke
(vlax-get (vlax-get (setq 2ClipB (vlax-create-object "htmlfile")) 'ParentWindow)
'ClipBoardData)
'SetData
"Text"
(rtos st))
(vlax-release-object 2ClipB)))
)
This is my modification that doesn't work with a "too many arguments" error.
(Defun c:ddupa (/ pat ss i st 2ClipB)
(vl-load-com)
(setq pat "")
(print "Select Dimension...")
(if (setq ss (ssget "_+.:E:S" '((0 . "*DIMENSION"))))
(repeat (setq i (sslength ss))
(progn (setq st (vla-get-measurement (setq vl (vlax-ename->vla-object (ssname ss 0))))))
(setq pat (strcat pat (strcat (rtos st) "; ")))
(list (ssname ss (setq i (1- i))) '(0 0 0))
);repeat
(vlax-invoke
(vlax-get (vlax-get (setq 2ClipB (vlax-create-object "htmlfile")) 'ParentWindow)
'ClipBoardData)
'SetData
"Text"
pat)
(vlax-release-object 2ClipB))
)
I would be very grateful for any assistance with this. I'm in a rush with some work that would be singificantly more efficient with this working.
Solved! Go to Solution.