Jump to content

Recommended Posts

Posted

when I run this lisp (pointplt.lsp) file the following message occurs.

 

Enter points filename: c:/sa.dat

Plotting point no. 101

Value must be positive and nonzero.

; error: An error has occurred inside the *error* functiontoo many arguments

Specify height : *Cancel*

 

why ...!?

my input file format is as below (sa.dat) :

 

101 10012.7466 9983.2685 1276.38

102 10010.7815 10174.2119 1277.42

103 10010.0173 10198.5765 1277.41

104 10010.3473 10251.9172 1277.85

105 10009.6663 10274.5491 1278.74

106 10010.2772 10337.7200 1278.21

107 10011.3821 10404.5628 1278.56

108 10006.0821 10402.7942 1280.27

109 10004.9658 10336.3409 1279.94

110 10005.6855 10274.3807 1279.72

111 9990.4708 10275.4393 1279.73

POINTPLT.LSP

Posted

In the lisp file swap

 

 (command "POINT" POINT)
(command "TEXT" POINT 0.0 (strcat " " (itoa POINT_NO)))

 

For

 

 (entmake 
(list
	(cons 0 "point")
	(cons 10 POINT)
	)
)

	
(entmake
(list 
	(cons 0 "text")
	(cons 10 POINT)
	(cons 40 0)
	(cons 1 (itoa POINT_NO))
	)
	)

 

It is the (command "TEXT" POINT 0.0 ...) that appears to be causing the error. The preset text inputs from the LISP routine don't match the AutoCAD prompts. Using entmake avoids this

 

Hope this helps

 

Regards

 

Jammie

Posted (edited)

Hi,

 

You may try ImportPoints from abc autocad (mainly they organize AutoCAD courses in Italy, but they also give some useful free utilities for AutoCAD :)).

Import Points is open source (can't rewrite all code here, but you can take a look to VBA code :wink:) and allows you to import points as AutoCAD blocks, with block attributes, from csv, xls, dbf, odbc, ....

you can find it here:

 

http://www.abccorsicad.it/software_autocad.html

 

I tried it on AutoCAD 2000-2009, Windows XP, and worked

 

o:) enjoy

Edited by mtrasi
dead link updated
Posted
Hi,

 

You may try ImportPoints from abc autocad (mainly they organize AutoCAD courses in Italy, but they also give some useful free utilities for AutoCAD :)).

Import Points is open source (can't rewrite all code here, but you can take a look to VBA code :wink:) and allows you to import points as AutoCAD blocks, with block attributes, from csv, xls, dbf, odbc, ....

you can find it here:

 

http://www.abcautocad.it/software_autocad.html

 

I tried it on AutoCAD 2000-2009, Windows XP, and worked

 

o:) enjoy

 

Thank you for the tips and I chek it very soon.

Posted
Hi,

 

You may try ImportPoints from abc autocad (mainly they organize AutoCAD courses in Italy, but they also give some useful free utilities for AutoCAD :)).

Import Points is open source (can't rewrite all code here, but you can take a look to VBA code :wink:) and allows you to import points as AutoCAD blocks, with block attributes, from csv, xls, dbf, odbc, ....

you can find it here:

 

http://www.abcautocad.it/software_autocad.html

 

I tried it on AutoCAD 2000-2009, Windows XP, and worked

 

o:) enjoy

 

Hi

I download it but doesn't work with excel file , please show me a video that I see how must use of excel files.

Posted (edited)

Actually it can be done.

ABC AutoCAD plugin for AutoCAD works till 2009 release (only full, not AutoCAD LT) and even with 2010 if you install the VBA addon from Autodesk

 

You have only some problems in Vista and Seven if you don't choose a custom folder while installing, due to the fact that Program files folder won't work with setup procedures.

 

So, take a look to the AutoCAD Import Points free download page and to the tutorial:

video tutorial for autocad Import Points plugin

Edited by mtrasi
dead link removed
Posted
Actually it can be done.

ABC AutoCAD plugin for AutoCAD works till 2009 release (only full, not AutoCAD LT) and even with 2010 if you install the VBA addon from Autodesk

 

You have only some problems in Vista and Seven if you don't choose a custom folder while installing, due to the fact that Program files folder won't work with setup procedures.

 

So, take a look to the AutoCAD Import Points free download page and to the tutorial:

video tutorial for autocad Import Points plugin

 

Thanks for your good hint

when I use this program in excel mode , it just show points in autocad screen and don't show point number and z element or other annotations , why ?

Posted (edited)

Yes, take a look to the video tutorial :):

They change the block name from ACAD_POINT to another name.

In fact, if you use ACAD_POINT as block name, the software imports in AutoCAD only points and not blocks with attributes (text).

So use another name for the block in the "source and defaults" tab, i.e. MYPOINT, and it will import blocks. Then, in the "Data transfer" tab choose what fields are linked to block property "Block attribute" (bottom right in the window).

That's all.

Anyway it's better if you see the video there

You can also use a field as "BLOCK NAME" or "LAYER" instead (or along with) "Block Attribute". In this case it will create a different block/layer for every value in your field.

Edited by mtrasi
dead link removed
Posted

Another:

 

(defun c:pp (/ strbrk txt mk_lay mk_pt DOC I LLST LSPC LST NL P1 TMP TSZE)
 (vl-load-com)
 (setq lspc 1.5 tsze 1.25 doc (vla-get-ActiveDocument (vlax-get-acad-object)))

 (setq lLst '("EastLayer" "NorthLayer" "ZLayer" "PointLayer"))

 (defun StrBrk (str chrc / pos lst)    
   (while (setq pos (vl-string-position chrc str))
     (setq lst (cons (substr str 1 pos) lst)
           str (substr str (+ pos 2))))
   (reverse (cons str lst)))
 
 (defun txt (pt val lay)
   (entmake (list (cons 0 "TEXT") (cons 8 lay) (cons 10 pt) (cons 1 val) (cons 40 tsze))))

 (defun mk_pt (p) (entmake (list (cons 0 "POINT") (cons 10 p))))

 (defun mk_lay (lay) (or (tblsearch "LAYER" lay) (vla-add (vla-get-Layers doc) lay)))
 (mapcar 'mk_lay lLst) 
 
 (if (setq tmp (getfiled "Select Input File" (cond (*load) ("")) "txt" 16))
   (progn
     (setq *load tmp tmp (open tmp "r"))

     (while (setq nl (read-line tmp))
       (setq lst (cons (StrBrk nl 32) lst)))
     (close tmp)

     (foreach p lst
       (mk_pt (setq p1 (mapcar 'distof (cdr p))))

       (setq i -1)
       (mapcar
         (function
           (lambda (x y)
             (txt (polar p1 (/ (* 3 pi) 2.) (* (setq i (1+ i)) lspc tsze))
                  (strcat x y)
                  (nth i lLst)))) '("E" "N" "Z" "")

         (append (cdr p) (list (car p)))))))
 
 (princ))

Posted

I installed autocad 2010 and abc import pont under windows seven 64bit. when i open the utilty and i choose BROWSE to open the file, autocad open a debug windows of microsoft wbs. Any tip for me?

  • 2 months later...
Posted

I pulled Lee Mac's file just above

 

(defun c:pp

 

and gave it a spin in 2009/XPpro and got this for an error...

 

; error: An error has occurred inside the *error* functiontoo many arguments

 

I think this is the same error gen'd by the first .lsp posted to the OP. (I made those changes and still had trouble.)

 

Thanks

Posted

Actually, I'm receiving an error now too.... I shall investigate this!

Posted

I cannot work out what is causing the error! The code isn't exactly complicated....I don't see what it could be!

Posted

^ wOw that's quick attention for an old post! Much apprecate your taking the time. These little helper lisp are just what a guy needs sometime to get over a small hump. Let me know if you need any other details system wise that might be in play.

 

Thanks.

d

Posted

This may help also:

 

(defun c:txt@pt (/ M-Text i ss ent)

 (defun M-Text (pt str)
   (entmakex (list (cons 0 "MTEXT")         
                   (cons 100 "AcDbEntity")
                   (cons 100 "AcDbMText")
                   (cons 10 pt)
                   (cons 1 str))))

 (if (setq i -1 ss (ssget '((0 . "POINT"))))
   (while (setq ent (ssname ss (setq i (1+ i))))
     (M-Text (cdr (assoc 10 (entget ent)))
             (apply (function strcat)
                    (mapcar (function strcat)
                            '("E" "\nN" "\nZ")
                            (mapcar (function rtos)
                                    (cdr (assoc 10 (entget ent)))))))))
 (princ))
             

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