.NET

Reply
Distinguished Mentor
gasty1001
Posts: 582
Registered: ‎04-11-2010
Message 1 of 5 (333 Views)

PropertyTypeCode Enum

333 Views, 4 Replies
08-16-2012 12:36 PM

Hi,

 

Want to know if someone has decoded PropertyTypeCode property of DynamicBlockReferenceProperty? It seems 5 is used for visibility states, 1 for position and angular parameters, 12 for origin, but that's it almost all i have so far.

 

Gaston Nunez

ADN Support Specialist
Balaji_Ram
Posts: 749
Registered: ‎03-21-2011
Message 2 of 5 (291 Views)

Re: PropertyTypeCode Enum

08-23-2012 05:34 AM in reply to: gasty1001

Hi,

 

Any specific reason for needing those value in your code ?

 

If you can provide me the usage, I can find out from my colleagues to see if they have any information on this.

 

Thank you.

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Distinguished Mentor
gasty1001
Posts: 582
Registered: ‎04-11-2010
Message 3 of 5 (282 Views)

Re: PropertyTypeCode Enum

08-23-2012 08:37 AM in reply to: Balaji_Ram

Hi,

 

Thanks for answer, I was not aware that I had to have a reason to ask. Any way,  my question was answered by Alexander Rivilis in The swamp, and the answer was to look at acdbabb.h in the Inc folder of the SDK, that file send me to acdb.h, and that file has:

 

enum DwgDataType       { kDwgNull            = 0,
                             kDwgReal            = 1,
                             kDwgInt32           = 2,
                             kDwgInt16           = 3,
                             kDwgInt8            = 4,
                             kDwgText            = 5,
                             kDwgBChunk          = 6,
                             kDwgHandle          = 7,
                             kDwgHardOwnershipId = 8,
                             kDwgSoftOwnershipId = 9,
                             kDwgHardPointerId   = 10,
                             kDwgSoftPointerId   = 11,
                             kDwg3Real           = 12,
                             kDwgInt64           = 13,
                             kDwgNotRecognized   = 19 };

 

 

As for the reason, I was trying to find what type a dynamic property  is when we are iterating it, using PropertyTypeCode (a visibility state, distance, etc).

 

Thanks again,

 

Gaston Nunez

 

 

ADN Support Specialist
Balaji_Ram
Posts: 749
Registered: ‎03-21-2011
Message 4 of 5 (262 Views)

Re: PropertyTypeCode Enum

08-23-2012 09:16 PM in reply to: gasty1001

Hi,

 

Glad to know you got that info from Alexander.

 

You dont require a reason to ask :smileyhappy: I asked for it to satisfy my curiosity and to pass it on to my colleagues if I need to ask them.

 

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Mentor
khoa.ho
Posts: 224
Registered: ‎09-15-2011
Message 5 of 5 (239 Views)

Re: PropertyTypeCode Enum

08-24-2012 02:52 PM in reply to: Balaji_Ram

I made a quick test with a sample drawing (see attachment) that has a dynamic block with all parameters. The result is shown as below:

PropertyNamePropertyTypeCode
Position X40
Position Y40
Distance40
Origin11
Distance140
Angle40
Origin11
X Distance40
Y Distance40
Origin11
Angle140
Origin11
Flip state70
Visibility1
Lookup1


From that table, PropertyTypeCode is useless to identify a parameter type, as it is not unique. So we have to use PropertyName to specify a parameter type. It is better the API to have a new enum (let's call PropertyType), so "Position X" will associate with an enum PropertyType.PositionX, and so on. Using PropertyName to find the type of a parameter is not strongly-typed and hard-coded.

Please see the sample code to write all dynamic block parameters to the AutoCAD editor:

[CommandMethod("GetAllDynamicBlockParameters")]
public void GetAllDynamicBlockParameters()
{
	Document doc = Application.DocumentManager.MdiActiveDocument;
	Database db = doc.Database;
	Editor editor = doc.Editor;
	var option = new PromptEntityOptions("\n" + "Select a block");
	PromptEntityResult result = editor.GetEntity(option);
	if (result.Status == PromptStatus.OK)
	{
		ObjectId id = result.ObjectId;
		using (Transaction trans = db.TransactionManager.StartTransaction())
		{
			var blockRef = (BlockReference)trans.GetObject(id, OpenMode.ForRead);
			DynamicBlockReferencePropertyCollection properties = blockRef.DynamicBlockReferencePropertyCollection;
			for (int i = 0; i < properties.Count; i++)
			{
				DynamicBlockReferenceProperty property = properties[i];
				editor.WriteMessage("\n" + property.PropertyName + " | " + property.PropertyTypeCode + " | " + property.Value);
			}
		}
	}
}

 

-Khoa

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.