Copy link to clipboard
Copied
an array (x, y) points
Should be closer to the point with coordinates (x1, y1)
Please tell me how to do this?
Did you give ZoomAndCenterSelection a try yet? Works for me
Copy link to clipboard
Copied
From your other post I gather you are using VB? If that is the case their may be a VB command outside of the Illustrator DOM that you could use? (Carlos would probably tell you that)… Anyhow Illustrator offers no zoom to some bounds. It does have access to views but these need to be saved in the document script can't create n use a new view…
Copy link to clipboard
Copied
Take a look at www.wundes.com for a script named ZoomAndCenterSelection.jsx. This should get you going.
Cheers
Doug
Copy link to clipboard
Copied
Hi Tod, please elaborate on your question, a screen shot on what you're trying to do will help.
something like this??
Copy link to clipboard
Copied
Thanks to everyone for help
I need to know the coordinates of the Point (x, y) to find it on the sheet, and zoom (closer) to it
Copy link to clipboard
Copied
I think the only way to make this possible is to use a trick by Carlos where you temp change the artboard bounding box to some area about your (x,y). After which an action could 'fit in window' but this would rule out using JS and only possible via AS & VB.
Copy link to clipboard
Copied
Hi Tod, pretending the TEXT (x,y) is out of sight somewhere, this sample will bring it to the center of the screen.
Sub ScreenCtrPoint()
Dim iapp As New Illustrator.Application
Dim idoc As Illustrator.Document
Dim iframe As Illustrator.TextFrame
Set idoc = iapp.ActiveDocument
Set iframe = idoc.TextFrames(1)
ctrx = iframe.left
ctry = iframe.top
idoc.Views(1).centerPoint = Array(ctrx, ctry)
iapp.Redraw
Set iframe = Nothing
Set idoc = Nothing
Set iapp = Nothing
End Sub
Copy link to clipboard
Copied
Dim iapp As New Illustrator.Application
Dim idoc As Illustrator.Document
Dim iframe As Illustrator.TextFrame
idoc = iapp.ActiveDocument
iframe = idoc.TextFrames(1)
Dim ctrx = iframe.Left
Dim ctry = iframe.Top
Dim a() As Decimal = {ctrx, ctry}
MsgBox(a(0) & " " & a(1))
idoc.Views(1).CenterPoint = a
iapp.Redraw()
iframe = Nothing
idoc = Nothing
iapp = Nothing
Not as wrong, an exception occurs, help me understand!!!
"MsgBox"
251,42431640625 584,00439453125
OK
ERROR
Value does not fall within the expected range.
System. Argument Except ion: Value does not fall within the expected range.
in the System. RuntimeType.ForwardCallToInvokeMember (5tring member Heme, BindingFlags flags, Object target, Int32 [] a Wrapper Types, MessageData & msgData)
in Illustrator.View.set_CenterPoint (Object)
Copy link to clipboard
Copied
the problem is in the way .NET handles Arrays, try this
Dim ctrx = iframe.Left
Dim ctry = iframe.Topidoc.Views(1).CenterPoint = New Object() {ctrx, ctry}
Copy link to clipboard
Copied
Did you give ZoomAndCenterSelection a try yet? Works for me
Find more inspiration, events, and resources on the new Adobe Community
Explore Now