Jump to content

freeze layer vport


au-s

Recommended Posts

Hi I have this lisp:

 

 


(defun GetList ()
 (setq iNest nil
eList nil
 )
 (setq iNest (length (last ePick)))
 (if (= iNest 1)
   (setq eList (entget (car ePick)))
   (setq eList (entget (nth (- iNest 2) (last ePick))))
 )
 (setq sLayer     (cdr (assoc 8 eList))
sObjectType (cdr (assoc 0 eList))
 )
 (if (= "INSERT" sObjectType)
   (progn
     (setq sObjectType "BLOCK"
    sBlockname (cdr (assoc 2 eList))
     )
   )
 )
)


(defun C:test ()
 (setq old_cmd (getvar "cmdecho")
old_err *error*
*error* xlist_err
 )
 (setq oldlay (getvar "clayer"))
 (command "_layer" "s" "0" "")
 (setvar "cmdecho" 0)
 (command "_.undo" "_be")
 (prompt "\nChoose a viewport: "
 )
   (if (= (getvar "tilemode") 0)
 (command "_mspace")
 (setq koll 4)
 (while (> koll 3)
   (setq ePick (nentsel "\nChoose a layer to be frozen : "))
   (if (> (length ePick) 3)
     (progn
(GetList)
(command "_vplayer" "f" slayer "" "")
     )
   )
   (setq koll (length ePick))
 )
 (setq *error* old_err)
 (command "_.undo" "_end")
 (setvar "clayer" oldlay)
 (setvar "cmdecho" old_cmd)
 (command "_pspace")
 (princ)(alert "It only runs in PSPACE"))
)

 

It gives me an error in vlide:

 

; error: too many arguments: (IF (= (GETVAR "tilemode") 0) etc etc etc ....

 

What I want is for user to:

1. Pick a viewport

2. Choose a layer to freeze from an XFREF

3. When command is done, exit mspace

 

Thanx

 

Or maybe you have another nicer one :)

Link to comment
Share on other sites

It returns too many arguments I believe because you have missed the use of a progn statement after that IF function, therefore it is trying to evaluate too many terms :thumbsup:

 

 

Yes Sir! :)

 

I noticed ... :) Thanx LeeMac & badien

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