Move form viewport's cent
Hi guys, I'm new to the boards. I was wondering if you could help me. I have never used LISP's before and i think I'm in need to use one.Here's my problem,
I have complied a series of commands in microsoft excel (to later copy to the command line in CAD) to quickly select and zoom to specific parts of my drawing, draw a viewport around it and import it to a specific layout tab. The problem i have is that my viewport is always in the bottom left hand corner of my layout page. Is there something I can do to select a viewport in Pspace and move it (from its center) to a specific coordinate on my layout, using only commands. i.e without any user input from the mouse.
it would be great if some one could help
many thanks
lee Firstly, welcome to the forums Lee, I'm sure you'll like it here
I think you could use the vla-put-center method on the viewport object to move it to the correct position.
I am not sure what you have so far though, so can't really advise much more than that.
Lee Hi, thanks for that,
As I said, I'm completely new to anything to do with LISP's. Is what you just gave me a command in CAD or something you would use in a LISP?
I think my previous post was a bit confusing.
I'll simplify it...
What I'm wanting to do is move a viewport (from its center) to a specific coordinate using only the keyboard, i.e commands that can be typed in. This is just so it looks neat went I send my drawings to clients.
thanks again
lee
Sorry, vla-put-center is a LISP method - I would approach this problem using LISP.
But, using the keyboard only, if you didn't want to stray into LISP, this may be difficult imo.
Lee As an example code:
(defun c:vpmove(/ ent pt) (vl-load-com) (if (and (setq ent (car (entsel "\nSelect Viewport: "))) (eq "VIEWPORT" (cdr (assoc 0 (entget ent)))) (setq pt (getpoint "\nSelect Point to move it to: "))) (vla-put-center (vlax-ename->vla-object ent) (vlax-3D-point pt))) (princ)) thanks again,
I know I probably seem a bit stupid but I have never used LISP's.
I use CAD everyday at work and I understand most things but not lisp's.
how do I make a lisp? I know there is some sort of editor within CAD but i've never had to use it.
lee i am wanting to select the viewport using move and then picking 10,10 (to select the viewport)
then i need to select where to move it from (need this to be its center)
then i need to place it at 165.6,133.5
this will leave it in the middle of my companies titleblock.
Not a problem.
Firstly, do you know how to load and run a LISP?
If not, there is a tutorial here
If there is anything you don't understand about that, just ask.
As for the writing side:
[*]I would suggest using the Visual LISP Editor provided in ACAD, open it by typing VLIDE at the command line. Then go to "File" > "New File" and you can begin writing your code.
[*]If you have never written a LISP before, I would suggest starting with just plain AutoLISP and get competent in that, before maybe moving onto Visual LISP, as this is a bit more involved.
[*]There are loads of tutorial sites you can visit, just Google: AfraLISP, JefferySanders, Ron Leigh.. etc etc
If you need any help on this code, I'd be more than happy to lend a hand.
Lee
This will put the center of the viewport at (165.6 133.5 0.0):
(defun c:vpmove(/ ent) (vl-load-com) (if (and (setq ent (car (entsel "\nSelect Viewport: "))) (eq "VIEWPORT" (cdr (assoc 0 (entget ent))))) (vla-put-center (vlax-ename->vla-object ent) (vlax-3D-point '(165.6 133.5 0.)))) (princ)) thank you very much!
so once the text is inserted into the lisp editor i then save it as a .lsp
and load it.
what do i then type to get the command to work?
will i need to select the viewport manually or can i do it using coordinates?
lee
页:
[1]
2