Jump to content
Jay Chan

Find Coordinates in ModelSpace Corresponding to Upper Left Corner of PaperSpace

Recommended Posts

Jay Chan

I want to use AutoLISP to determine the coordinates (in term of Model Space) that is corresponding to the upper left corner of a paper-space layout.

 

I see that the upper left corner of the paper-space layout is (0'-0", 0'-0", 0'-0"). But that is just the coordinates in term of the paper-space. That is not the coordinates in term of the Model Space. I want to find out the XY-coordinates in the Model Space corresponding to that (0'-0", 0'-0", 0'-0") in the paper-space.

 

By the way, the paper space layout is created using default setting and it is "Scale to Fit".

 

What I am trying to do is to use EXPORTLAYOUT command to export the paper-space layout into a DWG file. This causes the resulted DWG file to become very small (because EXPORTLAYOUT converts all the 3D objects into 2D). Then I can upload it to AutoCAD-360 without running the risk of exceeding the file size limit in AutoCAD-360. When the user draws some lines in the small DWG file using AutoCAD-360, I want to be able to use an AutoLISP program to automatically copy and paste the lines from that small DWG file onto the master drawing. Obviously I want the lines to be copied to the right spot. Unfortunately, the coordinates in the small DWG file is different from the master drawing. Therefore, the lines are pasted onto the wrong spot. The way to fix this problem is to find out how the paper-space layout is offset from the Model Space.

 

Actually, not only the coordinates in the paper-space layout is different from the Model Space, its scale is also different. Luckily I find a simple way to find out the XY-scale-up-factors to scale the lines back to the original size. Now, I only need to determine the coordinates of the lines.

 

I have spent many days trying to figure this out -- no luck. And I have searched the web without any success. Please help. Thanks.

 

Jay Chan

Share this post


Link to post
Share on other sites
steven-g

I'm not sure how this will work, but take a look at the CHSPACE command, if you have something drawn in paper space this command will transfer it to model space in the correct place and also to the correct scale. It isn't designed for the purpose you are using but it may work.

Share this post


Link to post
Share on other sites
Dana W

Ummm, ah cough cough. 0,0,0 is the lower left, not the upper left.

 

I am not sure there is a coordinate relationship in the two spaces.

 

You could draw a simulated viewport (Rectangle) exactly the same (scaled up) size in modelspace as your paperspace viewport and only draw within it. The lower left corner of that modelspace "view" will be placed on 0,0,0 of course. You can scale up and down all day long and everything inside the rectangle will remain in the same relationship. If you get the scale factor right, the coordinates will always be right.

Share this post


Link to post
Share on other sites
BIGAL

Draw a pline in papespace just inside the mview window use chspace to put it then at current scale into the model. Use Cookie cutter to clip the dwg similar to what Dana has said. Be careful to NO save!

Share this post


Link to post
Share on other sites
Dana W
Draw a pline in papespace just inside the mview window use chspace to put it then at current scale into the model. Use Cookie cutter to clip the dwg similar to what Dana has said. Be careful to NO save!
There is no reason you can't draw the polyline (rectangle usually) right on top of the viewport outline. It will be more accurate than drawing it just inside the viewport frame. In fact it is dead on accurate.

 

Make it a different color.

 

I just tested it. I drew a 4" square in modelspace. On a layout I put up a viewport that was 8.4 wide by 6.4 high and scaled it to 1:2 (or 6" = 1'-0") which made the viewed square drop to 2" in paperspace. Snapped a rectangle right on top of the viewport frame, then selected the rectangle, and typed chspace.

 

The result was that the rectangle moved to modelspace surrounding the object just as it was in paperspace, only it was now 16.8 by 12.8. The relationship of the full scale square I drew in modelspace to the rectangle now in modelspace is exactly the same aspect ratio as the half scale square is to the viewport in paperspace. It works perfectly. Since I have LT I can't test the cookie cutter part, but I think it will work.

Share this post


Link to post
Share on other sites
Jay Chan

Yes, what people said in here are correct. There is no connection between the model space and the small DWG from paper space layout. May be AutoCAD keeps this info internally for that layout. But I don't find an access to that info.

 

I have to add a connection between the model model and the paper space DWG by adding a reference point (a small circle) with unique characteristics at the UCS of the model space. Then I locate that reference point in the small DWG. That's how I find the coordinates of the reference point in the paper space, and I also know that the coordinate of the same reference point in the model space is (0,0,0). And I have already known the scale-up factor to scale the small DWG to the same scale of the original drawing. By knowing the coordinates of the reference point and the scale, I can convert the small DWG file to match to the UCS and the scale of the original drawing. Then the coordinates of an object in the small DWG (coming from paper space layout) are exactly the same as the coordinates of the same object in the model space of the original drawing.

 

Thanks for pointing out that the (0,0) in the paper space layout is in the lower left corner, not in the upper left corner as what I had mistakenly said in the title of this message thread.

 

The other thing is that I decided not to try viewport. The reason is that I am not familiar with viewport. Therefore, I want to stay with something familiar and comfortable.

 

Jay Chan

Share this post


Link to post
Share on other sites
Dana W

Well, you've shied away from the solution by not using the viewport, the rectangle over the viewport, and the chspace command. good luck with your project.

Share this post


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.   Paste as plain text instead

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