Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Paper space location in model space 1

Status
Not open for further replies.

kpetursson

Programmer
Jan 28, 2002
313
US
We've got drawings of grian elevators that are 200' tall. We draw 1 to 1 in model space, and put our title block on paper space and use view ports. I don't want the elevator to appera in one view port, I want to show only several sections of it. Once I have the view ports set up the way I want, to show that way I want, I would like to be able to go into model space and be able to see out lines of the view ports. IE. what, in model space, is shown in each view port?

Any help would be greatly appriciated.


Kevin Petursson

Dogs come when they're called.
Cats come when they're interested!
 
Hi,

I don't know of any way AutoCAD can show where on modelspace the paperspace viewports are viewing!!

Why don't you create a layer that doesn't plot, called VP-Model. Then you can draw rectangles on the modelspace drawing where you want the viewports to show. Then, in paperspace, pan the drawing in each viewport to show the box(es) that you just added. Alternatively, jst draw the rectangles from within the paperspace viewports directly - that way you can draw exactly at the viewport edges..
When you plot the VP-Model layer won't appear on the final printout..

I know it's probably not the best way around it but it'll work..

Let me know if it works for you..

Cheers,

Paul @ Bullet-Proof Designz..


BULLET-PROOF DESiGNZ
renegade@tiscali.co.uk
 
thats what we currently do.
It's a real pain.
I was hoping someone might know of a lisp routine that could fine our what the extents of the viewport are, and drawing them in model space.


Kevin Petursson

Dogs come when they're called.
Cats come when they're interested!
 
Does any one have autoCAD express tool for autocad 2002?
Could you post the code here, from the lisp routine chspace.lsp?

The code would be greatly appriciated!



Kevin Petursson

Dogs come when they're called.
Cats come when they're interested!
 
The following the the lisp routine I created.
You can use it as you wish.

If you have any suggentions please post them!

;Program Name: port
;Description: This program will draw a polyline in model space at the extents of the current view port.
; The polyline will be drawn on layer Viewport.
; The user must be inside a viewport when this command is run
;
;Programmer: Kevin Petursson
;Date: July 16, 2003
;Revision: 1.0
;
;
(defun C:port (/ VPctr TMode VP VPsize Currentlayer temp LL UR ctrx ctry LLx LLy URx URy ModelWidth p1 p2 p3 p4)
(setvar "CMDECHO" 0)
(setq VPctr (getvar "VIEWCTR")) ;centrepoint of viewport
(setq TMode (getvar "tilemode"))
(setvar "tilemode" 0)
(setq VP (vports)) ;Get info on the viewports
(setq VPsize (getvar "Viewsize")) ;get the height in model space of the current view port
(setq Currentlayer (getvar "clayer")) ;Get the current layer
;Change the following line to draw the polyline on a different layer
(setvar "clayer" "Viewport") ;Set the current layer to Viewport
(setq temp (nth 0 VP))
(setq LL (nth 1 temp))
(setq UR (nth 2 temp))

(setq
ctrx (nth 0 VPctr)
ctry (nth 1 VPctr)
LLx (nth 0 LL)
LLy (nth 1 LL)
URx (nth 0 UR)
URy (nth 1 UR)
ModelWidth (* (- URx LLx) (/ VPsize (- LLy URy)))
)
(setq
p1 (list (- ctrx (/ modelwidth 2)) (- ctry (/ VPsize 2)))
p2 (list (- ctrx (/ modelwidth 2)) (+ ctry (/ VPsize 2)))
p3 (list (+ ctrx (/ modelwidth 2)) (+ ctry (/ VPsize 2)))
p4 (list (+ ctrx (/ modelwidth 2)) (- ctry (/ VPsize 2)))
)

(command "pline" p1 p2 p3 p4 "close")
(setvar "clayer" currentlayer) ;Reset the current layer
(setvar "tilemode" TMode)
(setvar "CMDECHO" 1)
(princ)
)

Kevin Petursson

Dogs come when they're called.
Cats come when they're interested!
 
i added this code just before the (setvar "clayer" viewport")

(command "-layer" "make" "viewport" "p" "no" "viewport" "")

this creates the layer and it does not plot. tried the routine several times and it works great. I work at an engineering firm and the "drawspace rectangle" as we call it is a pain- this relieves a lot of that pain.
 
Our standard template has the Viewport layer. Thats why I did not create it.
I'm glad I could help.
Everyone around here loves it too.

I'm still looking at being able to loop through the code so it will draw all of the view ports, instead of one at a time.

Any help would be greatly appriciated.



Kevin Petursson

Dogs come when they're called.
Cats come when they're interested!
 
Kevin, I just tuned in and looked at your routine. You really spent some time on this. You deserve a star.

Mabjro
 
Thanks.

But it only took a couple of hours.

I enjoy programming for autoCAD (both in LISP and VBA).

SO if anyone needs autoCAD to do something easier then it does now...

Post it up here.



Kevin Petursson

Dogs come when they're called.
Cats come when they're interested!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top