mhy3sx Posted October 29, 2023 Posted October 29, 2023 Hi, I use this code for a long time and works fine in Autocad. I decided to use GstarCAD and this code didn't work properly. This code Export a selection to new drawing. The problem is that in GStarCAD the code start , select the export area , open the new dwt file ,...BUT didn't paste anything. (defun c:test (/ app docs doc objects ss i n sslist) (setq app (vlax-get-acad-object)) (setq doc (vla-get-activedocument app)) (setq docs (vla-get-documents app)) (setq ss (ssget (list (cons 410 (Getvar"CTAB" ))))) (setq n (sslength ss) i 0) (repeat n (setq sslist (append sslist (list (vlax-ename->vla-object (ssname ss i))))) (setq i (1+ i)) ) (setq objects (vlax-make-safearray vlax-vbObject (cons 0 (1- n)))) (vlax-safearray-fill objects sslist) (setq doc_new (vla-add docs "c:\\mydwt\\Template\\test.dwt")) (vla-copyobjects doc objects (vla-get-modelspace doc_new) ) (princ) ) Any Ideas? Thanks Quote
Steven P Posted October 29, 2023 Posted October 29, 2023 I don't know GstarCAD but might guess that once the new document is opened then the LISP in the original ends or can't be completed because of that. You could try a 'princ' command either side of the VLA-copyopbjects doc line - see if it prints both to the command line 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.