TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: MickB on December 30, 2012, 06:18:03 AM

Title: getting lost trying to use entmake
Post by: MickB on December 30, 2012, 06:18:03 AM
Hi, I am try to get my head around using entmake.

I thought i'd try to select two points and draw a line between them, here is the code i'm using

Code: [Select]
(defun c:drawLine ()
(initget 1)
    (Setq pSP (Getpoint "\nSelect Start Point : "))
(Setq pEP (Getpoint "\nSelect End Point : "))
 
  (entmake
list(
'(0 . "LINE")
'(100 . "AcDbEntity")
'(67 . 0)
'(8 . "0")
'(100 . "AcDbLine")
(cons 10 pSP) ;;Start Point
        (cons 11 pEP) ;;End point
    )
)
)

The error message I'm getting is:
"error: bad function: (0 . "LINE")"

Can anyone tell me where I'm going wrong?

Thanks
Mick
Title: Re: getting lost trying to use entmake
Post by: gile on December 30, 2012, 06:28:47 AM
Hi,

maybe a typo, use:
Code - Auto/Visual Lisp: [Select]
  1. (entmake (list ...))

instead of:
Code - Auto/Visual Lisp: [Select]
  1. (entmake list (...))
Title: Re: getting lost trying to use entmake
Post by: Lee Mac on December 30, 2012, 06:37:40 AM
You may also wish to refer to this very recent post:
http://www.theswamp.org/index.php?topic=43465.msg487019#msg487019 (http://www.theswamp.org/index.php?topic=43465.msg487019#msg487019)
Title: Re: getting lost trying to use entmake
Post by: MickB on December 30, 2012, 07:09:05 AM
Thanks Lee,

that worked a treat.

Mick

Title: Re: getting lost trying to use entmake
Post by: CAB on December 30, 2012, 09:35:49 AM
More food for thought: 8-)

;;;=======================[ MakeEntmake.lsp ]==================================
;;; Author:  Charles Alan Butler Copyright© 2005-2012
;;; Version: 1.5 Nov. 10, 2012
;;; Purpose: To create a lisp that will recreate the objects selected
;;;          Will not process xref or nested blocks, blocks are created
;;;          from Inserts but no insert is created, you must insert
;;; Output;  A lisp file with the name of the drawing contailing the lisp code
;;; Sub_Routines:
;;;          _replace -  replace in string
;;;          dxfstrip - Strip dxf from list
;;;          make_complex -  Write additional lines needed for complex objects
;;;          dxf -  return value from a dotted pair
;;;          ToString -  convert item to a string by MP
;;; Requirements: -None
;;; Returns: -None
;;; Original Thread:  http://www.theswamp.org/index.php?topic=4814.0
;;; Latest Version: http://www.theswamp.org/index.php?topic=31145