Jump to content

Layerstate applied via lisp?


jtk07

Recommended Posts

What is T?
Because Lisp is (mostly) a functional language ... everything in Lisp returns something. That's the main reason you add (princ) at the end of a defun command, otherwise you get a message on the command line stating the last value calculated inside the defun. The T is an internal Lisp value which means "true". The T you see is actually coming from the layerstate-restore function (since it's the last thing which did anything). If either layerstate-import / layerstate-restore failed, you would see "nil" at the command line (which is analogous to "false").

 

The if tests if the layerstate-import is not nil (i.e. hasn't failed), only then does it call layerstate-restore. So you can even test if the state was restored, and only then call save (although then you need to call save through the command function).

 

I'm glad you got it working at last. Did you get ScriptPro / AutoScript to work on your 64bit?

Link to comment
Share on other sites

  • Replies 32
  • Created
  • Last Reply

Top Posters In This Topic

  • jtk07

    12

  • irneb

    6

  • alanjt

    5

  • jeinbinder

    4

Top Posters In This Topic

Posted Images

After many painful conversations with Cadig via email, they did relase a 3.0 version that worked. Even tho there site said it worked the software was not posted as it said it was. later that day the website changed allowing download of the new software 3.0 not 2.5.

 

Thanks again for all the help! I have a new post today. take a Look at it if you have time.

Link to comment
Share on other sites

  • 3 years later...

I am trying to just use a regular lisp to import a .las file i have saved in a certain spot.

 

This is what i have so far:

 

(defun c:eleclay ()

 

(layerstate-import "L:\Engineered_Solutions_CAD_Standards\Electrical\Layers\ElecLayers.LAS")

)

 

I'm not sure where to go from here and its not working so far

 

I want to be able to type the command for the lisp and then have it automatically load at set current all of the layers in the .las file

 

Thanks in advance

Link to comment
Share on other sites

I am trying to just use a regular lisp to import a .las file i have saved in a certain spot.

 

This is what i have so far:

 

(defun c:eleclay ()

 

(layerstate-import "L:\Engineered_Solutions_CAD_Standards\Electrical\Layers\ElecLayers.LAS")

)

 

I'm not sure where to go from here and its not working so far

 

I want to be able to type the command for the lisp and then have it automatically load at set current all of the layers in the .las file

 

Thanks in advance

 

As long as your file path is valid, what you have should work. I would suggest adding a (princ) before the closing paren.

 

Now, when you say 'set current all of the layers in the .las file', what do you mean? You can only have one current layer at a time.

Link to comment
Share on other sites

I basically just want to import this .las file and have the layers show up in my drawing. This is my first lisp ever so i'm most likely doing something wrong. I went into AutoCAD's lisp routine writer then put what i posted above in. Then i saved the lisp, loaded it, and tried it and nothing happened. I'll try it with an easier file path and with the (princ)

Link to comment
Share on other sites

jeanbinder, don't forget to study up on lee mac's website if you're just learning- many valuable lessons therein.

Specifically, here are a few for beginners.

 

Localising Variables in autolisp:

http://www.lee-mac.com/quicklocalising.html

 

Correct methods to prompt for user information:

http://www.lee-mac.com/promptwithdefault.html

 

And the multitude of other tutorials Lee has been so kind as to place on his website.

Link to comment
Share on other sites

jeanbinder, don't forget to study up on lee mac's website if you're just learning- many valuable lessons therein.

Specifically, here are a few for beginners.

 

Localising Variables in autolisp:

http://www.lee-mac.com/quicklocalising.html

 

Correct methods to prompt for user information:

http://www.lee-mac.com/promptwithdefault.html

 

And the multitude of other tutorials Lee has been so kind as to place on his website.

 

And the site we all owe a huge debt of gratitude to, afralisp.

http://www.afralisp.net/index.php

Link to comment
Share on other sites

Yes, definitely.

I just had assumed everyone and their mother has visited afralisp more than a handful of times ;)

 

Not sure my mothers been there but I've been there several dozen times....

Link to comment
Share on other sites

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