Jump to content

Recommended Posts

Posted

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.

Posted

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

 

;)

Posted

My approach ...

 

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

 

If Yes T . nil otherwise

Posted
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:

Posted

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>")
   )
 )
)

Posted

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 :)

Posted

pBe,

thanks a lot.

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

Posted
(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>")
           )
       )
   )
)

:)

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

Posted

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.

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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