Jump to content

Unlocking Layer not displayed ?!


chavlji

Recommended Posts

Hello

With vla-put-lock function I lock/unlock layer "LAYER2". The problem is that this change of "LAYER2" lock mode is not displayed in viewport ! Things on layer stays dimmed/lighted.

 

Even if i use (vla-regen (vla-get-activedocument (vlax-get-acad-object)) acActiveViewport) to regenerate the viewport... still nothing happens (it does regenerate but not changes).

 

If I pull down "Layer Control" it shows that "LAYER2"'s lock state HAS changed. So it is only not displaying it.

 

If I write "REGEN" to console still no change. But if I pulldown "LayerControl" combo, click away else and then type "REGEN" to console, changes become visible...

 

Why and how to fix it?

Link to comment
Share on other sites

Yes and it does not work. Same as Regen.

 

Only if I show layercontrol combo and then type Regen it works. Nothing else!! :(((

Link to comment
Share on other sites

It seems you something do incorrectly. Change of a condition of layers does not demand regeneration. Try to get object of "Layer2":

 

Command: (setq l2(vla-Item(vla-get-Layers(vla-get-ActiveDocument(vlax-get-acad-object)))"Layer2"))
#<VLA-OBJECT IAcadLayer 0edfc7b4>

 

Than lock and unlock that layer:

 

Command: (vla-put-Lock l2 :vlax-true)
nil

Command: (vla-put-Lock l2 :vlax-false)
nil

 

The layer lock condition varies without regeneration.

 

Difficultly that be to define when there is no of your code.

Link to comment
Share on other sites

Here is the code that does not display results of unlocking (but it does unlock layers):

 

(defun UnlockAll ( / Doc Layers L Count )
 (setq Doc (vla-get-activedocument (vlax-get-acad-object))
       Layers (vla-get-layers Doc)
       Count 0)
 (vlax-for L Layers
     (if (eq :vlax-true (vla-get-lock L)) (progn
        (vla-put-lock L :vlax-false)
      (setq Count (+ 1 Count)) )))
 (setq return Count))

 

Is it working to anyone?

Link to comment
Share on other sites

I have (vl_load-com) at the begining of this procedure. It doesnt work !?

 

I cant see where is the catch... since it works to you :(

Link to comment
Share on other sites

I do not see the reasons why your code does not work. The only thing why (vl_load-com) right syntax (vl-load-com). I optimised this function having removed extra variables.

 

(defun UnlockAll(/ Count)
 (setq Count 0)
 (vlax-for l(vla-get-Layers
       (vla-get-ActiveDocument(vlax-get-acad-object)))
   (if(= :vlax-true(vla-get-Lock l))
     (progn
(vla-put-Lock l :vlax-false)
(setq Count(1+ Count)))))
 ); end of UnlockAll

(vl-load-com)

Link to comment
Share on other sites

Now I have understood. For this purpose is better to use function ACET-VIEWPORT-FROZEN-LAYER-LIST-SET with the zero list of layers. Try in command line:

 

Command: (setq vp(car(entsel)))
Select object: <Entity name: 7efa7428>

Command: (acet-viewport-frozen-layer-list-set vp '())
T

 

All layers in your viewport will be thawn.

Link to comment
Share on other sites

Why does VLIDE not recognise that function?

 

Because it user defined function. ACET- Auto Cad Express Tools.

 

ASMI, are you sure your not making these functions up as you go along.

 

It will work while works Express Tools.

Link to comment
Share on other sites

Anytime you see acet that's your clue. Alshough Express tools must be loaded before it will work & the functions are poorly documented, if at all.

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