Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Please tell me how to zoom(approach) the text block knowing its coordinates

New Here ,
Mar 23, 2011 Mar 23, 2011

an array (x, y) points
Should be closer to the point with coordinates (x1, y1)
Please tell me how to do this?

TOPICS
Scripting
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Mar 24, 2011 Mar 24, 2011

Did you give ZoomAndCenterSelection a try yet?  Works for me

http://www.wundes.com/JS4AI/ZoomAndCenterSelection.js

Translate
Adobe
Guide ,
Mar 23, 2011 Mar 23, 2011

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…

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 23, 2011 Mar 23, 2011

Take a look at www.wundes.com for a script named ZoomAndCenterSelection.jsx.  This should get you going.

Cheers

Doug

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 23, 2011 Mar 23, 2011

Hi Tod, please elaborate on your question, a screen shot on what you're trying to do will help.

something like this??

xyCloserToX1Y1.PNG

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 23, 2011 Mar 23, 2011

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

Untitled-1.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 24, 2011 Mar 24, 2011

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 25, 2011 Mar 25, 2011

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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 28, 2011 Mar 28, 2011

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)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 28, 2011 Mar 28, 2011
LATEST

the problem is in the way .NET handles Arrays, try this

        Dim ctrx = iframe.Left
        Dim ctry = iframe.Top

        idoc.Views(1).CenterPoint = New Object() {ctrx, ctry}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 24, 2011 Mar 24, 2011

Did you give ZoomAndCenterSelection a try yet?  Works for me

http://www.wundes.com/JS4AI/ZoomAndCenterSelection.js

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines