Article View: adobe.scripting.indesign
Article #19001Re: Different rounded corners
From: Chris Haas
Date: Sun, 26 Jan 2003 01:31
Date: Sun, 26 Jan 2003 01:31
63 lines
3045 bytes
3045 bytes
It's possible to do. I have a script that can do it to one corner. The
problem I'm running into is that when you do it to more than one corner the
paths want to criss-cross. Here's what I have so far, just have a blank ID
document open with the unites set to Points:
[BEGIN CODE]
CONST PI = 3.141592653589793238462
CONST CORNER_PRECISION = 10
CONST RADIUS = 10
Set myIA = CreateObject("InDesign.Application.2.0")
Set myID = myIA.ActiveDocument
Set myIR = myID.Rectangles.Add
myIR.GeometricBounds = Array(100, 100, 200, 200)
myBounds = myIR.GeometricBounds
Set myPPS = myIR.Paths.Item(1).PathPoints
AddPoint myPPS, myBounds(0), myBounds(1) + RADIUS
For A = (90 - CORNER_PRECISION) to (0 + CORNER_PRECISION)
Step -CORNER_PRECISION
Y = Sin((A * PI) / 180) * RADIUS
X = RADIUS - Sqr(RADIUS^2 - Y^2)
AddPoint myPPS, myBounds(0) + (RADIUS - Y), myBounds(1) + X
Next
AddPoint myPPS, myBounds(0) + RADIUS, myBounds(1)
DelPoint myIR, myBounds(0), myBounds(1)
Set myPPS = Nothing
Private Sub AddPoint(ByRef myPPS, ByVal LocTop, ByVal LocLeft)
Dim myPP
Set myPP = myPPS.Add
myPP.Anchor = Array(LocLeft, LocTop)
Set myPP = Nothing
End Sub
Private Sub DelPoint(ByRef myIR, ByVal LocTop, ByVal LocLeft)
Dim myPP
Dim myA
For Each myPP In myIR.Paths.Item(1).PathPoints
myA = myPP.Anchor
If (myA(1) = LocTop) And (myA(0) = LocLeft) Then
myPP.Delete
Exit For
End If
Next
End Sub
[END CODE]
"Ray Street" <dovedale@onetel.net.uk> wrote in message
news:1de77e3e.-1@WebX.la2eafNXanI...
> I'd like to be able to create frames, boxes, with 1, 2 or 3 rounded
corners, not just the in-built choice of 4 rounded corners. I need to be
able to select which corner(s) take the rounded effect too, of course.
>
> I've searched but can't find any reference to this topic in any Windows
group or forum. If I've missed something, please point me in the right
direction.
>
> I found a script in an InDesign Mac group which would seem to do what I
want, but it looked like AppleScript to me.
>
> All help appreciated! Thanks.
Technical Details
Message-ID:
<D71FCABD179B538FCD377DA88A173CA3@in.WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!newsfeed.tpinternet.pl!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de77e3e.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,65895022eaa0d4de X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-01-25 17:38:04 PST From: "Chris Haas" <chrish@ovationadvertising.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!newsfeed.tpinternet.pl!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: Different rounded corners Message-ID: <D71FCABD179B538FCD377DA88A173CA3@in.WebX.la2eafNXanI> Date: Sat, 25 Jan 2003 17:31:16 -0800 References: <1de77e3e.-1@WebX.la2eafNXanI> Lines: 65 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit