Jump to content

Return a list of objects copied using Lee Mac's ms2ps routine


Recommended Posts

Posted (edited)

Greetings,

I am writing a routine that, among other things, calls Lee Mac's program ms2ps.  My routine calls ms2ps and then temporarily uses the copied objects while working in paper space.  At the end of my routine I want to erase the copied objects that ms2ps put into paper space. I thought this would be fairly easy to do but it seems I was wrong!

Around line 90 of his code, http://www.lee-mac.com/lisp/html/ms2psV1-0.html , I can see this is where the objects are copied.  I thought this would be a good place to create a global variable which would contain a list of the paper space objects just created. I do not have the programming skills to accomplish that.  What should I add to ms2ps.

 

Edited by JerryFiedler
Posted

That's about where you wanted to create it.

 

(defun c:ms2ps (/ *error* ang doc enx idx lst mat nor scl sel)
  (setq SS (ssadd)) ;added on line 34
  (defun *error* (msg)

 

        )
        (vla-transformby obj mat)
        (ssadd (vlax-vla-object->ename obj) SS) ;added line 100
      )

 

change the selection set name to something you don't use.

 

erase them with this command.

(defun EraseMS2PS ()
  (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS)))
    (entdel ent)
  )
)

 

only tested on a polyline and text.

  • Thanks 1
Posted

Thank you mhupp.  Your code works exactly the way I want it to.

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...