PC Review


Reply
Thread Tools Rate Thread

How to Draw an arc which is 1/4 of a circle?

 
 
=?Utf-8?B?Sm9oYW5uZXM=?=
Guest
Posts: n/a
 
      27th Aug 2005
Is there a way to draw an arc which is 1/4 of a circle?
It looks like Shapes.addcurve only draw bezier curve, but how do I make the
curve a 1/4 of a circle?

I also tried Shapes.BuildFreeForm().AddNodes(), but I couldn't get it to
draw 1/4 of a circle.


 
Reply With Quote
 
 
 
 
Bernard Liengme
Guest
Posts: n/a
 
      27th Aug 2005
Excel was not designed for this
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Johannes" <(E-Mail Removed)> wrote in message
news:335935A3-9735-4BDF-82AD-(E-Mail Removed)...
> Is there a way to draw an arc which is 1/4 of a circle?
> It looks like Shapes.addcurve only draw bezier curve, but how do I make
> the
> curve a 1/4 of a circle?
>
> I also tried Shapes.BuildFreeForm().AddNodes(), but I couldn't get it to
> draw 1/4 of a circle.
>
>



 
Reply With Quote
 
Tushar Mehta
Guest
Posts: n/a
 
      27th Aug 2005
As Bernard noted, XL really isn't ideal for this, but you can use the
Office-level capabilities to your advantage. Turn on the macro
recorder (Tools | Macro > Record new macro...) to get the code for the
below:

Create a circle with the Drawing toolbar's Oval button (hold down SHIFT
to force a circle rather than a generic oval).

Select this circle and copy + Paste Special | Image (PNG) format.

Select the pasted object and from the Picture toolbar (it should show
up automatically when the graphic is selected), use the Crop button to
crop the appropriate horizontal 1/2 and the appropriate vertical 1/2.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article <335935A3-9735-4BDF-82AD-(E-Mail Removed)>,
(E-Mail Removed) says...
> Is there a way to draw an arc which is 1/4 of a circle?
> It looks like Shapes.addcurve only draw bezier curve, but how do I make the
> curve a 1/4 of a circle?
>
> I also tried Shapes.BuildFreeForm().AddNodes(), but I couldn't get it to
> draw 1/4 of a circle.
>
>
>

 
Reply With Quote
 
Andy Pope
Guest
Posts: n/a
 
      27th Aug 2005
Hi,

Here is a function that will draw a freeform arc.
The separate x and y radius allow you to draw ovals.

'-------------------------------
Sub FourQuadarents()
Dim shpArc As Shape

Set shpArc = CreateArc(100, 100, 0, 90)
Set shpArc = CreateArc(100, 100, 90, 180)
Set shpArc = CreateArc(100, 100, 180, 270)
' colour segement
CreateArc(100, 50, 270, 360).Fill.ForeColor.SchemeColor = 43

End Sub

Function CreateArc(XRadius As Single, YRadius As Single, _
StartAngle As Single, EndAngle As Single) As Shape
'
Dim intAngle As Integer
Dim dblA1 As Double
Dim dblB1 As Double
Dim dblA2 As Double
Dim dblB2 As Double
Const PI = 3.14159265358979

With ActiveSheet.Shapes.BuildFreeform( _
msoEditingAuto, XRadius, YRadius)
For intAngle = StartAngle To EndAngle
dblA2 = XRadius + (Cos((intAngle * (PI / 180))) * XRadius)
dblB2 = YRadius - (Sin((intAngle * (PI / 180))) * YRadius)
.AddNodes msoSegmentLine, msoEditingAuto, dblA2, dblB2
Next
.AddNodes msoSegmentLine, msoEditingAuto, XRadius, YRadius
Set CreateArc = .ConvertToShape
End With

End Function

Cheers
Andy

Johannes wrote:
> Is there a way to draw an arc which is 1/4 of a circle?
> It looks like Shapes.addcurve only draw bezier curve, but how do I make the
> curve a 1/4 of a circle?
>
> I also tried Shapes.BuildFreeForm().AddNodes(), but I couldn't get it to
> draw 1/4 of a circle.
>
>


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
 
Reply With Quote
 
Jean Ruch
Guest
Posts: n/a
 
      27th Aug 2005

"Johannes" <(E-Mail Removed)> schrieb im Newsbeitrag
news:335935A3-9735-4BDF-82AD-(E-Mail Removed)...
> Is there a way to draw an arc which is 1/4 of a circle?
> It looks like Shapes.addcurve only draw bezier curve, but how do I

make the
> curve a 1/4 of a circle?
>
> I also tried Shapes.BuildFreeForm().AddNodes(), but I couldn't get it

to
> draw 1/4 of a circle.



hello Johannes,

You always have the possibility to use standard equations of a cicle
(in cartesian or better polar coordinates)

You will for example get half a circle with positive y-values and
centered on the origin
(simplest version) if you put:

in Column AA from A3 to A39 a series from 0 to 180, step 5

in column B (standing for x= OP *cos (theta) = rho * cos (theta))
with the formula
in B3=2*$E$1*COS(D3*PI()/180)

The figure in E1 stands for the radius of your circle

in column C, corresponding to y = OPsin Theta = rho sin Theta with the
Formula

in C3 =2*$E$1*SIN(D3*PI()/180)

Make your diagram from the Range B3:C39

If you want a complete circle centered on the origin,

complete the series in Column A up to 360
and copy down the formulas in Columns B and C
the new range for your diagram will be B3:C75


take care that the x and y axes have the same absolute size for the
same values....

If you want only the first quadrant ( in the trigonometric sense),
limit the Diagram

for equivalent 0 to 90 ° i.e use the Range B3:C21


You are free to choose any angle you want for the beginning of your
curve
(the first column corresponds to values in °); Your 1/4 circle should
end for a value in ° incremented with + 90 in your first Column)


regards

Jean

 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      28th Aug 2005
One of the AutoShapes is an arc, and if you hold down Shift while drawing it, the
arc will be constrained to equal height and width. If you turn on the macro
recorder, you will get the following code:

ActiveSheet.Shapes.AddShape(msoShapeArc, 350.25, 63.75, 114#, 114#).Select

where the four numerical arguments are the left, top, width, and height of the arc.
The default height is the top right (North to East) quadrant of the circle, but you
can use a combination of

Selection.ShapeRange.Flip msoFlipHorizontal
Selection.ShapeRange.Flip msoFlipVertical

to orient the arc the way you want it.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Johannes wrote:
> Is there a way to draw an arc which is 1/4 of a circle?
> It looks like Shapes.addcurve only draw bezier curve, but how do I make the
> curve a 1/4 of a circle?
>
> I also tried Shapes.BuildFreeForm().AddNodes(), but I couldn't get it to
> draw 1/4 of a circle.
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
draw a circle that looks like someone circled it with a pen? shanelle_88 Microsoft Powerpoint 3 28th Apr 2009 01:23 AM
Draw a circle in WPF Tem Microsoft C# .NET 0 31st Oct 2007 02:13 AM
Draw a circle in WPF Tem Microsoft C# .NET 7 29th Oct 2007 07:31 PM
How do I draw a co-centric circle? =?Utf-8?B?Um9zaWU=?= Microsoft Word Document Management 2 12th Jul 2007 04:58 PM
How do I draw a circle around text =?Utf-8?B?RnV6enkxOTQ5?= Microsoft Word Document Management 4 17th Apr 2007 05:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:10 PM.