Copy from one dwg model space to another dwg model and layout space.

Copy from one dwg model space to another dwg model and layout space.

daniel_gombosi
Explorer Explorer
2,729 Views
17 Replies
Message 1 of 18

Copy from one dwg model space to another dwg model and layout space.

daniel_gombosi
Explorer
Explorer

Hello,

 

I don’t know If I’m writing under the right thread, but I have a question.

 

I have 5-600 drawings in model space including some border details (attributes). I have to create new drawings with the same dwg name in a different folder and I have to put the actual drawing in model space and the border details in layout space.

I created a master file that has the correct border in layout space with a view port. Then I placed a rectangle in model space for a reference point (same size as view port). This way the content can be copied from the old drawing using a base point. For the border information I could use a different base point.

My goal is to copy and place everything to a new drawing except the old border, which is in the wrong space and it is an older version.

daniel_gombosi_0-1718638852597.png

 

Is it possible to move the actual drawing content to model space and the border attributes to layout space, while using a basepoint and then Save As the master file with the same drawing title as the original in a different folder? 

Thank you for your advice and help.

0 Likes
Accepted solutions (2)
2,730 Views
17 Replies
Replies (17)
Message 2 of 18

ec-cad
Collaborator
Collaborator

If you can post a sample, without the Company Logo, maybe we can come up with a solution.

Do you need the entire Title Block & it's attributes moved to Paper Space. You could do that

by selecting that Block, and do a "chspace" on it, while it is still in Model Space.

And, if you don't move the whole thing into Paper Space, you may end up with (2) title blocks,

and that's a chore when you want to change some of the attribute values.

 

ECCAD

 

0 Likes
Message 3 of 18

paullimapa
Mentor
Mentor

One way is to open your master file with the new title block in pspace, Saveas to the new folder location, insert the dwg with everything in model space, then the old title block would now use the new title block definition. You may have to move all in model space to the location where you’ve drawn your window. If the title block appearance in model space is what you want, delete the original title block from paperspace and chspace the model space title block into paperspace. Otherwise you’ll have to fill out all the attributes in the new title block on paperspace and delete the other in model space 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 4 of 18

daniel_gombosi
Explorer
Explorer

Unfortunately I can't share files. 

The old title block is not needed, because it is not up to date and the layers are incorrect.

I just need to copy the drawing itself to the new border's model space, which is within the large rectangle on top. Than the attributes that are located under the purple line slightly to the right.

The attributes that I have to move are not part of the border. Every single line is an individual attribute.

 

The attributes that are part of the border are already on the new master border. I will only have to update the drawing number when I add my changes to the drawing.

 

To make it easier we could delete the old border to start with and copy the top part to model space and the attributes to paper space. This is all I need from the original drawings.

daniel_gombosi_0-1718646999879.png

 

Daniel

 

 

 

 

0 Likes
Message 5 of 18

daniel_gombosi
Explorer
Explorer

I was doing something similar. Basically I copied the drawing to the new model space without the border, then copied the attributes to paper space. It doesn't take long. We were just looking into solutions that could make this process automated. 

0 Likes
Message 6 of 18

paullimapa
Mentor
Mentor

If there are commonality with all the dwgs then automation is possible. For example the following would all need to be the same: mspace window location where each dwg would need to be placed, the vport zoom scale in pspace, the window location to select all the attributes below the title to chspace to the location in pspace


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 7 of 18

daniel_gombosi
Explorer
Explorer

Since I created the master file the mspace and vport scale will be the same. Everything lines up If I use copy base with the coordinates 0,0,0 then past the content to the new drawing.

One thing that doesn’t work with the new master file is moving the attributes to paper space with chspace, because the attributes are outside the viewport. (The viewport in the paper space is the same size as the large rectangle on my previous picture.)

But I could just increase the size of the viewport on the master file, so the chspace will work and when I’m adding my changes I will drag the viewport up.

Or copybase the attributes by using the corner of the mspace window, which is the same size as the viewport, and then past it to paper space using the corner of the viewport.

 

 

0 Likes
Message 8 of 18

paullimapa
Mentor
Mentor

What if instead of opening up the dwg to be changed you just have the new master dwg opened and then use the ClassicInsert command select the dwg to be changed make sure Explode is toggled on & insert onto 0,0,0?  Would the location be accurate?

As for those attributes, while in layout use mspace which goes inside the only vport that's there, use the -PAN command and as long as you provide the same set of coordinates for each dwg and pan the view up high enough to see all the attributes. Then use Chspace command and select them using again the same set of window coordinates for each dwg to move them from model to layout. Then run the -PAN command reversing the coordinates to go back to the original view or use the ZOOM Previous command which does the same.  Lastly provide the same set of coordinates to move the Attributes now in pspace to the proper location. The dwg need to be SavedAs to a filename similar to the old dwg name that was inserted but in a new folder location. Finally undo back to beginning and start all over again. All this can be written using lisp onto a script to run for all dwgs in the same folder.

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 9 of 18

Sea-Haven
Mentor
Mentor

@paullimapa " high enough to see all the attributes"

 

Would extmax extmin be useful as these will look at all objects in dwg. Zoom W extmin extmax etc.

0 Likes
Message 10 of 18

paullimapa
Mentor
Mentor

well, I don't want to change the vport zoom factor which is why I suggested a PAN so chspace would just use the vport scale to move the attributes from mspace to psapce at the same scale.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 11 of 18

daniel_gombosi
Explorer
Explorer

 

It works. I had to modify it a bit. It seems like the old border is slightly shifted to the side after I insert it, maybe because the new border has a built-in offset in the page setup manager. I didn't change it because that's how the file was set up originally.

The location of the drawing and the attributes are correct. These are the steps that I used.


- Opened the master file.
- In model space I used ClassicInsert and 0,0,0 for the base point.
- Zoom
All
- Deleted the old border from modell space with Erase command and coordinates.
43,560,0
-10,-10,0
870,45,0
700,-10,0

 

- In paper space I used mspace to go into the viewport.
Instead of -Pan I selected the whole drawing and deselected the parts that were visible in the viewport. So this way the attributes will stay selected.
- Select
All
R
834.5,532.5,0
35.5,70.1,0
Enter


Then moved the attributes to paper space.
- Chspace

- Saveas

- Undo
Back
Y

 

I did two test runs to see if the coordinates that I used above will work and it lined up perfectly.

How would you saveas drawings using a lisp? You have to manually input the drawing name with saveas. 

 

 

 

0 Likes
Message 12 of 18

paullimapa
Mentor
Mentor

This is where lisp comes in. This is what I’m thinking as to the steps to write the lisp code. First make a backup copy of your master dwg and then open this backup copy to start the process. Lisp command will ask for folder location where all your dwgs are that need to be inserted (assuming they are all located in same folder). Then folder location where you want new dwgs to be saved. Then it’ll just cycle through each dwg using the parameters you’ve tested. 
Now I do still have some questions on your answers:

ClassicInsert and 0,0,0 for the base point. 

Is there only one prompt or two prompts for the x scale and y scale?  You could see the responses at the command line


- Deleted the old border from modell space with Erase command and coordinates.
43,560,0
-10,-10,0
870,45,0
700,-10,0

Are the above using in response to Window prompts?

 

Seems like you didn’t mention about the vport zoom scale in the layout of the master dwg. So no adjustment of that was required and you’re able to see everything in model space?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 13 of 18

paullimapa
Mentor
Mentor
Accepted solution

give Dwg2Layout.lsp a test run...


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 14 of 18

daniel_gombosi
Explorer
Explorer

When I use ClassicInsert I don’t see anything regarding the scale. Am i blind?

daniel_gombosi_0-1718832722560.png

 

When I deleted the old border from model space I typed in the coordinates in the command line If that’s what you were asking.
When I insert the drawing in model space the attributes are not visible in paper space, because they are outside the vport.
In paper space I went into the vport and used Select all to select everything. (My Pickadd is set to 2.) If I use Select R and deselect the objects that are visible on paper space and finish the command the attributes will stay selected (because of the pickadd). Then I just use the Chspace and move the attributes from model to paper space.

I will try the file that you attached.

0 Likes
Message 15 of 18

daniel_gombosi
Explorer
Explorer

It works perfectly. 

 

It stopped after 1 drawing and asked me to input Y for the UNDO command. 

 

But I added a Y to this line and now it does all of the drawings that were in the folder.

 

(vl-cmdf "_.Undo" "_Back" "Y")

 

The only thing that it does is that it places the old border on top of the new in paper space. 

It inserts the old border with the same shift as if I would use ClassicInsert in model space. 

Maybe the Erase didn't delete the old border and it was shifted to paper space with the attributes. 

I can live with that. 

daniel_gombosi_0-1718835232904.png

 

I really appreciate your help.  

0 Likes
Message 16 of 18

paullimapa
Mentor
Mentor
Accepted solution

Odd that it required the extra Y for the Undo command sequence. But glad you got it working.

If the old title block is actually a BLOCK (assuming it's not dynamic) then you can include this in the code to automatically select all instances in Model tab and Erase it before going to Tilemode 0:

(if (setq ttlblk (ssget "_X" '((0 . "INSERT")(2 . "Old Title Block Name")(410 . "Model"))))
 (vl-cmdf "_.Erase" ttlblk "")
)

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 17 of 18

daniel_gombosi
Explorer
Explorer

I copied the code before Tilemode 0 and it works.

 

Thank you for your help Paul. I really appreciate it.

0 Likes
Message 18 of 18

paullimapa
Mentor
Mentor

You are welcome…cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes