A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Charts and Charting
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

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



 
 
Thread Tools Display Modes
  #1  
Old August 27th, 2005, 01:07 AM
Bernard Liengme
external usenet poster
 
Posts: n/a
Default How to Draw an arc which is 1/4 of a circle?

Excel was not designed for this
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Johannes" wrote in message
...
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.




  #2  
Old August 27th, 2005, 04:53 PM
Tushar Mehta
external usenet poster
 
Posts: n/a
Default

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 ,
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.



  #3  
Old August 27th, 2005, 05:58 PM
Andy Pope
external usenet poster
 
Posts: n/a
Default

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
  #4  
Old August 27th, 2005, 11:05 PM
Jean Ruch
external usenet poster
 
Posts: n/a
Default


"Johannes" schrieb im Newsbeitrag
...
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

  #5  
Old August 28th, 2005, 01:13 AM
Jon Peltier
external usenet poster
 
Posts: n/a
Default

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.



 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
1/2 circle Russ learn Powerpoint 6 June 15th, 2005 03:13 PM
How to write text along the circumference of a circle? David F Powerpoint 2 April 23rd, 2005 04:56 AM
Stop giving "create your drawing here" in Word, just let me draw . Mark from Lodz General Discussion 3 January 15th, 2005 03:48 AM
How to draw a line accross sections? John New Users 1 October 1st, 2004 12:50 AM
Draw text Boxes and Control Box Text Boxes ???? Confused steve Worksheet Functions 0 September 19th, 2003 03:07 PM


All times are GMT +1. The time now is 12:48 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.