chavlji Posted March 1, 2009 Share Posted March 1, 2009 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? Quote Link to comment Share on other sites More sharing options...
David Bethel Posted March 1, 2009 Share Posted March 1, 2009 Have you tried a REGENALL command? -David Quote Link to comment Share on other sites More sharing options...
chavlji Posted March 1, 2009 Author Share Posted March 1, 2009 Yes and it does not work. Same as Regen. Only if I show layercontrol combo and then type Regen it works. Nothing else!! (( Quote Link to comment Share on other sites More sharing options...
ASMI Posted March 1, 2009 Share Posted March 1, 2009 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. Quote Link to comment Share on other sites More sharing options...
chavlji Posted March 1, 2009 Author Share Posted March 1, 2009 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? Quote Link to comment Share on other sites More sharing options...
ASMI Posted March 1, 2009 Share Posted March 1, 2009 It works for me. Probably you have forgotten function (vl-load-com) for loading of ActiveX functions. Add it in the beginning or in the end of listing. Quote Link to comment Share on other sites More sharing options...
chavlji Posted March 2, 2009 Author Share Posted March 2, 2009 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 Quote Link to comment Share on other sites More sharing options...
ASMI Posted March 2, 2009 Share Posted March 2, 2009 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) Quote Link to comment Share on other sites More sharing options...
CAB Posted March 2, 2009 Share Posted March 2, 2009 My guess is that the layer is Frozen or OFF within the view port & not the global setting. Quote Link to comment Share on other sites More sharing options...
ASMI Posted March 2, 2009 Share Posted March 2, 2009 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. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 2, 2009 Share Posted March 2, 2009 ASMI, are you sure your not making these functions up as you go along :P Why does VLIDE not recognise that function? Quote Link to comment Share on other sites More sharing options...
ASMI Posted March 2, 2009 Share Posted March 2, 2009 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. Quote Link to comment Share on other sites More sharing options...
CAB Posted March 2, 2009 Share Posted March 2, 2009 Another alternative: http://www.theswamp.org/index.php?topic=17856.msg216623#msg216623 http://www.theswamp.org/index.php?topic=22264.msg290327#msg290327 Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 3, 2009 Share Posted March 3, 2009 Because it user defined function. ACET- Auto Cad Express Tools.. You learn something new everyday - thanks ASMI. Quote Link to comment Share on other sites More sharing options...
CAB Posted March 3, 2009 Share Posted March 3, 2009 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. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 3, 2009 Share Posted March 3, 2009 OK, I'll bear that in mind, thanks CAB. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.