Jump to content

Recommended Posts

Posted

At my last job they had a command or a lisp that took the exact shape of your view port and moved that same shape to the model space. This way you knew your drawing limits, so you got everything to show up in your view port.

 

Any suggestions?

 

Thank you!!

Posted

Draw a rectangle (or polyline) over your viewport, then use Chspace.

Posted

Lsp,

 

that's what I'm doing now. at my last job.. all i had to do is select the view port and it would do that for me. It does it so you don't have to draw a rect. and then chspace. Type " whatever it was" and select the vp.

Posted

I would love to be able to write it myself. I just have no clue how to create a lisp. I do want to learn, just really busy at work. I'm working in New Orleans rebuilding the levees and pump stations. 60 to 70 hour weeks. I was hoping someone had it available already.

Posted

Did this up real quick. Won't let you select the viewport, only works for the first viewport on the layout tab. If you only have one viewport on your layout, it should work just fine.

 

It basically does what you're doing, only automatically.

 

(defun c:vex()
 (setq osnapz (getvar "osmode"))
 (setvar "osmode" 0)
 (command "rectang" (cadr (cadr (vports))) (caddr (cadr (vports))))
 (command "chspace" (entlast) "")
 (command "pspace")
 (setvar "osmode" osnapz)
 )

Posted

Just buildin on that:

 

(defun c:vex  (/ osnapz vp vpID)
 (setq osnapz (getvar "osmode"))
 (if (and (setq vp (car (entsel "\nSelect Viewport: ")))
          (eq "VIEWPORT" (cdadr (entget vp))))
   (progn
     (setq vpID (cdr (assoc (cdr (assoc 69 (entget vp))) (vports))))
     (setvar "osmode" 0)
     (command "rectang" (car vpID) (cadr vpID))
     (command "chspace" (entlast) "")
     (command "pspace")))
 (setvar "osmode" osnapz)
 (princ))

Posted
Just buildin on that:

 

(defun c:vex  (/ osnapz vp vpID)
 (setq osnapz (getvar "osmode"))
 (if (and (setq vp (car (entsel "\nSelect Viewport: ")))
          (eq "VIEWPORT" (cdadr (entget vp))))
   (progn
     (setq vpID (cdr (assoc (cdr (assoc 69 (entget vp))) (vports))))
     (setvar "osmode" 0)
     (command "rectang" (car vpID) (cadr vpID))
     (command "chspace" (entlast) "")
     (command "pspace")))
 (setvar "osmode" osnapz)
 (princ))

 

Nicely done, Lee. I was going to do something like that, but became daunted at the prospect of selection, checking to see if the selection was a viewport, and getting the limits from assoc 10, 40 and 41 and a bit of math. Should have known you'd come up with a slicker solution. ^^

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