.NET

Reply
Contributor
23 Posts
0 Kudos
Registered: ‎05-25-2012
Post 1 of 6

How to Lock Block Attributes?

494 Views, 5 Replies
06-07-2012 05:04 AM

Hi Experts,

 

I am filling values of Attributtes into title block using Code. I want no User can go and Update the value of Attribute.

 

Is it Possible to Lock the Attributes of the Title Block?

 

Thanks,

Vasant PADHIYAR
Distinguished Contributor
104 Posts
11 Kudos
Registered: ‎04-21-2011
Post 2 of 6

Re: How to Lock Block Attributes?

06-08-2012 11:45 PM in reply to: vasantpadhiyar71
Have you tried setting the attribute mode to "Constant"? There is a checkbox in the Attribute Definition dialog box for this. I haven't tried it but it should set the attribute so that your user won't be prompted to edit the value. Note that this will only be set once for each drawing so it may not work for you if you want to assign different values for each block reference. Refer to the AttributeDefinition.Constant property in the ObjectARX docs (arxmgd.chm) for further details on this. You can set this in code as well. Of course this won't stop a user from editing the attribute definition itself, but if a user wants to start messing with your block definitions then they can't complain if it breaks your setup.
Distinguished Contributor
104 Posts
11 Kudos
Registered: ‎04-21-2011
Post 3 of 6

Re: How to Lock Block Attributes?

06-08-2012 11:53 PM in reply to: Artvegas
You could also create seperate block definitions for eack block reference if you need different values for different block references - i.e. name them something like TitleBlock01, TitleBlock02, etc.
Contributor
23 Posts
0 Kudos
Registered: ‎05-25-2012
Post 4 of 6

Re: How to Lock Block Attributes?

06-09-2012 01:26 AM in reply to: Artvegas

Actually I want to Set the value of these Attributes using Command "TITLEBLOCK".

 

My Actual Requirement is as:

The Command "EATTEDIT" should not work if fired from AutoCAD by any User.

I want automation everywhere. No manual thing should be Possible.

 

Thanks,

Vasant PADHIYAR
*Expert Elite*
9,836 Posts
1,219 Kudos
Registered: ‎06-29-2007
Post 5 of 6

Re: How to Lock Block Attributes?

06-09-2012 01:41 AM in reply to: vasantpadhiyar71

Hi,

 

>> My Actual Requirement is as:

>> The Command "EATTEDIT" should not work

Then redefine the EATTEDIT-command or check the CommandWillStart event.

 

But what will you do if the user modifies the attributes in the property-window then?

So I think concentrating to just this command may not be the solution.

 

Maybe the most simple solution: what about setting the layer of your titleblocks to "locked" and just watch this layer is not unlocked by the user?

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Distinguished Contributor
104 Posts
11 Kudos
Registered: ‎04-21-2011
Post 6 of 6

Re: How to Lock Block Attributes?

06-09-2012 02:45 AM in reply to: Alfred.NESWADBA

Ok if you'd like to get fancy how about you create an anonymous block!

 

Anonymous blocks aren't available for editing by the user (i.e. BEDIT won't list it). For this you create your BlockTableRecord in code as per usual, except you must set its name to "*U" before you add it to the BlockTable.

 

I'm not sure whether attributes will work with this, but it doesn't matter because with anonymouse blocks you won't need them. Instead you can programatically add any text you like to your anonymous block definition and the user won't be able to modify it at all.

 

You could be even more fancy by nesting an anonymous block inside of your normal title block.

 

You could even go further and add a hard reference pointer to the block reference from an XRecord so that it can't be erased.

 

Sounds simple heh? :~)

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!