.NET

Reply
Valued Mentor
gasty1001
Posts: 444
Registered: ‎04-11-2010
Message 1 of 5 (290 Views)

PropertyTypeCode Enum

290 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: 663
Registered: ‎03-21-2011
Message 2 of 5 (248 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

Valued Mentor
gasty1001
Posts: 444
Registered: ‎04-11-2010
Message 3 of 5 (239 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: 663
Registered: ‎03-21-2011
Message 4 of 5 (219 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: 153
Registered: ‎09-15-2011
Message 5 of 5 (196 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community