Michaels Posted February 4, 2011 Share Posted February 4, 2011 Hello . How could I release a locked layer of an entity to be unlocked by codes not command ? Thanks Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 4, 2011 Share Posted February 4, 2011 The lock state is stored under DXF code 70 in layers associated list - use TBLOBJNAME to list the layer. Regards, Mircea Quote Link to comment Share on other sites More sharing options...
Michaels Posted February 4, 2011 Author Share Posted February 4, 2011 That's right , But how to make it unlocked ? (if (eq (cdr (assoc 70 (tblsearch "LAYER" Mylayer))) 4) ( ................................. Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 4, 2011 Share Posted February 4, 2011 To un-lock the layer set the DXF code 70 to 0 and update the entity: (if (setq LayerName (tblobjname "LAYER" Mylayer)) (progn (setq LayerList (entget LayerName) LayerList (subst (cons 70 0) (assoc 70 LayerList) LayerList)) (entmod LayerList) ) ) Regards, Mircea Quote Link to comment Share on other sites More sharing options...
Michaels Posted February 4, 2011 Author Share Posted February 4, 2011 I guess there is no need for function "entget" which is included within your codes ! Still the following codes are not changing the layer of the selected entity to be unlocked. (setq ss (car (entsel "\n Select Locked layer to release:"))) (setq e (entget ss)) (setq mylayer (cdr (assoc 8 e))) (if (eq (cdr (assoc 70 (tblsearch "LAYER" Mylayer))) 4) (progn (setq LayerList (tblsearch "LAYER" Mylayer)) (setq LayerList (subst (cons 70 0) (assoc 70 LayerList) LayerList)) (entmod LayerList) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
SOliver Posted February 4, 2011 Share Posted February 4, 2011 You could use something similar to ;Arbitrary name for example (setq myLayerName "0") ;Get active document's layers (setq layers (vla-get-layers(vla-get-activedocument(vlax-get-acad-object)))) ;Cycle through layers (vlax-for c layers ;If the name matches the current layers name (if(eq (strcase (vla-get-name c))(strcase myLayerName)) ;Change the lock property value to 0 (unlocked) -1 (locked) (vlax-put-property c 'lock 0) ) ) Quote Link to comment Share on other sites More sharing options...
Michaels Posted February 4, 2011 Author Share Posted February 4, 2011 Thanks Soliver . Can you please give it in Vanilla ? Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 4, 2011 Share Posted February 4, 2011 @Michaels: did you tested my example? Please remember than when you want to edit layer's properties should the entity name returned by TBLOBJNAME instead of TBLSEARCH. Regards, Mircea Quote Link to comment Share on other sites More sharing options...
Michaels Posted February 4, 2011 Author Share Posted February 4, 2011 @Michaels: did you tested my example?Please remember than when you want to edit layer's properties should the entity name returned by TBLOBJNAME instead of TBLSEARCH. Regards, Mircea Yes I did , but nothing has changed .I mean the layer still locked . Thanks Quote Link to comment Share on other sites More sharing options...
Michaels Posted February 4, 2011 Author Share Posted February 4, 2011 @Michaels: did you tested my example?Please remember than when you want to edit layer's properties should the entity name returned by TBLOBJNAME instead of TBLSEARCH. Regards, Mircea Yes now it is oki Thank you so much , I was confused due to the colour of the entity. Greatly appreciated. Quote Link to comment Share on other sites More sharing options...
Michaels Posted February 5, 2011 Author Share Posted February 5, 2011 Is this what you mean Mr. Alanjt ? (setq ss (car (entsel "\n Select Locked layer to release:"))) (setq e (entget ss)) (setq mylayer (cdr (assoc 8 e))) (if (eq 4 (logand 4 (cdr (assoc 70 (entget (tblobjname "LAYER" Mylayer)))))) (progn (setq LayerList (entget (tblobjname "LAYER" Mylayer))) (setq LayerList (subst (cons 70 0) (assoc 70 LayerList) LayerList)) (entmod LayerList) ) (princ) ) 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.