Reporting "perimeter" of an "ellipse"

  • Filter
  • Time
  • Show
Clear All
new posts

  • Reporting "perimeter" of an "ellipse"

    Need help on reporting perimeter of an ellipse. I can get length and width NOT Perimeter!!

    I am using v3.5 MR2


  • #2
    If you have length and width give me your math and it can be done

    I just checked the math on that and it can be coded I'm sure. If not with PCDMIS then for sure with a .bas. It is the math I'm not sure about. It looks like the stuff that would be the easiest to code is likely to have some error. If there is a formula that calculates the exact circumference of the ellipse then that is what I need to be educated on. This would require you to be able to measure these dimensions (a & b) of an ellipse:

    This may or may not be the formula:

    When you decide on a formula and how you are going to measure those two dimensions I'll help you out. I am posting this because I have never measured an ellipse (I know nothing about them) so perhaps this can all be done with PCDMIS. I have no idea, I'm not at a machine right now. If someone can measure one and dimension it go with their solution but if PCDMIS just can't get it done let me know. It can be coded. I just don't want to set you up with something that does math for you and hand you a bad formula. I know what that is like (it's embarrassing).

    <internet bumper sticker goes here>


    • #3
      Thanks for your reply.

      It is a large (11.5" x 7") plastic part and out of shape badly (reason why customer want perimeter not major/minor diameter).

      If I can get "5% max error" that should be good enough for now.

      What if I scan the ellipse will it output the length (perimeter)?

      Tons of thanks.


      • #4
        Hello Graig,

        Please help me to set up code using following formula. It claims only 0.4%error !!

        I will make a "linear closed scan" then construct an ellipse by it.


        The YNOT formula

        This formula gives an approximation for the perimeter of an ellipse.

        The perimeter of an ellipse with half-axes a and b is obtained as:

        4 ( ay + by)1/y

        with y = ln(2)/ln(pi/2) ~ 1.534928536...(y is called the YNOT-constant)

        Rewritten as a function of a and the excentricity,e, this formula becomes:

        4a ( 1 + (1-e²)y/2)1/y

        This approximation formula, first proposed by Roger Maertens, makes an error of at most 0.4%.




        • #5
          OK, I'll write something that passes a and b to a script. I'll let you take care of the math part. Give me a bit. It has been hectic here. If I have time I'll do it 2 ways and you can pick which one you want to use.

          <internet bumper sticker goes here>


          • #6
            I googled "circumference of an ellipse" and came up with a plethora of sites. The wikepedia link seems to have numerous versions. Some more exact than others.


            I'm not sure if PCDMIS variables can handle that math. Craig is good with VB and should be able to help more than I.
            Last edited by John Kingston; 09-27-2006, 08:30 AM.
            When in doubt, post code. A second set of eyes might see something you missed.


            • #7
              On a badly shaped elipse it seems the only way to do it is to scan the elipse and add the distances between the scan points together. Assuming X/Y plane
              You will still have to contend with the tip compensation.

              Dim Circumference
              For i = 1 to number of points
              if i <> lastpoint then
              Circumference= Circumference+ SQR((point(i).X-point(i+1).X)^2 +(point(i).Y-point(i+1).Y)^2)
              Circumference= Circumference+ SQR((point(lastpoint).X-point(1).X)^2 +(point(lastpoint).Y-point(1).Y)^2)
              end if
              next i
              Links to my utilities for PCDMIS


              • #8
                Create a .bas with this in it (I named it DoSomeMath.bas and put it on my C:\ drive, you can do what you'd like):

                Sub main(a As Double, b As Double)
                Dim dblTheResult As Double
                dblTheResult = 'do your math here, this is where you perform math on a and b
                Dim strTheFile As String
                strTheFile = "C:\Test.txt"
                Open strTheFile For Output As #1
                Write #1, dblTheResult
                Close #1
                End Sub
                You may need to declare your constant y for doing the math. I'm not here to tell you what formula to use or how to employ it. I need to tread lightly in areas that output a derived result.

                Here is your PCDMIS code:

                            ASSIGN/A_VALUE = where ever your a value comes from goes here
                            ASSIGN/B_VALUE = where ever your b value comes from goes here
                CS1        =SCRIPT/FILENAME= C:\DoSomeMath.BAS
                FPTR       =FILE/OPEN,C:\TEST.TXT,READ
                V1         =FILE/READLINE,FPTR,{THE_RESULT}
                THE_RESULT is the result of the math performed on a and b. You can report that variable as any other (do what you'd like).

                I thought maybe I'd write one that does the math and sets the PCDMIS variable through automation. I have never automated setting a variable in PCDMIS so knowing I could figure it out I am hoping instead someone here will post it and save me the BS (like I said it has been hectic here).

                <internet bumper sticker goes here>


                • #9
                  Thanks EVERYBODY!!

                  I am working on it.


                  • #10
                    Hi.............. Formula method giving me inconsistance readings probably due to out-of-shape. Probably I should stick with "Circumference"

                    Hello cmmguy........... would you help me a bit more to get it work.


                    ELL1 =FEAT/ELLIPSE,RECT,IN
                    THEO/2.9233,0.0015,0.1666,0,0,1,11.5118,7.3303,1,0.0026 ,0
                    DIM LOC1= LOCATION OF ELLIPSE ELL1 UNITS=IN ,$
                    GRAPH=OFF TEXT=OFF MULT=1.00 OUTPUT=BOTH
                    L 11.5118 0.0000 0.0000 11.5664 11.5664 11.5664 0.0546 0.0546 ------>
                    H 7.3303 0.0000 0.0000 7.3852 7.3852 7.3852 0.0550 0.0550 ------>
                    END OF DIMENSION LOC1


                    Thanks !!!


                    • #11
                      I have used the TP scan before but evaluated against CAD, there may be a "circumference" or scan length characteristic already there for scans. Maybe someone else would know.
                      Links to my utilities for PCDMIS


                      Related Topics