andy_lee Posted August 27, 2014 Posted August 27, 2014 Hi guys Have a routine like this? Thanks for any help! Enter the value of the " L " and " H" , pick a basic point , Dynamic specified direction. Draw an isosceles trapezoid. Dynamic specified direction Quote
BIGAL Posted August 27, 2014 Posted August 27, 2014 A good start for learning lisp very easy just a couple of commands think of it as 5 pts 1st point is pick point then using new pt = polar angle distance or old fashioned trig can work out all the corners then create pline pt1 pt2 pt3 pt4 C and then rotate. Quote
Tharwat Posted August 27, 2014 Posted August 27, 2014 Try this Andy and let me know (defun c:Test (/ dtr ac ab p sl a b c d e p) ;; Author : Tharwat Al Shoufi ;; ;; Draw Trapezoid with angle 55 on the two sides ;; ;; -------------------------------------------------- ;; (defun dtr (a) (* pi (/ a 180.0))) (if (not *traplen*) (setq *traplen* 10.0) ) (if (not *traphgt*) (setq *traphgt* 4.0) ) (if (and (setq *traplen* (cond ((getdist (strcat "\n Specify Length of Trapezoid < " (rtos *traplen* 2 2) " > :"))) (*traplen*) ) ) (setq *traphgt* (cond ((getdist (strcat "\n Specify Height of Trapezoid < " (rtos *traphgt* 2 2) " > :"))) (*traphgt*) ) ) (setq ac (/ *traphgt* (sin (dtr 55.))) ab (* ac (cos (dtr 55.))) ) (if (>= (setq sl (- *traplen* (+ ab ab))) 0.) (setq p (getpoint "\n Specify top center point of Trapezoid :")) (progn (alert "Length of Trapezoid is too small !!") nil) ) ) (progn (setq a (polar p pi (/ sl 2.)) b (polar a (dtr 235.) ac) c (polar b 0. *traplen*) d (polar c (dtr 125.) ac) e (entmakex (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(90 . 4) '(70 . 1)) (mapcar '(lambda (pt) (cons 10 (list (car pt) (cadr pt)))) (list a b c d)) ) ) ) ) ) (if e (command "_.rotate" e "" "_non" p "\\") ) (princ) ) Quote
andy_lee Posted August 27, 2014 Author Posted August 27, 2014 Try this Andy and let me know Many Thanks , Tharwat. It's nice! Is just what I need ! Quote
Tharwat Posted August 27, 2014 Posted August 27, 2014 Many Thanks , Tharwat. It's nice! Is just what I need ! Happy to hear that and you are welcome . Quote
NhonG Posted June 27, 2015 Posted June 27, 2015 Hi Tharwat, Kindly asking to another solution to draw difference four sides (input) and angle of trapezoid (angle not fix). How to add more feature in your code? Thank you in advance. Quote
Lee Mac Posted June 27, 2015 Posted June 27, 2015 See this thread: http://www.theswamp.org/index.php?topic=39256 Quote
BIGAL Posted June 28, 2015 Posted June 28, 2015 As Lee is stating without a known angle there is no solution. How do you do this now you must be fixing something or do you have a diagonal distance then its solvable. Quote
eldon Posted June 28, 2015 Posted June 28, 2015 Having an idle moment, I tried to draw the shape as dimensioned. Not straight forward Quote
BIGAL Posted June 29, 2015 Posted June 29, 2015 Eldon I got Length = 263.495 not 265 so diagram is not correct for whole degrees Quote
eldon Posted June 29, 2015 Posted June 29, 2015 Eldon I got Length = 263.495 not 265 so diagram is not correct for whole degrees When I saw the picture, I thought that it showed typical OOB settings, with the length precision set at 4 and the angle precision set at 0, with decimal degrees set in the dimensions. So that meant that there was up to half a degree tolerance in each angle, which when dimensioned would be as shown. I got 1.8 units misclosure going round with whole angles. So I adjusted angles here and there, keeping the adjustments below half a degree. For the record, here are the angles that I used:- 70°-33'-34" (dimensioned as 71°) 74°-45'-54" (dimensioned as 75°) 91°-29'-55" (dimensioned as 91°) 123°-10'-37" (dimensioned as 123°) These values are probably not unique, but once I had found one set, I was content. Quote
Lee Mac Posted June 29, 2015 Posted June 29, 2015 Regarding uniqueness: if all four lengths are constrained, only one angle is required for uniqueness; if all four lengths are given & more than one angle is specified, the geometry will be over-constrained unless the given angles are exact. I find the best way to visualise this is to reduce the problem to a rectangle which may be deformed into an infinite set of parallelograms unless an angle is given. Quote
AIberto Posted June 29, 2015 Posted June 29, 2015 Try this Andy and let me know (defun c:Test (/ dtr ac ab p sl a b c d e p) ;; Author : Tharwat Al Shoufi ;; ;; Draw Trapezoid with angle 55 on the two sides ;; ;; -------------------------------------------------- ;; (defun dtr (a) (* pi (/ a 180.0))) (if (not *traplen*) (setq *traplen* 10.0) ) (if (not *traphgt*) (setq *traphgt* 4.0) ) (if (and (setq *traplen* (cond ((getdist (strcat "\n Specify Length of Trapezoid < " (rtos *traplen* 2 2) " > :"))) (*traplen*) ) ) (setq *traphgt* (cond ((getdist (strcat "\n Specify Height of Trapezoid < " (rtos *traphgt* 2 2) " > :"))) (*traphgt*) ) ) (setq ac (/ *traphgt* (sin (dtr 55.))) ab (* ac (cos (dtr 55.))) ) (if (>= (setq sl (- *traplen* (+ ab ab))) 0.) (setq p (getpoint "\n Specify top center point of Trapezoid :")) (progn (alert "Length of Trapezoid is too small !!") nil) ) ) (progn (setq a (polar p pi (/ sl 2.)) b (polar a (dtr 235.) ac) c (polar b 0. *traplen*) d (polar c (dtr 125.) ac) e (entmakex (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(90 . 4) '(70 . 1)) (mapcar '(lambda (pt) (cons 10 (list (car pt) (cadr pt)))) (list a b c d)) ) ) ) ) ) (if e (command "_.rotate" e "" "_non" p "\\") ) (princ) ) Dear Tharwat Why can't use for 3D mode , , like this . Quote
andy_lee Posted July 21, 2015 Author Posted July 21, 2015 Dear Tharwat Why can't use for 3D mode , , like this . [ATTACH=CONFIG]54752[/ATTACH] Yes , This is a disadvantage. Hi Tharwat. can fix this ? Quote
BIGAL Posted July 21, 2015 Posted July 21, 2015 (edited) Tharwat tried using new ucs in plane but did not work, a more polar method 4 points would, but anyway I cheated and used rotate3d to get the answer. Something in the entmakex. Edited July 21, 2015 by BIGAL Quote
andy_lee Posted July 21, 2015 Author Posted July 21, 2015 Tharwat tried using new ucs in plane but did not work, a more polar method 4 points would, but anyway I cheated and used rotate3d to get the answer. Something in the entmakex. [ATTACH=CONFIG]54913[/ATTACH] Hi BIGAL ,Can you fix this? Quote
NhonG Posted July 21, 2015 Posted July 21, 2015 See this thread: http://www.theswamp.org/index.php?topic=39256 Thank you for your information. Quote
andy_lee Posted July 23, 2015 Author Posted July 23, 2015 Tharwat tried using new ucs in plane but did not work, a more polar method 4 points would, but anyway I cheated and used rotate3d to get the answer. Something in the entmakex. [ATTACH=CONFIG]54913[/ATTACH] feasible? BIGAL Quote
AIberto Posted July 28, 2015 Posted July 28, 2015 Hi andy Maybe Marko can help . You can look here http://www.theswamp.org/index.php?topic=49677.msg548509#msg548509 Quote
andy_lee Posted July 28, 2015 Author Posted July 28, 2015 Hi andyMaybe Marko can help . You can look here http://www.theswamp.org/index.php?topic=49677.msg548509#msg548509 Thank you AIberto, Marko is great. Just wait. Quote
Recommended Posts
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.