Bill Tillman Posted April 5, 2016 Author Posted April 5, 2016 (edited) Stefan BMR, thanks again my friend. The first post you shared on this was very helpful. So I examined point #10 (list 10 (- (car pt02) 4.625) (+ (cadr pt02) 0.3125)) and made some tests with the syntax but try as I might I can't seem to find the "bad addition for y coordinate" in it. I copied and pasted the formulas on that line and it resolves properly, or at least that's what I'm seeing: Command: (- (car pt02) 4.625)57.375 Command: (+ (cadr pt02) 0.3125) 0.3125 UPDATE: I found a typo on point #3, fixed that and it's almost working. I'll keep hacking at it and report back later when it's all set to go. Okay, got it. (defun DrawShape (pt01 pt02) (entmakex (list '(0 . "LWPOLYLINE") '(8 . "0") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(90 . 16) '(70 . 1) ;;; 1 (list 10 (- (car pt01) (+ 2.29 (cadr pt01))) ;;; 2 (list 10 (- (car pt01) (cadr pt01)) ;;; 3 (list 10 (+ 1.375 (car pt01)) (cadr pt01)) ;;; 3 (list 10 (+ 1.375 (car pt01)) (+ 0.3125 (cadr pt01))) (cons 42 (- 1 (sqrt 2.0))) ;;; 5 (list 10 (+ 1.625 (car pt01)) (+ 0.5625 (cadr pt01))) ;;; 6 (list 10 (+ 4.375 (car pt01)) (+ 0.5625 (cadr pt01))) (cons 42 (- 1 (sqrt 2.0))) ;;; 7 (list 10 (+ 4.625 (car pt01)) (+ 0.3125 (cadr pt01))) ;;; 8 (list 10 (+ 4.625 (car pt01)) (cadr pt01)) ;;; 9 (list 10 (- (car pt02) 4.625) (cadr pt02)) ;;; 10 (list 10 (- (car pt02) 4.625) (+ (cadr pt02) 0.3125)) (cons 42 (- 1 (sqrt 2.0))) ;;; 11 (list 10 (- (car pt02) 4.375) (+ (cadr pt02) 0.5625)) ;;; 12 (list 10 (- (car pt02) 1.625) (+ (cadr pt02) 0.5625)) (cons 42 (- 1 (sqrt 2.0))) ;;; 13 (list 10 (- (car pt02) 1.375) (+ (cadr pt02) 0.3125)) ;;; 14 (list 10 (- (car pt02) 1.375) (cadr pt02)) ;;; 15 (list 10 (+ (car pt02) (cadr pt02)) ;;; 16 (list 10 (+ (car pt02) (+ (cadr pt02) 2.29)) ) ) ); end DrawShape Guess all I needed was a fresh outlook and a few hours of shuteye. Now to just replace all the hard coded numbers with variables and I'm off. Edited April 5, 2016 by Bill Tillman Quote
Stefan BMR Posted April 5, 2016 Posted April 5, 2016 My bad, Bill. It wasn't 10, but 4 (or 3bis?), but I see is already corrected. I need an extra pair of glasses too. Quote
Bill Tillman Posted April 5, 2016 Author Posted April 5, 2016 I have some situations where there will be a 3rd notch in the middle of this shape. I have it working but basically by repeating a bunch of the code twice. So I was wondering, is there a way to build the list and then entmakex from it? I think it might be easier and more efficient to build the list, and only insert the middle notch vertexes if required, then entmakex the shape. Oh yes, one last thing. this code uses entmakex, but I just found that it works equally well with entmake. So what's the difference between the two commands. I just read on AutoCAD's forum a posting which said, "entmakeX returns the created entity, entmake returns the created entity's dxf dump (same as entget). Quote
BIGAL Posted April 6, 2016 Posted April 6, 2016 I could be wrong (list 10 (- (car pt01) (+ 2.29 (cadr pt01))) (list (cons 10 (list (- (car pt01) (+ 2.29 (cadr pt01)) ) )) 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.