Author Topic: Zoom Zoom issue  (Read 1822 times)

0 Members and 1 Guest are viewing this topic.

Rabbit

  • Guest
Zoom Zoom issue
« on: January 04, 2013, 10:15:00 AM »
I use this to get where the user is located at on a drawing.
 
Code - Auto/Visual Lisp: [Select]
  1.  (setq ZoomCenter (getvar "viewctr") ZoomViewSize (getvar "viewsize"))

Then when the user gets done selecting a entities on a different part of the drawing, I use this to return them back to where they were.
 
Code - Auto/Visual Lisp: [Select]
  1.  (command "_Zoom" "C" ZoomCenter ZoomViewSize)

My problem comes along when trying to use SSGET to select a block or set of blocks.
What I've come up with works, but I can't figure out how to get the code to zoom back during the COPY command.
Code - Auto/Visual Lisp: [Select]
  1. (setq Block2Insert (ssget))
  2.      (vl-cmdf "_group" "C" "TEMP" "temp" Block2Insert "")
  3.      (vl-cmdf "_copy" "P" "" pause pause)
  4.  

I've tried to put the zoom commands in the vl-cmdf part, and the results were not pretty.
Code - Auto/Visual Lisp: [Select]
  1. (vl-cmdf "_copy" "P" "" pause "z" ZoomCenter ZoomViewSize pause)
  2.  

What does the collective think?

Thanks,
Rabbit

Lee Mac

  • Seagull
  • Posts: 12671
  • London, England
Re: Zoom Zoom issue
« Reply #1 on: January 04, 2013, 10:28:06 AM »
Copy to the ZoomCenter location, then use the Move command?

Rabbit

  • Guest
Re: Zoom Zoom issue
« Reply #2 on: January 04, 2013, 11:01:37 AM »
That's not working.

Code - Auto/Visual Lisp: [Select]
  1. (setq Block2Insert (ssget)
  2.            Groupname "TEMP")
  3.      (vl-cmdf "_group" "C" Groupname "temp" Block2Insert "")
  4.      (vl-cmdf "_copy" "G" Groupname "" pause ZoomCenter)
  5.      (command "_Zoom" "C" ZoomCenter ZoomViewSize)
  6.      (vl-cmdf "_move" "G" Groupname "" ZoomCenter pause)
  7.  

When I use this, the MOVE command moves the original group, not the new group created by the COPY command.
When I use PREVIOUS in the MOVE command, it selects the original group.  When I use LAST in the MOVE command, it selects the last entity place in the new group created by the COPY command.

Maybe I need to look at it in a different way.  I think I'm having trouble with the selection set.  If I get a selection set and COPY it to another location, is there a way to capture all of the new entities in a new selection set?

Lee Mac

  • Seagull
  • Posts: 12671
  • London, England
Re: Zoom Zoom issue
« Reply #3 on: January 04, 2013, 11:58:38 AM »
If I get a selection set and COPY it to another location, is there a way to capture all of the new entities in a new selection set?

You can retrieve the last entity added to the drawing database before the copy operation using the entlast function, and then after the copy command, iterate over all entities added to the database following the stored last entity using the entnext function.

However, the following may be an easier workaround:

Code - Auto/Visual Lisp: [Select]
  1. (setq Block2Insert (ssget))
  2.     "_.copy" Block2Insert "" "_non" '(0 0 0) "_non" '(0 0 0)
  3.     "_.move" Block2Insert "" "\\" "_non" ZoomCenter
  4.     "_.zoom" "_C" "_non" ZoomCenter ZoomViewSize
  5.     "_.move" Block2Insert "" "_non" ZoomCenter "\\"
  6. )

Rabbit

  • Guest
Re: Zoom Zoom issue
« Reply #4 on: January 04, 2013, 02:26:00 PM »
That's definitely did the trick.  I'm not totally sure how, but it did.

I understand that the COPY command copies the selection set from 0,0,0 to 0,0,0.
And, I understand that the MOVE command is moving the original entities and leaving the new entities where they are.
What I don't understand is using "\\".  What is that?  Is it the same and hitting ENTER or using ""?

As a side note, it amazes me how your mind works.  The solutions you come up with are brilliant.

Rabbit

Lee Mac

  • Seagull
  • Posts: 12671
  • London, England
Re: Zoom Zoom issue
« Reply #5 on: January 04, 2013, 06:28:15 PM »
I understand that the COPY command copies the selection set from 0,0,0 to 0,0,0.
And, I understand that the MOVE command is moving the original entities and leaving the new entities where they are.

Correct, I copy the selected set of objects in place and then move the original object set to avoid the need to iterate over the database to collect the new entities.

What I don't understand is using "\\".  What is that?  Is it the same and hitting ENTER or using ""?

Hint:
Code: [Select]
_$ pause
"\\"

The pause symbol is defined on startup but is not a protected symbol and so may be inadvertently localised as an undefined local variable, or even redefined as a local variable; for this reason I tend to avoid its use in code and will use the backslash macro operator directly. The pause symbol itself is merely a convenience to give some meaning to this operator.

As a side note, it amazes me how your mind works.  The solutions you come up with are brilliant.

That's very kind of you to say, I appreciate it; though as they say, we all stand on the shoulders of giants  :-)