Jump to content

Recommended Posts

Posted

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)
    )
 )
)

Posted (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 by Tharwat
No need to function append
Posted
(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 !?

Posted
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 .

Posted
(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)

Posted
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?

Posted
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 . :D

Posted
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.

Posted
All that due to the function append that I used in my previous post whilst you insist on dotted pairs . :D

 

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...

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...