Jump to content

Recommended Posts

Posted

Hi All,

 

I'm Autolisp beginer and first problem which I would like to solve with it is how to restore layers Visibility after Layiso command.

 

In few steps it's looks like:

 

1. Before use Layiso command I'have some layers that are on others are off.

2. I'm using Layiso and makes some changes on drawning.

3. After changing I want to restor layers visibility from point 1 (before Laiso command).

 

My idea is to use LayerState functions: layerstate-save, layerstate-delete and layerstate-restore. I have problem with using LayerState functions.

 

 

I could name functions for example "Iso" and "RestoreState".

LayerState name could be "XX"

 

Program structure:

 

Step 1 - c:Iso

I'm checking if "XX" exist.

If "XX" exist then using layerstate-delete I'm deleting "XX".

I'm creating LayerState "XX" using layerstate-save.

 

Step 2

(command "Layiso")

 

Step 3

I'm doing some changes in drawing.

 

Step 4 - c:RestoreState

I'm restoring "XX" using layerstate-restore.

 

My problem is that I don't know how to use LayerState functions.

 

Many info I've found here:

http://www.cadtutor.net/forum/showthread.php?39986-LayerState-Manipulation-Info.-Coding

but still don't know how to for example make Layerstate "XX" using it.

 

(layerstate-save XX)
or
(layerstate-save "XX")
don't work. How it should look like?

 

 

Also I've tried to use only commands:

 

(defun c:iso ()

(command "-layer" "state" "save" "XX" "" "" "" "LAYISO"))

(defun c:RestoreState ()

(command "-layer" "state" "restore" "XX" "" ""))

 

 

This code don't has checking if "XX" exist but works.

How to write code using LayerState functions??

Anyone can help?

 

Sorry for my English :cry:

Posted

I forgot about this :)

Thank you.

 

How to use "layerstate-save" with defined function name "XX"?

Posted
I forgot about this :)

Thank you.

 

How to use "layerstate-save" with defined function name "XX"?

layerstate-restore

nav-prev-xp.gif L Functions

nav-up-xp.gif length

nav-next-xp.gif

 

 

AutoLISP Reference Guide > AutoLISP Functions > L Functions >

ac.right.gifExpand All

 

ac.down.gifCollapse All

 

 

layerstate-save

 

 

 

 

 

Saves a layer state in the current drawing

(layerstate-save layerstatename mask viewport)

Arguments

layerstatename A string specifying the name of the layer state to save.

 

mask An integer sum designating which properties in the layer state are to be restored.

1- Restore the saved On or Off value

2- Restore the saved Frozen or Thawed value

4- Restore the saved Lock value

8- Restore the saved Plot or No Plot value

16- Restore the saved VPVSDFLT value

32- Restore the saved Color

64- Restore the saved LineType

128- Restore the saved LineWeight

 

viewport An ename (ads_name) of the viewport whose VPLAYER setting is to be captured. If nil, the layer state will be saved without VPLAYER settings.

 

Return Values

T if the save is successful; otherwise nil

Examples

(layerstate-save “myLayerState“ 21 viewportId)T(layerstate-save “myLayerState“ nil nil)nil

Please send us your comments about this page

 

 

..................

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