# How to distinguish between Ellipse and Ellipse Arc?

## Recommended Posts

how is it possible to recognize an ellipse object is closed (i.e. full ellipse) or open (i.e ellipse arc)?

##### Share on other sites

```(if
(= StartAngle 0)
(Closed/FullEllipse)
(Open/EllipseArc)
)
```

##### Share on other sites

My approach ...

```(vlax-curve-IsClosed (car (entsel "\n Select Ellipse :")))
```

If Yes T . nil otherwise

##### Share on other sites

Good one tharwat

I didint know that one

##### Share on other sites
Good one tharwat

I didint know that one

Thank you pBe ,

I knew these functions which are start with vlax-curve-****** when I was fighting with Polylines to know how to handle them .

So no chance to forget them anymore .

Cheers .

##### Share on other sites

pBe and Tharwat,

thank you very much for your help.

Meanwhile I researched inside Ellipse and Ellipse Arc lists. I found a dxf code inside them which shows whether ellipse is closed or not.

The advantage of the following code is filtering them automatically or on the fly (when selecting objects).

```(setq ellipses
(ssget "X"
(list
(cons -4 "<AND")
(cons 0 "ELLIPSE")
(cons 41 0)
(cons -4 "AND>")
)
)
)

(setq ellipsearcs
(ssget "X"
(list
(cons -4 "<AND")
(cons 0 "ELLIPSE")
(cons -4 "<NOT")
(cons 41 0)
(cons -4 "NOT>")
(cons -4 "AND>")
)
)
)
```

##### Share on other sites

That is correct though

` (ssget "X" '((0 . "ELLIPSE") (41 . 0)))`

would be enough for filter list

I was too engrossed with vlaobjects to think about a simple syntax with vanilla

Good stuff Ahankhah

##### Share on other sites

pBe,

thanks a lot.

everything you explain is very clear, unless you name pBe

##### Share on other sites
```(if
(= StartAngle 0)
(Closed/FullEllipse)
(Open/EllipseArc)
)
```

Not quite.

Consider:

```(entmakex
(list
(cons 0 "ELLIPSE")
(cons 100 "AcDbEntity")
(cons 100 "AcDbEllipse")
(list 10 0.0 0.0 0.0)
(list 11 1.0 0.0 0.0)
(cons 40 0.5)
(cons 41 0.0)
(cons 42 pi)
)
)```

Meanwhile I researched inside Ellipse and Ellipse Arc lists. I found a dxf code inside them which shows whether ellipse is closed or not.

```(setq ellipses
...
)

(setq ellipsearcs
...
)
```

This won't work for the above counter example, consider the following instead:

```(defun c:ellipses nil
(sssetfirst nil
(ssget "_X"
(list
(cons 0 "ELLIPSE")
(cons 41 0.0)
(cons 42 (* 2 pi))
)
)
)
)

(defun c:ellipsearcs nil
(sssetfirst nil
(ssget "_X"
(list
(cons 0 "ELLIPSE")
(cons -4 "<OR")
(cons -4 "<>")
(cons 41 0.0)
(cons -4 "<>")
(cons 42 (* 2 pi))
(cons -4 "OR>")
)
)
)
)```

##### Share on other sites
Not quite.

I realize that right after i posted.

Consider:

```(defun c:ellipses nil
......                (cons 42 (* 2 pi)) ......
)
)
)
)
```

Really? Guess i ddnt do a thorough test

Thank you for the info.

##### Share on other sites

This won't work for the above counter example, consider the following instead...

Lee, I am surprised of your excellent look and observing all side effects of any code:o.

Again and again and again..., thank you very much:D.

##### Share on other sites
Lee, I am surprised of your excellent look and observing all side effects of any code:o.

A side effect I suppose from studying a maths degree involving countless proofs...

You're welcome Ahankhah

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.