Community
Dynamic Blocks Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How To Prevent Users From Destroying Fields In Attributes

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Libbya
1160 Views, 1 Reply

How To Prevent Users From Destroying Fields In Attributes

Would you like to prevent other users from destroying fields and yet give them the freedom of custom input in attributes?

 

The attached file features a dropdown list to select from for the field text with one option being user input.  The user input can be edited via the properties palette.  The fields will update on regen.  

 

The pertinent bits...

 

Using a block properties table two User Parameters were created with Type set to String.  The other default values were edited as needed using the Parameters Manager.  The block table was deleted.

 

The X value of gripless point move is used as the input value for lookup1.  The Y value is used for lookup2.  An X or Y value of 0 corresponds to 'USER INPUT'.  

 

A 'BRIDGE' double lookup uses the X and Y values as input to control switching between visibility states.  When 'user input' is selected, then the visibility state is turned on to switch from the lookup attribute to the user attribute.  

 

The value for the lookup1 attribute is set to a blockplaceholder field for the value of the Lookup1 parameter.  The user1 attribute is set to a blockplaceholder field for the value of the User1 parameter.  Lookup2 attribute has a field linked to Lookup2 parameter.  User2 has a field linked to User2 parameter.  

 

All parameters are placed on a *locked layer* (he he he).  Be aware that if ANY attribute is placed on a locked layer NONE of the attributes can be edited.  Therefore, you must make a user parameter for each user editable attribute and place its field in the attribute.

 

The result is that the lookups can be used to select any of the options to display or set to user input.  A regen is required to display a change.  If set to user input, the value of the corresponding User parameter is displayed.  The attributes cannot be easily edited and so the fields cannot be easily destroyed but the user input value CAN easily be edited using the properties palette.  Show the users how to edit via the properties.  Don't tell them about the locked layer.   

1 REPLY 1
Message 2 of 2
Libbya
in reply to: Libbya

One issue that may pop up is that if an attribute is justified other than Left, then when the attribute field length changes it does not automatically update the justification if the attributes are on a locked layer.  There is a simple solution for that issue as well that will maintain the illusion of uneditable attributes.  Here is a short lisp routine that creates a command "justifyattributes" with a shortcut of "JA".  It unlocks the "Attlock" layer, runs a regen and then re-locks the "Attlock" layer.  If the attributes are placed on the "Attlock" layer, then running this lisp will update the justification (and field text if the field info has been updated).  If this LISP is placed in the startup suite for a user, then every time they open a file it will automatically load the commands and also automatically update the justification of attributes on the "Attlock" layer.  If the use of a different layer name for the locked attributes is desired, then open the lisp is notepad or wordpad (or other editor) and change each occurrence of "Attlock" to the desired layer name in quotes.  

 

(defun c:justifyattributes ( / )
  (command "-layer" "m" "Attlock" "unlock" "Attlock" "")
	(command "regen")
  (command "-layer" "lock" "Attlock" "")
  (princ)
  )


(defun c:ja ( / )
  (command "-layer" "m" "Attlock" "unlock" "Attlock" "")
	(command "regen")
  (command "-layer" "lock" "Attlock" "")
  (princ)
  )

  (command "-layer" "m" "Attlock" "unlock" "Attlock" "")
	(command "regen")
  (command "-layer" "lock" "Attlock" "")

 

Here is the file again with the fields justified Right, attribute layer changed to "Attlock" and the values changed after update so they are not justified correctly.  Load the lisp to see the effect.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

”Boost

 

”Tips

 

”Services