Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Distinguished Contributor
kameron1967
Posts: 156
Registered: ‎09-05-2008
Message 31 of 50 (99 Views)

Re: Zoom into a set of coordinates depending depending on selection

12-16-2011 10:30 AM in reply to: alanjt_

Thanks.  I just noticed as well the missing .  I will use your suggestion to overcome the missing period at the end.  Thanks, Alanjt.  I think we've got it.  I really appreciate your help and everyone's excellent inputs.

*Expert Elite*
Kent1Cooper
Posts: 5,278
Registered: ‎09-13-2004
Message 32 of 50 (100 Views)

Re: Zoom into a set of coordinates depending depending on selection

12-16-2011 10:31 AM in reply to: Kent1Cooper

Kent1Cooper wrote:

....  Suppose something that asks the User for the location for position 1A, which corner that's in, and the spacing between columns and rows ....



For instance, the attached [minimally tested].  It requires all column spacings to be equal, and all row spacings, but the column and row spacings can be different from each other.  No defaults yet, or some other things that could be included, etc., but see what you think.

 

Type ZGS for Zoom-to-Grid Setup, to define the origin and direction and spacings, and then ZG to Zoom to a Grid location.

Kent Cooper
Valued Mentor
alanjt_
Posts: 471
Registered: ‎08-25-2008
Message 33 of 50 (98 Views)

Re: Zoom into a set of coordinates depending depending on selection

12-16-2011 10:34 AM in reply to: kameron1967

kameron1967 wrote:

Thanks.  I just noticed as well the missing .  I will use your suggestion to overcome the missing period at the end.  Thanks, Alanjt.  I think we've got it.  I really appreciate your help and everyone's excellent inputs.


No problem.
You *could* also use the other method I posted where it creates a seperate command for each zoom to point.

*Expert Elite*
Kent1Cooper
Posts: 5,278
Registered: ‎09-13-2004
Message 34 of 50 (95 Views)

Re: Zoom into a set of coordinates depending depending on selection

12-16-2011 10:53 AM in reply to: kameron1967

kameron1967 wrote:

....

'(

  ("1A" 108671.99971 220404 0.)

  ("2A" 108671.99971 220044 0.)

  ("3A" 108671.99971 219684 0.)

  ("4A" 108671.99971 219324 0.)

  ("5A" 108671.99971 218964 0.)

....


For that, assuming constant spacings beyond the points included and in the X direction, try ZGS from ZoomToGrid.lsp, picking on that (108671.99971 220404 0.) point when it asks where 1A is, giving it UR [I'm guessing, from your earlier post, though I can't tell from the points included -- maybe UL] for which corner that is, something [I can't tell from the points included] for the column spacing, and 360 for the row spacing [which you can either type in or pick on-screen].  Then use ZG to go to any grid position.  No need to define any positions individually other than 1A.  It will Zoom to relative positions up to 99Z, whether or not you actually use that many, but how many you actually use makes no difference to the routine, because it doesn't keep track of them separately, but just finds the one you want relative to 1A.

 

And of course, if you always have 1A in the upper right, a version could easily be made that would work from that assumption, without asking the User.  Likewise if you always use the same column and/or row spacings.

Kent Cooper
Distinguished Contributor
kameron1967
Posts: 156
Registered: ‎09-05-2008
Message 35 of 50 (86 Views)

Re: Zoom into a set of coordinates depending depending on selection

12-16-2011 11:50 AM in reply to: Kent1Cooper

To answer your question, Kent - the corner would be constant.  I would choose the top right corner to start with and the grids would be going negative (as in the 3rd quadrant).  This is ideal for when the grid rows and columns are uniform in distance.  If you can make it so that we can specify the negative distance -x and -y direction from the point we specify or hard code, that would be awesome.

 

Alan's routine works with inconsistent row heights and column widths.  They of course, require grid coordinates to be generated, but that's fine.  I'm happy with everyone's methods.

Valued Mentor
alanjt_
Posts: 471
Registered: ‎08-25-2008
Message 36 of 50 (83 Views)

Re: Zoom into a set of coordinates depending depending on selection

12-16-2011 11:59 AM in reply to: alanjt_
*Expert Elite*
Kent1Cooper
Posts: 5,278
Registered: ‎09-13-2004
Message 37 of 50 (76 Views)

Re: Zoom into a set of coordinates depending depending on selection

12-16-2011 01:05 PM in reply to: kameron1967

kameron1967 wrote:

To answer your question, Kent - the corner would be constant.  I would choose the top right corner to start with and the grids would be going negative (as in the 3rd quadrant).  This is ideal for when the grid rows and columns are uniform in distance.  If you can make it so that we can specify the negative distance -x and -y direction from the point we specify or hard code, that would be awesome.

....


Here's a version for the 1A location always being in the upper right corner.

 

You will specify the column and row spacing distances without specifying the negative aspect -- that is accounted for in the fact that it's working from the upper right corner.  Using (getdist), you have your choice of either typing in numbers or picking the distances on-screen.  When you pick a distance from right to left or from top to bottom in response to (getdist), it doesn't return a negative distance, but the "absolute-value" raw distance, so the routine is built to work with that, and it will need typed values to be likewise not expressed as negative.

 

When you say "or hard code," do you mean that the column and row spacings are [or might be] always the same?  If so, just change these lines:
 

    _zgdeltaX (getdist "\nHorizontal spacing between grid-location columns: ")
    _zgdeltaY (getdist "\nVertical Spacing between grid-location rows: ")

 

to

 

    _zgdeltaX YourColumnSpacing

    _zgdeltaY YourRowSpacing

 

or, eliminate those lines altogether, and substitute those fixed values in wherever _zgdeltaX and _zgdeltaY occur.

Kent Cooper
*Expert Elite*
Kent1Cooper
Posts: 5,278
Registered: ‎09-13-2004
Message 38 of 50 (74 Views)

Re: Zoom into a set of coordinates depending depending on selection

12-16-2011 01:09 PM in reply to: Kent1Cooper

Kent1Cooper wrote:

....
For instance, the attached [minimally tested].  ....


Change the top line of the original ZoomToGrid.lsp file to

 

(defun C:ZGS (/ zg1A); = Zoom-to-Grid Setup

 

[I had commented out the localizing of that variable for testing, and just noticed that I hadn't put it back.]

Kent Cooper
Distinguished Contributor
kameron1967
Posts: 156
Registered: ‎09-05-2008
Message 39 of 50 (68 Views)

Re: Zoom into a set of coordinates depending depending on selection

12-16-2011 01:22 PM in reply to: alanjt_

Alanjt - where is this inserted?  There was an error message previously (due to my mistake) so I never tested it.  There's several versions, I'm lost which one to insert it into..

 

(foreach zoom '(("1A" 1. 1. 0.) ("1B" 1. 2. 0.) ("1C" 1. 3. 0.) ("1D" 1. 4. 0.))
  (eval (list 'defun
              (read (strcat "c:" (car zoom)))
              nil
              (list 'vla-zoomcenter
                    '(vlax-get-acad-object)
                    (vlax-3d-point (cdr zoom))
                    '(* (getvar "VIEWSIZE") 0.02)
              )
              '(princ)
        )
  )
)

Valued Mentor
alanjt_
Posts: 471
Registered: ‎08-25-2008
Message 40 of 50 (65 Views)

Re: Zoom into a set of coordinates depending depending on selection

12-16-2011 01:24 PM in reply to: kameron1967

kameron1967 wrote:

Alanjt - where is this inserted?  There was an error message previously (due to my mistake) so I never tested it. 



Where is what inserted?

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community