Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Transferring objects from model space to paper space

19 REPLIES 19
SOLVED
Reply
Message 1 of 20
iwafb
15292 Views, 19 Replies

Transferring objects from model space to paper space

Hi All,

 

Does anyone have a solution for moving objects from model space to paper space other than creating blocks? I'm thinking something like using entmod and changing DXF code 410, but this doesn't seem to work (Is code 410 read only?).

 

Any suggestions will be most welcome.

 

Cheers

John

19 REPLIES 19
Message 2 of 20
mattok
in reply to: iwafb

Is this able to be done by selecting the objects then;

CTRL-C

(Switch to Other space)

CTRL-V

Message 3 of 20
iwafb
in reply to: mattok

That's the way we are doing it at the moment. I was looking for a LISP solution...
Thanks
John
Message 4 of 20
pbejse
in reply to: iwafb


@iwafb wrote:
That's the way we are doing it at the moment. I was looking for a LISP solution...
Thanks
John

Curious, why not use 

command: chspace

 

If you really want a lisp solution , i think i wrote something similar to that a long time ago. I'll have a look-see if i can find it at all....

 

 

 

Message 5 of 20
iwafb
in reply to: pbejse

The reason I want lisp is because this is a small part of a much larger process and could all be done at the literal "click of a button". I have not used CHSPACE before, but i did see it referenced on other posts. However, when I investigated it, the command was not allowed in model space so I didn't think if a viable option. In case I'm missing something, how would you propose to use chspace in this instance?

 

Cheers,

John

Message 6 of 20
pbejse
in reply to: iwafb


@iwafb wrote:

The reason I want lisp is because this is a small part of a much larger process and could all be done at the literal "click of a button". I have not used CHSPACE before, but i did see it referenced on other posts. However, when I investigated it, the command was not allowed in model space so I didn't think if a viable option. In case I'm missing something, how would you propose to use chspace in this instance?

 

Cheers,

John


So you are wanting to transfer the Model space entity to Pspace but the problem is you are at Model Space and there are no viewports correct?

What about the positions of the entities? where exactly would it land on the layout tab? and is there more than one layout tab?

 

Message 7 of 20
iwafb
in reply to: pbejse

The positioning of the entities will be exactly the same in paper space as it is in model space. At the moment, the process is to copy all entites using 0,0,0 and pasting in paper space at 0,0,0. We do have more than one layout tab, and eventually we may want to copy these entities over several layout tabs. But, for the moment, just happy to move the elements to the first layout tab available (generally "Layout1")...

 

Thanks,

John

Message 8 of 20
pbejse
in reply to: iwafb


@iwafb wrote:

The positioning of the entities will be exactly the same in paper space as it is in model space. At the moment, the process is to copy all entites using 0,0,0 and pasting in paper space at 0,0,0. We do have more than one layout tab, and eventually we may want to copy these entities over several layout tabs. But, for the moment, just happy to move the elements to the first layout tab available (generally "Layout1")...

 

Thanks,

John


(defun c:m2s (/ i aDoc LayoutColl MoveToLayout ss ObjToMove)
;;;		pBeFeb2014		;;;
  (vl-load-com)
  (setq	i	   -1
	adoc	   (vla-get-activedocument (vlax-get-acad-object))
	LayoutColl (vla-get-layouts adoc)
  )

  (if (and (setq MoveToLayout nil
		 ss (ssget "_:L")
	   )
	   (not (textscr))
	   (foreach itm	(layoutlist)
	     (princ (strcat "\nInput "
			    (itoa (setq i (1+ i)))
			    " for layout "
			    itm
		    )
	     )
	   )
	   (setq lnum (getint "\nEnter Index value: "))
	   (setq NLNAme (nth lnum (layoutlist)))
      )
    (progn
      (vlax-for	x (setq ObjToMove (vla-get-activeselectionset aDoc))
	(setq MoveToLayout (cons x MoveToLayout))
      )
      (vla-delete ObjToMove)
      (vla-CopyObjects
	ADoc
	(vlax-make-variant
	  (vlax-safearray-fill
	    (vlax-make-safearray
	      vlax-vbObject
	      (cons 0 (1- (length MoveToLayout)))
	    )
	    MoveToLayout
	  )
	)
	(vla-get-block (vla-item LayoutColl NLNAme))
      )
      (foreach O MoveToLayout (vla-delete O))
    )
  )
  (princ)
)(vl-load-com)

 

Message 9 of 20
hmsilva
in reply to: pbejse

Nicely done, pBe 🙂

 

Cheers

Henrique

EESignature

Message 10 of 20
Lee_Mac
in reply to: iwafb

Message 11 of 20
iwafb
in reply to: iwafb

Thank you both for your feedback. Nice work...

 

Cheers

John

Message 12 of 20
pbejse
in reply to: iwafb


@iwafb wrote:

Thank you both for your feedback. Nice work...

 

Cheers

John


Glad we could help. Smiley Happy

 


@hmsilva wrote:

Nicely done, pBe 🙂

 

Cheers

Henrique


Thank you for the kudos Henrique 

 

Cheers  beer.gif

Message 13 of 20
rick.muncy
in reply to: iwafb

I know this is a little late in the game, but...  You have to be in paper space to use the CHSPACE command.  In paper space, double click in the vport.  You will be working in model space but you are still in the paper space tab.  Now, use CHSPACE.  The objects selected will be transferred to paper space.

Message 14 of 20
chris.slattery
in reply to: pbejse

I know this is a older thread but if anyone reads it. I have tried this code and i get an error message

; error: Automation Error. Invalid owner object

 

I do not know what this means.

Message 15 of 20
Jason.Rugg
in reply to: iwafb

You could just use the native AutoCAD command CHSPACE, very easy and no code to mess with. In paperspace go into the viewport, select your objects you want transferred to paperspace and use the CHSPACE command.

Message 16 of 20
chris.slattery
in reply to: Jason.Rugg

No viewport for change space.

The files were converted from Microstation and there are a lot of them. 

Message 17 of 20


@chris.slattery wrote:

No viewport for change space. ...


 

Then where are you trying to move things to, or from?  The Title of this thread doesn't seem to have any relevance in the absence of viewports.

Kent Cooper, AIA
Message 18 of 20

I want to move everything in model to layout. This code works but you have to select objects first then the text window opens and you have to enter 0 for the first layout space. I did not want to do all of that. I modified the code by taking out the (not (textscr)) so the text window does not open and I changed the line (setq lnum (getint "\nenter index value: ")) to be hard coded at 0. (setq lnum 0). I did this at home and it worked just fine. Now on my work computer I get that error message.

Message 19 of 20
Jason.Rugg
in reply to: chris.slattery

@chris.slatteryIf no viewport exists, create one, go inside the viewport and do a SELECT/ALL command and then do the CHSPACE command. 

Message 20 of 20
Jason.Rugg
in reply to: Jason.Rugg

@chris.slatteryOr just do a SELECT/ALL copy and paste from model space to paper space and then scale in paper space accordingly.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost