samifox Posted April 27, 2014 Posted April 27, 2014 hi im trying to entmaking lwpolyline, the problem is when set the DXF 10, i actually paste a list rather a dotted pair, any way to fix it? (defun drawPoly () (setq p nil pl nil) (while (setq p (getpoint)) (setq pl (cons p pl)) ) (entmakex (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(67 . 0) '(410 . "Model") '(8 . "SG_WALL") '(100 . "AcDbPolyline") (mapcar '(lambda (a) (append (cons 10 a))) pl) ) ) ) Quote
Tharwat Posted April 27, 2014 Posted April 27, 2014 (edited) (entmakex (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(67 . 0) (cons 410 (getvar 'ctab)) '(8 . "SG_WALL") '(70 . 1) (cons 90 (length pl)) ) (mapcar '(lambda (a) (cons 10 a)) pl) ) ) Edited April 27, 2014 by Tharwat No need to function append Quote
samifox Posted April 27, 2014 Author Posted April 27, 2014 (entmakex (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(67 . 0) (cons 410 (getvar 'ctab)) '(8 . "SG_WALL") '(70 . 1) (cons 90 (length pl)) ) (mapcar '(lambda (a) (append (cons 10 a))) pl) ) ) Hello Tharwat , its about the same as what i did? (cons 10 a) will return a list rather a dotted pair !? Quote
Tharwat Posted April 27, 2014 Posted April 27, 2014 Hello Tharwat , its about the same as what i did? (cons 10 a) will return a list rather a dotted pair !? Really ? Did your routine work for you ? There is no need to have a dotted pair because I appended the list of points to the entmakex function . Quote
Lee Mac Posted April 27, 2014 Posted April 27, 2014 (cons 10 a) will return a list rather a dotted pair !? A dotted pair will only be returned if the second argument passed to cons is an atom. If the second argument is a list, cons will push the first argument onto the front of the list. Observe: _$ (cons "a" "b") ("a" . "b") _$ (cons 1 2) (1 . 2) _$ (cons '(1 2 3) 2) ((1 2 3) . 2) _$ (cons 1 '(1 2 3)) (1 1 2 3) Quote
samifox Posted April 27, 2014 Author Posted April 27, 2014 A dotted pair will only be returned if the second argument passed to cons is an atom. If the second argument is a list, cons will push the first argument onto the front of the list. Observe: _$ (cons "a" "b") ("a" . "b") _$ (cons 1 2) (1 . 2) _$ (cons '(1 2 3) 2) ((1 2 3) . 2) _$ (cons 1 '(1 2 3)) (1 1 2 3) thats what i said , since the point coordinate are formed as a list, cons will make a list, so how come entmakex can accept list that is not dotted pair? Quote
Tharwat Posted April 27, 2014 Posted April 27, 2014 thats what i said , since the point coordinate are formed as a list, cons will make a list, so how come entmakex can accept list that is not dotted pair? All that due to the function append that I used in my previous post whilst you insist on dotted pairs . Quote
Lee Mac Posted April 27, 2014 Posted April 27, 2014 thats what i said , since the point coordinate are formed as a list, cons will make a list, so how come entmakex can accept list that is not dotted pair? DXF groups with list values will not form dotted pairs due to the behaviour described above - the only requirement is that the DXF group number is the 'car' element and the DXF value is the 'cdr' element. Quote
samifox Posted April 28, 2014 Author Posted April 28, 2014 All that due to the function append that I used in my previous post whilst you insist on dotted pairs . sorry , you right like most of the time DXF groups with list values will not form dotted pairs due to the behaviour described above - the only requirement is that the DXF group number is the 'car' element and the DXF value is the 'cdr' element. thanks LEE , i don't remember anywhere reading that the dotted pair is not a DXF mandatory data , good to know... 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.