Jump to content

Moving object from Paper to Model across multiple Layouts


loopfish

Recommended Posts

A drawing I have have 50 layouts in it. In each layout there is an object that I want to move from paper space to model space. The objects are all on the same layer.

 

Is there a way to do this without doing it for each individual layout tab? Something that says "move any object on this layer that is in paper space to model space"

 

Thanks!

Link to comment
Share on other sites

You may be able to play with the 410 dxf variable which returns modelspace paperspace etc The problem I see is every object will go to the same co-ords rather than reflect its location in model v's paper.

 

Its not hard to loop through layouts.

 

(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for lay (vla-get-Layouts doc)
 (setvar "ctab" (vla-get-name lay) )
 ; do your chspace here 
)

Link to comment
Share on other sites

I wrote a program to export each paperspace layout to a seperate drawing inside a folder automatically. It means each layout is in its own seperate drawing but they will all be in model space at least.

 

It is a LISP file, not sure if you know how to load and run them?

 

;;;Written by Andrew Espie-Whitburn at
;;;****************************************
;;;This program exports paperspace layout tabs to seperate drawings in the current drawing location.
;;;To run, Type p2m at the command prompt.

(defun C:p2m ()
(getOldVar)
(process)
(reset)    
)

(defun process ()
(setq filepath (getvar "dwgprefix")) 
(setq exported "Exported")

(setq fulldir (strcat filepath exported))  
 
(vl-mkdir fulldir)
(foreach lo (layoutlist)
(progn
(setvar "CTAB" lo)
(setq dwgfn (strcat fulldir "\\" lo))
(command "exportlayout" dwgfn "qsave")
);command
);progn
 );end defun

 
(defun getOldVar ()
(setq oldcmdecho    (getvar "cmdecho"))
(setq oldfiledia    (getvar "filedia"))
(command "cmdecho" "0")
(setvar "FILEDIA" 0)   
(command "undo" "mark")
(command "undo" "begin") 
(setq temperr *error*)
(setq *error* CCerror)      
 
)

 
(defun CCerror (CCerrmsg)
(setq    *error* temperror)
(setvar "FILEDIA"  oldfiledia)
(setvar "cmdecho" oldcmdecho)

(command "undo" "back")    
(command "undo" "end")
(command "undo" "mark")  
(prompt "\nCommand Cancelled°... ")
)


(defun reset ()
(command "undo" "back")    
(command "undo" "end")
(command "undo" "mark")

(setvar "FILEDIA"  oldfiledia)
(setvar "cmdecho" oldcmdecho)  
(prompt "\nExport Complete... ")
)

Link to comment
Share on other sites

Why not reverse engineer it now (setq dwgfn (strcat fulldir "\\" lo)) write to a script file a list of all the dwg names "Insert Dwg1 0,0" "Insert Dwg2 500,0" then insert them back into your current dwg or a new dwg just keep changing the x value of the insertion pt.

It is a LISP file, not sure if you know how to load and run them?

not sure about this 30+ years of Autocad lisp VBA BASIC Now VL.

 

If everything is in paperspace ie no vewports then just use copyclip and paste to new co-ords in model space.

 

last suggestion is use Layiso to isolate the layers you want before exportlayout.

Link to comment
Share on other sites

Why not reverse engineer it now (setq dwgfn (strcat fulldir "\\" lo)) write to a script file a list of all the dwg names "Insert Dwg1 0,0" "Insert Dwg2 500,0" then insert them back into your current dwg or a new dwg just keep changing the x value of the insertion pt.

 

not sure about this 30+ years of Autocad lisp VBA BASIC Now VL.

 

If everything is in paperspace ie no vewports then just use copyclip and paste to new co-ords in model space.

 

 

last suggestion is use Layiso to isolate the layers you want before exportlayout.

 

Yes i thought you could do something like that too, I just didn't have the interest in writing something to do it.

 

The reason I made the comment about knowing how to run lisp is because some people haven't even heard of it let alone loaded a lisp file, and the question wasn't posted in the LISP section of the forum, just the 2D drafting area so thought the OP might not know

Link to comment
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
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...