Visual LISP, AutoLISP and General Customization

Reply
Mentor
richie.hodgson
Posts: 208
Registered: ‎11-05-2008
Message 1 of 10 (387 Views)

xl coordinates to table

387 Views, 9 Replies
03-19-2013 02:07 PM

Hi, I am in a bit of a hurry, I need to draw a table with point number, easting, northing, elevation for a lot of points and need a lisp to read the xl spreadsheet and draw the table, can you help.

Richie
Mentor
richie.hodgson
Posts: 208
Registered: ‎11-05-2008
Message 2 of 10 (360 Views)

Re: xl coordinates to table

03-19-2013 05:21 PM in reply to: richie.hodgson

I have written the atached lisp but it is reporting an error can anyone fix it for me

Richie
*Expert Elite*
JGerth
Posts: 1,924
Registered: ‎12-05-2005
Message 3 of 10 (357 Views)

Re: xl coordinates to table

03-19-2013 06:27 PM in reply to: richie.hodgson

post your sample text file please. 

Mentor
richie.hodgson
Posts: 208
Registered: ‎11-05-2008
Message 4 of 10 (354 Views)

Re: xl coordinates to table

03-19-2013 06:29 PM in reply to: richie.hodgson

Here is the text file

Richie
Mentor
devitg
Posts: 1,692
Registered: ‎03-14-2004
Message 5 of 10 (311 Views)

Re: xl coordinates to table

03-20-2013 04:20 PM in reply to: richie.hodgson

Your firts error is the WCMATCH wilcard use

 

      (prompt (strcat "\n" LN))
;;;"0\t415013.38\t790131.48\t0" 

      
      (cond
        ((wcmatch LN "*`,*") (setq CD T)); CD = Comma Delimited
;;;;the COMMA char is a reserved wildcar , in this case it will return T , despite it have no comma 
 ;;;"0\t415013.38\t790131.48\t0"
 ;;To use COMMA as pattern it need a reversed quote `
       
        ((wcmatch LN "*`\t*") (setq CD nil)); space delimited
;;Your file is not space limited , it is TAB limited
;; browse the lisp help for wcmatch 
        
        
        (T (prompt "\nDid not recognize format.") (quit)); otherwise
      ); cond

 

Also you have a miss ) 

 

	(setq pt2 (list 0 0))
	(Setq pt3 (list 0 25));_ miss parenthesis
	(setq pt4 (list 150 25))

 

 

I  have to chek it further more , it is the start.

 

Feel fre to contact me , if you want to.

 

 

 

 

 

 

Mentor
devitg
Posts: 1,692
Registered: ‎03-14-2004
Message 6 of 10 (307 Views)

Re: xl coordinates to table

03-20-2013 04:52 PM in reply to: devitg

see more observation at the lisp , and see how the dwg it is do.

 

 

Mentor
richie.hodgson
Posts: 208
Registered: ‎11-05-2008
Message 7 of 10 (302 Views)

Re: xl coordinates to table

03-20-2013 05:39 PM in reply to: richie.hodgson

Had a little time to look at my lisp and the attached works pretty well, a few tweeks to go but I am all good now. You may have the text rotated weirdly but it works fine for our 0 degrees orientation of North.

Richie
Mentor
devitg
Posts: 1,692
Registered: ‎03-14-2004
Message 8 of 10 (298 Views)

Re: xl coordinates to table

03-20-2013 05:59 PM in reply to: richie.hodgson

Ok

Mentor
richie.hodgson
Posts: 208
Registered: ‎11-05-2008
Message 9 of 10 (294 Views)

Re: xl coordinates to table

03-20-2013 08:02 PM in reply to: richie.hodgson

One quick question though, if the data was code,x,y,z instead of chainage,x,y,z what do I need to do to make that work? I get really confused with mixing up text and real numbers.

Richie
Mentor
devitg
Posts: 1,692
Registered: ‎03-14-2004
Message 10 of 10 (281 Views)

Re: xl coordinates to table

03-21-2013 04:50 AM in reply to: richie.hodgson

To fill the table , you need TEXT , so you shall use (RTOS number  2 4)   2 for decimal , 4 for precision or 

 

From the VLIDE help 

 

 

Converts a number into a string

(rtos number [mode [precision]]) 
The rtos function returns a string that is the representation of number according to the settings of mode, precision, and the system variables UNITMODE, DIMZIN, LUNITS, and LUPREC. 

Arguments

number
A number.

mode
An integer specifying the linear units mode. The mode corresponds to the values allowed for the LUNITS AutoCAD system variable. The mode can be one of the following numbers:

1 Scientific

2 Decimal

3 Engineering (feet and decimal inches)

4 Architectural (feet and fractional inches)

5 Fractional

 

ITOA , integer to alfa 

 

itoa 
 
 
Returns the conversion of an integer into a string

(itoa int) 
Arguments

int
An integer.

Return Values

A string derived from int.

Examples

Command: (itoa 33)

"33" 

Command: (itoa -17)

"-17"

 

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community