Jump to content

Send all objects on certain layer from paper space into model space.


Recommended Posts

Hey guys,

 

I am trying to help improve a few methods for our CAD & CNC departments. After our drawings are finished and ready for production we first have them stock billed with code #'s for each item and be cut and logged throughout the process. Our stockbiller is not a CAD operator and therefore is not handy with CAD. He places his stock bill codes on the paper space view ports. Our CNC guy then has to wait for him to finish in order to then work on the same project. I had proposed x-reffing the project and let the stockbiller "CHSPACE" all the codes into model space afterwards. Is there an auto-lisp function to have all objects of a certain layer sent into model space? I know "CHSPACE" requires the selection of the viewport to scale too but wasn't sure if there is an easier or better method that we just are not seeing.

 

Thanks you all for what ever advice or help you can spare.

Link to post
Share on other sites
Bhull1985

AFAIK chspace may be the best method to accomplish this task due to the matrix math required otherwise, although chspace is an express tools function is seems as if you need a tool for a few local machines, assuming express tools is loaded onto any that would use such a routine, something like this, quick and dirty.

 

(defun C:layCSpace ( / ss)
[font=Courier New](setq ss (ssget "x" (list (cons 8 "[color=red]PID[/color]"))))   ;create selection set of all items on layer "PID" and assign them to the variable "SS"[/font]
(sssetfirst nil ss)                                                       ;grip select selection set
(C:CHspace)                                                             ;change space
[font=Courier New])                                             ;defun[/font]

 

Obviously you would need to change "PID" to your layer name.

  • Like 1
Link to post
Share on other sites

Welcome to CADTutor. :)

 

I am sure one of the lisperati could come up with a lisp to do what you are describing,

or if you used LAYISO to isolate the layer in question, you could then quite easily and safely, select everything

on that isolated layer, before using the CHSPACE command to send it to Modelspace.

Link to post
Share on other sites
Tharwat

Try this code and do not forget to change the name of the layer as per yours .

 

(defun c:Test (/ doc objs)
 ;;    Tharwat 10. Apr. 2014        ;;
 (cond ((eq (getvar 'ctab) "Model")
        (princ "\n ** Command is not allowed in Model Space !!")
       )
       (t
        (vlax-for x (vla-get-paperspace
                              (setq doc (vla-get-activedocument
                                          (vlax-get-acad-object)
                                        )
                              )
                            )
          (if (and (/= (vla-get-objectname x) "AcDbViewport")
                   (eq (vla-get-layer x) [color=magenta]"Layer1"[/color])
              )
            (setq objs (cons x objs))
          )
        )
        (if objs
          (vlax-invoke
            doc
            'CopyObjects
            objs
            (vla-get-ModelSpace doc)
          )
        )
       )
 )
 (princ)
)(vl-load-com)

  • Like 1
Link to post
Share on other sites
  • 7 years later...
On 4/10/2014 at 8:05 PM, Bhull1985 said:

AFAIK chspace may be the best method to accomplish this task due to the matrix math required otherwise, although chspace is an express tools function is seems as if you need a tool for a few local machines, assuming express tools is loaded onto any that would use such a routine, something like this, quick and dirty.

 

 


(defun C:layCSpace ( / ss)
[font=Courier New](setq ss (ssget "x" (list (cons 8 "[color=red]PID[/color]"))))   ;create selection set of all items on layer "PID" and assign them to the variable "SS"[/font]
(sssetfirst nil ss)                                                       ;grip select selection set
(C:CHspace)                                                             ;change space
[font=Courier New])                                             ;defun[/font]
 

 

 

Obviously you would need to change "PID" to your layer name.

Sir Can we send paper space block  in model space also,

I have a block on many layout.

Can I send that in model space.

Block name same and layer name also.

Link to post
Share on other sites

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