Autolisp making a trapezoid

Autolisp making a trapezoid

Anonymous
Not applicable
773 Views
4 Replies
Message 1 of 5

Autolisp making a trapezoid

Anonymous
Not applicable

Good day,

 

Please help me making a trapezoid using autolisp.

Length of Bottom, Height and Length at Top are the requirement.

 

Thank You.

0 Likes
774 Views
4 Replies
Replies (4)
Message 2 of 5

martti.halminen
Collaborator
Collaborator

@Anonymous wrote:

Good day,

 

Please help me making a trapezoid using autolisp.

Length of Bottom, Height and Length at Top are the requirement.

 

Thank You.


Insufficient specification, there are  infinitely many  possible trapezoids fulfilling those requirements. You'll need to define additionally at least one angle.

 

-- 

 

0 Likes
Message 3 of 5

CADaSchtroumpf
Advisor
Advisor

Hi,

 

I suggest an old code (ten years ago!)

 

But for begin it's good base...

0 Likes
Message 4 of 5

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:
....

Insufficient specification.... You'll need to define additionally at least one angle.

 


... or, that it should be an isosceles trapezoid -- that would be enough information, if that's what is needed.

 

But I would also want to know:  The User should presumably be asked for some location point, which should be -- what?  The midpoint of the bottom edge?  The overall middle [halfway between the midpoints of opposite edges?  The lower left corner?  Something else?

 

In super-simple terms, with isosceles shape and the midpoint of the bottom as specified location:

 

(defun C:TRAPI (/ base bottom height top); = TRAPezoid, Isosceles
  (setq
    base (getpoint "\nMidpoint of bottom edge: ")
    bottom (getdist "\nLength of bottom edge: ")
    height (getdist "\nHeight: ")
    top (getdist "\nLength of top edge: ")
  ); setq
  (command "_.pline"
    "_none" (polar base pi (/ bottom 2))
    "_none" (polar base 0 (/ bottom 2))
    "_none" (polar (polar base (/ pi 2) height) 0 (/ top 2))
    "_none" (polar (polar base (/ pi 2) height) pi (/ top 2))
    "_close"
  ); command
); defun
Kent Cooper, AIA
0 Likes
Message 5 of 5

stevor
Collaborator
Collaborator

 

Here is a start;

 ;  Ortho Symmetric Trapazoid   scg
 (defun C:OST (/ HBW HTW HPI P1 P2 P3 P4  BMP )
  (setvar 'osmode 0)(setvar 'orthomode 0)  
  (if (setq DBW (Get_d BBW "\n Base Width: ")
            DTW (Get_d DTW "\n Top Width: ")
            DTH (Get_d DTH "\n Top Height: ")
            BMP (getpoint  "\n Base Midpoint: ") ) ;  
    (progn
     (setq HBW (/ DBW 2)  HTW (/ DTW 2)  HPI (/ pi 2)
           P1  (polar BMP PI HBW)   P2 (polar BMP 0 HBW)
           PMT (polar BMP HPI DTH)
           P4  (polar PMT PI HTW)   P3 (polar PMT 0 HTW))
     (command "pline" P1 P2 P3 P4 "C")  
    ) (princ "Nyet "))  (princ))  
  ; DO:   ( C:OST )

S
0 Likes