
Originally Posted by
snarlcad
To be more focuessed, I guess one question is what does the "\\" mean in the previous example?
When supplying the layerstate-import function with the filename argument you will need to specify the full filepath of your .las file.
In LISP, the backslash character '\' is an escape character. In short, this means that it is used to give subsequent characters an alternative meaning, for example with the newline character '\n' or the tab character '\t'.
Hence to use a literal backslash in a string, you need to mark the backslash as literal by prefixing it with another backslash. '\\'.
To see this effect, try the following:
Code:
(princ "\nA single backslash \\")
Notice how the single backslash at the start of the string was used to give an alternative meaning to the 'n' character, creating a newline character. And similarly, the backslash prefixing another backslash '\\' marks it as a literal backslash.
Have a read of this section of the Visual LISP IDE Help Documentation:
Using the AutoLISP Language » AutoLISP Basics » Basic Output Functions » Control Characters in Strings
If you are unsure how to access this help, see this short tutorial, this may also help.
Now, how does this relate to the filepath I hear you ask...
Well, in LISP there are two ways to specify a filepath: using double backslashes (each interpreted as a single backslash by the above explanation), or by using single forward slashes.
e.g.
Code:
C:\\MyFolder\\MySubfolder\\MyFile.ext
C:/MyFolder/MySubfolder/MyFile.ext
Hence when using the layerstate-import function, you need to specify the full filepath of your .las file:
Code:
(layerstate-import "C:\\myfolder\\mysubfolder\\myfile.las")
I haven't tested, but if the .las file resides in an AutoCAD support path, the layerstate-import function may be able to find it without a full filepath, i.e. just using "myfile.las", but otherwise you can use the findfile function to get the full filepath of such a file.
I hope this helps,
Lee