Jump to content
Ahankhah

How to distinguish between Ellipse and Ellipse Arc?

Recommended Posts

Ahankhah

Hi CADmates,

 

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

 

Any reply appreciated.

Share this post


Link to post
Share on other sites
pBe

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

 

;)

Share this post


Link to post
Share on other sites
Tharwat

My approach ...

 

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

 

If Yes T . nil otherwise

Share this post


Link to post
Share on other sites
pBe

Good one tharwat

I didint know that one :)

Share this post


Link to post
Share on other sites
Tharwat
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 .:lol:

 

So no chance to forget them anymore . :lol:

 

Cheers . :beer:

Share this post


Link to post
Share on other sites
Ahankhah

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 this post


Link to post
Share on other sites
pBe

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 this post


Link to post
Share on other sites
Ahankhah

pBe,

thanks a lot.

everything you explain is very clear, unless you name pBe 8)

Share this post


Link to post
Share on other sites
Lee Mac
(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 this post


Link to post
Share on other sites
pBe
Not quite.

 

:lol: I realize that right after i posted.

 

Consider:

consider the following instead:

 

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

 

 

Really? Guess i ddnt do a thorough test :)

 

Thank you for the info.

Share this post


Link to post
Share on other sites
Ahankhah

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 this post


Link to post
Share on other sites
Lee Mac
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 :)

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...