How can I find out the start point and end point given centerX, CenterY, Radius, StartAngle, and Endangle

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
gildea715
Posts: 28
Joined: Fri Mar 11, 2022 7:28 pm

How can I find out the start point and end point given centerX, CenterY, Radius, StartAngle, and Endangle

Post by gildea715 »

When I get a content of a sketch, it doesn't give me the any start and endpoint of a arc. It only give me centerX, CenterY, Radius, StartAngle, and Endangle. I have attempted to find the start and endpoint by my own but my method work in most of time but fail in some cases. Is there a way that I can get the start and end point from FreeCad directly or is there any built in Freecad python function that can help me find the start and end point

Code: Select all

                    
                <Geometry  type="Part::GeomArcOfCircle">
                    <GeoExtensions count="0">
                    </GeoExtensions>
                    <ArcOfCircle CenterX="-3524.25" CenterY="-5822.95" CenterZ="0" NormalX="0" NormalY="0" NormalZ="1" AngleXU="-0" Radius="50.8" StartAngle="3.14159" EndAngle="4.71239"/>
                </Geometry>

A line segement below will give me start and end point.

Code: Select all

                <Geometry  type="Part::GeomLineSegment">
                    <GeoExtensions count="0">
                    </GeoExtensions>
                    <LineSegment StartX="-3524.25" StartY="-5873.75" StartZ="0" EndX="-1803.4" EndY="-5873.75" EndZ="0"/>
                </Geometry>

OS: Windows 10 Version 2009
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24267 +99 (Git)
Build type: Release
Branch: Branch_0.19.3
Hash: 6530e364184ce05ccff39501e175cf2237e6ee4b
Python version: 3.8.6+
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.5.3
Locale: English/United States (en_US)
User avatar
wandererfan
Veteran
Posts: 6317
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: How can I find out the start point and end point given centerX, CenterY, Radius, StartAngle, and Endangle

Post by wandererfan »

gildea715 wrote: Wed Jul 13, 2022 9:59 pm When I get a content of a sketch, it doesn't give me the any start and endpoint of a arc. It only give me centerX, CenterY, Radius, StartAngle, and Endangle. I have attempted to find the start and endpoint by my own but my method work in most of time but fail in some cases.
Might need some fiddling depending on the range of the angles, but something like this should work.

Code: Select all

startUnit = App.Vector(math.cos(startAngle), math.sin(startAngle), 0.0)
startPoint = App.Vector(centerX, centerY, 0.0) + startUnit * radius
endUnit = App. Vector(math.cos(endAngle), math.sin(endAngle), 0.0)
endPoint = App.Vector(centerX, centerY, 0.0) + endUnit * radius
gildea715
Posts: 28
Joined: Fri Mar 11, 2022 7:28 pm

Re: How can I find out the start point and end point given centerX, CenterY, Radius, StartAngle, and Endangle

Post by gildea715 »

Thank you so much! This solved my problem. Very much appreciated!
Post Reply