Jump to content

Recommended Posts

Posted

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

 

Posted

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

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...