Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Ellipse 3d -> 2d

  1. #1
    I could stop if I wanted to
    Join Date
    2001-07
    Posts
    319
    Login to Give a bone
    0

    Default Ellipse 3d -> 2d

    Hello,

    I have the following situation: I have a 3d ducting where some intersections are ellipses.
    I'm trying to transform all entities from 3d -> 2d. It's not that hard to achieve that but I'd like to have a routine for this purpose.
    For the lines it quite easy, I just have to put the z coordinates to 0, but I can't figure out how to transform the ellipses with a routine.
    I wonder if there's a function to find the intersection a 2 objects like appint does (osmode 2048 ).

    here 2 ellipses giving the same aspect eventhough the first has z coordinates

    ELLIPSE Layer: "35"
    Space: Model space
    Handle = 13682
    Area: 219382.4893
    Circumference: 1662.3255
    Center: X = 14584.0917, Y = 15996.5971, Z = 0.0000
    Major Axis: X = 103.6951 , Y = 197.7885 , Z = -160.3503
    Minor Axis: X = -179.6051, Y = -46.4852 , Z = -173.4852
    Radius Ratio: 0.9239

    ELLIPSE Layer: "70"
    Space: Model space
    Handle = 13681
    Area: 96458.0357
    Circumference: 1246.7320
    Center: X = 13930.3710, Y = 15996.5971, Z = 0.0000
    Major Axis: X = -191.2389, Y = -185.5943, Z = 0.0000
    Minor Axis: X = 80.2394 , Y = -82.6797 , Z = 0.0000
    Radius Ratio: 0.4323

    I can use Inventor but I'd like to stay in Autocad.

    Any help would be greatly appreciated
    Thanks
    Last edited by clovis; 2011-03-08 at 01:15 PM.

  2. #2
    All AUGI, all the time zoomharis's Avatar
    Join Date
    2005-02
    Location
    Abu Dhabi (Native-India)
    Posts
    506
    Login to Give a bone
    0

    Default Re: Ellipse 3d -> 2d

    How about FLATTEN command in AutoCAD?

  3. #3
    All AUGI, all the time
    Join Date
    2010-10
    Posts
    535
    Login to Give a bone
    0

    Default Re: Ellipse 3d -> 2d

    Quote Originally Posted by zoomharis View Post
    How about FLATTEN command in AutoCAD?
    Here's a simple trick without lisp (like ZoomHarris suggested)

    While your in 3D view.
    command: UCS
    Current ucs name: *WORLD*
    Specify origin of UCS or [Face/NAmed/OBject/Previous/View/World/X/Y/Z/ZAxis]
    <World>: V

    Make a block of the entities, return to UCS world
    insert the block (exploded), then FLATTEN (which is lisp itself <cheater>)

    but its doable with LISP of course

  4. #4
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Ellipse 3d -> 2d

    You can call the Flatten.LSP subroutine with:

    Code:
    (acet-flatn <Selection Set> nil)

  5. #5
    I could stop if I wanted to
    Join Date
    2001-07
    Posts
    319
    Login to Give a bone
    0

    Default Re: Ellipse 3d -> 2d

    Thanks guys but no.
    The flatten.lsp makes a real dirty object, especially with ellipses. An ellipse should remain as ellipse.
    My solution is still without a routine:
    all z coordinates 0.0
    xline1 on bisector of center lines
    xline2 perpendicular to xline1 through center old ellipse

    create ellipse
    -center = center old ellipse
    -major axis = appint xline1 old ellipse
    -minor axis = appint xline2 old ellipse

    with appint = apparent intersection. I have no idea how to find this intersection with lisp

    with a routine
    I'm thinking of offset 0.0001 the old ellipse and erase it
    offset the new spline 0.0001 back

    make a pline from the spline with z=0.0

    find intersection xline1 polyline
    find intersection xline2 polyline

    but it's not as clean as with "appint"

    Thanks for any input

  6. #6
    All AUGI, all the time
    Join Date
    2010-10
    Posts
    535
    Login to Give a bone
    0

    Default Re: Ellipse 3d -> 2d

    Quote Originally Posted by clovis View Post
    Thanks guys but no.
    The flatten.lsp makes a real dirty object, especially with ellipses. An ellipse should remain as ellipse.
    My solution is still without a routine:
    all z coordinates 0.0
    xline1 on bisector of center lines
    xline2 perpendicular to xline1 through center old ellipse

    create ellipse
    -center = center old ellipse
    -major axis = appint xline1 old ellipse
    -minor axis = appint xline2 old ellipse

    with appint = apparent intersection. I have no idea how to find this intersection with lisp

    with a routine
    I'm thinking of offset 0.0001 the old ellipse and erase it
    offset the new spline 0.0001 back

    make a pline from the spline with z=0.0

    find intersection xline1 polyline
    find intersection xline2 polyline

    but it's not as clean as with "appint"

    Thanks for any input

    hmmmmmn, Thats stange..mine turn out just right.. if you dont mind, can you post your "ellipse" drawing here.

  7. #7
    I could stop if I wanted to
    Join Date
    2002-08
    Posts
    231
    Login to Give a bone
    0

    Default Re: Ellipse 3d -> 2d

    I don't know if this can help you, but you can try !
    my_project.lsp

  8. #8
    100 Club
    Join Date
    2000-11
    Location
    Ontario, Canada
    Posts
    116
    Login to Give a bone
    0

    Default Re: Ellipse 3d -> 2d

    In trying to solve this problem, I cobbled together the following:

    Code:
     
    (defun ellfix ( / ELL-LST MODLSPACE NEW-X X-CENTER X-MAJAX X-MINAX X-NEW-MAJAX X-NEW-MINAX X-NORM X-RADRATIO)
      (setq modlspace (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
      (vlax-for n modlspace
        (if (not (equal "AcDbEllipse" (vla-get-objectname n)))
          nil
          (setq ell-lst (append ell-lst (list n)))
          ); if
        ); vlax-for
      (if (> (length ell-lst) 0)
        (progn
          (foreach x ell-lst
            (setq x-norm (vlax-safearray->list (vlax-variant-value (vla-get-normal x)))
                  x-center (vlax-safearray->list (vlax-variant-value (vla-get-center x)))
                  ); setq
            (if (equal (list 0.0 0.0 1.0) x-norm)
              (vl-catch-all-apply 'vla-put-center x (list (vlax-3d-point (list (car x-center) (cadr x-center) 0.0))))
              (progn
                (setq x-ename (vlax-vla-object->ename x)
                      x-majax (trans (vlax-safearray->list (vlax-variant-value (vla-get-majoraxis x))) x-ename 1 T)
                      x-new-majax (list (car x-majax) (cadr x-majax) 0.0)
                      x-minax (trans (vlax-safearray->list (vlax-variant-value (vla-get-minoraxis x))) x-ename 1 T)
                      x-new-minax (list (car x-minax) (cadr x-minax) 0.0)
                      x-radratio (/ (distance (list 0.0 0.0 0.0) x-new-minax) (distance (list 0.0 0.0 0.0) x-new-majax))
                      x-center (trans x-center x-ename 1)
                      ); setq
                (if (= 1.0 x-radratio)
                  (setq new-x (vla-addcircle
                                modlspace
                                (vlax-3d-point (list (car x-center) (cadr x-center) 0.0))
                                (distance (list 0.0 0.0 0.0) x-new-majax)
                                ); vla-addcircle
                        );setq
                  (progn
                    (if (> x-radratio 1.0)
                      (progn
                        (setq x-new-majax x-new-minax
                              x-radratio (/ 1.0 x-radratio)
                              ); setq
                        ); progn
                      ); if
                    (setq
                      new-x (vla-addellipse
                              modlspace
                              (vlax-3d-point (list (car x-center) (cadr x-center) 0.0))
                              (vlax-3d-point x-new-majax)
                              x-radratio
                              ); vla-addellipse
                      ); setq
                    ); progn
                  ); if
                (vl-catch-all-apply 'vla-put-layer (list new-x (vla-get-layer x)))
                (vl-catch-all-apply 'vla-put-linetype (list new-x (vla-get-linetype x)))
                (vl-catch-all-apply 'vla-put-linetypescale (list new-x (vla-get-linetypescale x)))
                (vl-catch-all-apply 'vla-put-lineweight (list new-x (vla-get-lineweight x)))
                (vl-catch-all-apply 'vla-put-material (list new-x (vla-get-material x)))
                (vl-catch-all-apply 'vla-put-plotstylename (list new-x (vla-get-plotstylename x)))
                (vl-catch-all-apply 'vla-put-truecolor (list new-x (vla-get-truecolor x)))
                (vl-catch-all-apply 'vla-put-visible (list new-x (vla-get-visible x)))
                (vl-catch-all-apply 'vla-delete (list x))
                ); progn
              ); if
            ); foreach
          ); progn
        ); if
      ); defun
    Unfortunately, this will work (more-or-less) properly only for 3d-rotated ellipses which have been rotated around either the major or minor axis. If the axis of rotation is not parallel to one of the axes of the ellipse, the apparent shape no longer corresponds to an ellipse, and the new one created by this routine will not be a visual match.

    If there is anything usefull you can cull from this, though, you are welcome to it.

  9. #9
    I could stop if I wanted to
    Join Date
    2001-07
    Posts
    319
    Login to Give a bone
    0

    Default Re: Ellipse 3d -> 2d

    Strange I can't see my last reaction with a dwg to show the result of flatten.
    Anyway, the dirty shape comes when I use flatten with remove hidden lines.
    Thanks to all for your input. I'll check that out!
    Attached Files Attached Files

  10. #10
    All AUGI, all the time
    Join Date
    2010-10
    Posts
    535
    Login to Give a bone
    0

    Default Re: Ellipse 3d -> 2d

    Ahh, now i get it, you're right.

    I think i've seen a code that deals with pipe elevatons/views. I'll look for it and post it here, that is if i can remember where i saw it.

Page 1 of 2 12 LastLast

Similar Threads

  1. Ellipse - Offseted as Ellipse, not as a spline.
    By harilalmn in forum VBA/COM Interop
    Replies: 1
    Last Post: 2009-06-09, 03:34 PM
  2. Ellipse
    By cganiere in forum Revit Architecture - General
    Replies: 4
    Last Post: 2008-08-12, 12:12 AM
  3. A Ellipse
    By clintonc in forum VBA/COM Interop
    Replies: 3
    Last Post: 2007-09-12, 06:41 PM
  4. Ellipse
    By fabrice in forum VBA/COM Interop
    Replies: 3
    Last Post: 2007-06-20, 03:42 PM
  5. ellipse
    By glen.85659 in forum Revit Architecture - Wish List
    Replies: 3
    Last Post: 2005-06-25, 03:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •